From: <bi...@ke...> - 2007-07-05 13:58:05
|
CVS Root: /cvs/gstreamer Module: gst-python Changes by: bilboed Date: Thu Jul 05 2007 13:57:55 UTC Log message: Patch by: Rene Stadler <ma...@re...> * gst/arg-types.py: * gst/gst.defs: * gst/gst.override: Handle 'gchar**' (GStrv) arguments in a uniform way. Fixes #385841 Modified files: . : ChangeLog gst : arg-types.py gst.defs gst.override Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/ChangeLog.diff?r1=1.594&r2=1.595 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/arg-types.py.diff?r1=1.18&r2=1.19 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/gst.defs.diff?r1=1.130&r2=1.131 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/gst.override.diff?r1=1.114&r2=1.115 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-python/ChangeLog,v retrieving revision 1.594 retrieving revision 1.595 diff -u -d -r1.594 -r1.595 --- ChangeLog 27 Jun 2007 15:40:12 -0000 1.594 +++ ChangeLog 5 Jul 2007 13:57:40 -0000 1.595 @@ -1,3 +1,12 @@ +2007-07-05 Edward Hervey <bi...@bi...> + + Patch by: Rene Stadler <ma...@re...> + * gst/arg-types.py: + * gst/gst.defs: + * gst/gst.override: + Handle 'gchar**' (GStrv) arguments in a uniform way. + Fixes #385841 2007-06-27 Edward Hervey <ed...@fl...> * gst/gstbuffer.override: Index: arg-types.py RCS file: /cvs/gstreamer/gst-python/gst/arg-types.py,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- arg-types.py 16 Dec 2006 14:41:21 -0000 1.18 +++ arg-types.py 5 Jul 2007 13:57:41 -0000 1.19 @@ -316,7 +316,25 @@ 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));") - +class StringArrayArg(ArgType): + """Arg type for NULL-terminated string pointer arrays (GStrv, aka gchar**).""" + def write_return(self, ptype, ownsreturn, info): + if ownsreturn: + raise NotImplementedError () + else: + info.varlist.add("gchar", "**ret") + info.codeafter.append(" if (ret) {\n" + " guint size = g_strv_length(ret);\n" + " PyObject *py_ret = PyTuple_New(size);\n" + " gint i;\n" + " for (i = 0; i < size; i++)\n" + " PyTuple_SetItem(py_ret, i,\n" + " PyString_FromString(ret[i]));\n" + " return py_ret;\n" + " }\n" + " return PyTuple_New (0);\n") matcher.register('GstClockTime', UInt64Arg()) matcher.register('GstClockTimeDiff', Int64Arg()) matcher.register('xmlNodePtr', XmlNodeArg()) @@ -353,4 +371,6 @@ matcher.register_reverse("gulong", ULongParam) matcher.register_reverse_ret("gulong", ULongReturn) +matcher.register("GStrv", StringArrayArg()) del arg Index: gst.defs RCS file: /cvs/gstreamer/gst-python/gst/gst.defs,v retrieving revision 1.130 retrieving revision 1.131 diff -u -d -r1.130 -r1.131 --- gst.defs 8 Jun 2007 15:16:08 -0000 1.130 +++ gst.defs 5 Jul 2007 13:57:41 -0000 1.131 @@ -1535,7 +1535,7 @@ (define-method get_uri_protocols (of-object "GstElementFactory") (c-name "gst_element_factory_get_uri_protocols") - (return-type "gchar**") + (return-type "GStrv") ) (define-method create @@ -6421,7 +6421,7 @@ (define-method get_extensions (of-object "GstTypeFindFactory") (c-name "gst_type_find_factory_get_extensions") (define-method get_caps @@ -6525,7 +6525,7 @@ (define-method get_protocols (of-object "GstURIHandler") (c-name "gst_uri_handler_get_protocols") (define-method get_uri Index: gst.override RCS file: /cvs/gstreamer/gst-python/gst/gst.override,v retrieving revision 1.114 retrieving revision 1.115 diff -u -d -r1.114 -r1.115 --- gst.override 4 Apr 2007 12:22:03 -0000 1.114 +++ gst.override 5 Jul 2007 13:57:41 -0000 1.115 @@ -706,29 +706,6 @@ error->code)); } %% -override gst_uri_handler_get_protocols noargs -static PyObject * -_wrap_gst_uri_handler_get_protocols (PyGObject *self) -{ - gchar **tab; - int i, len; - PyObject *ret; - - tab = gst_uri_handler_get_protocols (GST_URI_HANDLER (self->obj)); - if (!tab) { - Py_INCREF (Py_None); - return Py_None; - } - - len = g_strv_length (tab); - ret = PyList_New(len); - for (i = 0; i < len; i++) { - PyList_SetItem(ret, i, PyString_FromString(tab[i])); - return ret; -} -%% override gst_flow_get_name kwargs static PyObject * _wrap_gst_flow_get_name(PyObject *self, PyObject *args, PyObject *kwargs) |