From: <bi...@ke...> - 2006-04-28 15:07:56
|
CVS Root: /cvs/gstreamer Module: gst-python Changes by: bilboed Date: Fri Apr 28 2006 15:07:53 UTC Log message: * gst/arg-types.py: GstMiniObject used as virtual methods parameters should be unreffed before calling the method and the ref-ed. Added Params and Returns for const-gchar*, GType and gulong so the code generator can generate more virtual methods handlers/proxys. * gst/gst-types.defs: * gst/gst.defs: * gst/interfaces.defs: Added vtable and virtual method definition for interfaces so we can properly use virtual methods from those interfaces in python. Modified files: . : ChangeLog gst : arg-types.py gst-types.defs gst.defs interfaces.defs Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/ChangeLog.diff?r1=1.451&r2=1.452 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/arg-types.py.diff?r1=1.15&r2=1.16 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/gst-types.defs.diff?r1=1.49&r2=1.50 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/gst.defs.diff?r1=1.113&r2=1.114 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/interfaces.defs.diff?r1=1.10&r2=1.11 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-python/ChangeLog,v retrieving revision 1.451 retrieving revision 1.452 diff -u -d -r1.451 -r1.452 --- ChangeLog 28 Apr 2006 14:54:44 -0000 1.451 +++ ChangeLog 28 Apr 2006 15:07:41 -0000 1.452 @@ -1,5 +1,18 @@ 2006-04-28 Edward Hervey <ed...@fl...> + * gst/arg-types.py: + GstMiniObject used as virtual methods parameters should be unreffed + before calling the method and the ref-ed. + Added Params and Returns for const-gchar*, GType and gulong so the + code generator can generate more virtual methods handlers/proxys. + * gst/gst-types.defs: + * gst/gst.defs: + * gst/interfaces.defs: + Added vtable and virtual method definition for interfaces so we can properly use virtual + methods from those interfaces in python. + +2006-04-28 Edward Hervey <ed...@fl...> * gst/gstmodule.c: (init_gst): Wrap the gstreamer error domains quark. Fixes #339040 Index: arg-types.py RCS file: /cvs/gstreamer/gst-python/gst/arg-types.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- arg-types.py 19 Apr 2006 12:04:19 -0000 1.15 +++ arg-types.py 28 Apr 2006 15:07:41 -0000 1.16 @@ -23,7 +23,7 @@ # Author: David I. Lehn <dl...@us...> from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, matcher -from reversewrapper import Parameter, ReturnType, GBoxedParam, GBoxedReturn +from reversewrapper import Parameter, ReturnType, GBoxedParam, GBoxedReturn, IntParam, IntReturn class XmlNodeArg(ArgType): """libxml2 node generator""" @@ -147,14 +147,15 @@ def convert_c2py(self): self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) - self.wrapper.write_code(code=("if (%s)\n" + self.wrapper.write_code(code=("if (%s) {\n" " py_%s = pygstminiobject_new((GstMiniObject *) %s);\n" - "else {\n" + " gst_mini_object_unref ((GstMiniObject *) %s);\n" + "} else {\n" " Py_INCREF(Py_None);\n" " py_%s = Py_None;\n" "}" - % (self.name, self.name, self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) + % (self.name, self.name, self.name, self.name, self.name)), + cleanup=("gst_mini_object_ref ((GstMiniObject *) %s);\nPy_DECREF(py_%s);" % (self.name, self.name))) self.wrapper.add_pyargv_item("py_%s" % self.name) matcher.register_reverse('GstMiniObject*', GstMiniObjectParam) @@ -266,6 +267,50 @@ failure_expression="!PyLong_Check(py_retval)", failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be an long");') self.wrapper.write_code("retval = PyLong_AsUnsignedLongLongMask(py_retval);") +class ULongParam(Parameter): + def get_c_type(self): + return self.props.get('c_type', 'gulong') + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = PyLong_FromUnsignedLong(%s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) +class ULongReturn(ReturnType): + def write_decl(self): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + def write_error_return(self): + self.wrapper.write_code("return -G_MAXINT;") + def write_conversion(self): + self.wrapper.write_code( + code=None, + failure_expression="!PyLong_Check(py_retval)", + failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be an long");') + self.wrapper.write_code("retval = PyLong_AsUnsignedLongMask(py_retval);") +class ConstStringReturn(ReturnType): + return "const gchar *" + self.wrapper.add_declaration("const gchar *retval;") + self.wrapper.write_code("return NULL;") + failure_expression="!PyString_Check(py_retval)", + failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be a string");') + self.wrapper.write_code("retval = g_strdup(PyString_AsString(py_retval));") matcher.register('GstClockTime', UInt64Arg()) matcher.register('GstClockTimeDiff', Int64Arg()) @@ -294,4 +339,12 @@ matcher.register_reverse(typename, UInt64Param) matcher.register_reverse_ret(typename, UInt64Return) +matcher.register_reverse_ret("const-gchar*", ConstStringReturn) +matcher.register_reverse("GType", IntParam) +matcher.register_reverse_ret("GType", IntReturn) +matcher.register_reverse("gulong", ULongParam) +matcher.register_reverse_ret("gulong", ULongReturn) del arg Index: gst-types.defs RCS file: /cvs/gstreamer/gst-python/gst/gst-types.defs,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- gst-types.defs 10 Apr 2006 09:21:09 -0000 1.49 +++ gst-types.defs 28 Apr 2006 15:07:41 -0000 1.50 @@ -1028,6 +1028,7 @@ (in-module "Gst") (c-name "GstURIHandler") (gtype-id "GST_TYPE_URI_HANDLER") + (vtable "GstURIHandlerInterface") ) (define-interface TagSetter @@ -1040,5 +1041,6 @@ (c-name "GstImplementsInterface") (gtype-id "GST_TYPE_IMPLEMENTS_INTERFACE") + (vtable "GstImplementsInterfaceClass") Index: gst.defs RCS file: /cvs/gstreamer/gst-python/gst/gst.defs,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- gst.defs 7 Apr 2006 17:21:27 -0000 1.113 +++ gst.defs 28 Apr 2006 15:07:41 -0000 1.114 @@ -2599,6 +2599,14 @@ ) +(define-virtual supported + (of-object "GstImplementsInterface") + (return-type "gboolean") + (parameters + '("GType" "iface_type") + ) +) ;; From ../gstreamer/gst/gstiterator.h (define-function iterator_new @@ -6212,6 +6220,29 @@ +(define-virtual get_type + (of-object "GstURIHandler") + (return-type "guint") +(define-virtual get_protocols + (return-type "gchar**") +(define-virtual get_uri + (return-type "const-gchar*") +(define-virtual set_uri + '("const-gchar*" "uri") ;; From ../gstreamer/gst/gstutils.h (define-function util_set_value_from_string Index: interfaces.defs RCS file: /cvs/gstreamer/gst-python/gst/interfaces.defs,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- interfaces.defs 23 Nov 2005 10:21:34 -0000 1.10 +++ interfaces.defs 28 Apr 2006 15:07:41 -0000 1.11 @@ -12,6 +12,7 @@ (c-name "GstColorBalance") (gtype-id "GST_TYPE_COLOR_BALANCE") + (vtable "GstColorBalanceClass") (define-object ColorBalanceChannel @@ -33,6 +34,7 @@ (fields '("GstMixerType" "mixer_type") ) + (vtable "GstMixerClass") (define-object MixerTrack @@ -60,18 +62,21 @@ (c-name "GstNavigation") (gtype-id "GST_TYPE_NAVIGATION") + (vtable "GstNavigationInterface") (define-interface PropertyProbe (c-name "GstPropertyProbe") (gtype-id "GST_TYPE_PROPERTY_PROBE") + (vtable "GstPropertyProbeInterface") (define-interface Tuner (c-name "GstTuner") (gtype-id "GST_TYPE_TUNER") + (vtable "GstTunerClass") (define-object TunerChannel @@ -189,6 +194,28 @@ +(define-virtual list_channels + (of-object "GstColorBalance") + (return-type "const-GList*") +(define-virtual set_value + (return-type "none") + '("GstColorBalanceChannel*" "channel") + '("gint" "value") +(define-virtual get_value + (return-type "gint") ;; From /opt/gnome/include/gstreamer-0.7/gst/mixer/mixer.h @@ -303,6 +330,48 @@ +(define-virtual list_tracks + (of-object "GstMixer") +(define-virtual set_volume + '("GstMixerTrack*" "track") + '("gint*" "volumes") +(define-virtual get_volume +(define-virtual set_mute + '("gboolean" "mute") +(define-virtual set_record + '("gboolean" "record") ;; From ../gst-plugins-base/gst-libs/gst/interfaces/mixeroptions.h (define-function gst_mixer_options_get_type @@ -355,7 +424,13 @@ - +(define-virtual send_event + (of-object "GstNavigation") + '("GstStructure*" "structure") ;; From /opt/gnome/include/gstreamer-0.7/gst/propertyprobe/propertyprobe.h @@ -451,6 +526,37 @@ +(define-virtual get_properties + (of-object "GstPropertyProbe") +(define-virtual needs_probe + '("guint" "prop_id") + '("const-GParamSpec*" "pspec") +(define-virtual probe_property +(define-virtual get_values + (return-type "GValueArray*") ;; From /opt/gnome/include/gstreamer-0.7/gst/tuner/tuner.h @@ -586,6 +692,66 @@ + (of-object "GstTuner") +(define-virtual set_channel + '("GstTunerChannel*" "channel") +(define-virtual get_channel + (return-type "GstTunerChannel*") +(define-virtual list_norms +(define-virtual set_norm + '("GstTunerNorm*" "channel") +(define-virtual get_norm + (return-type "GstTunerNorm*") +(define-virtual set_frequency + '("gulong" "frequency") +(define-virtual get_frequency + (return-type "gulong") +(define-virtual signal_strength |