+2007-07-05 Edward Hervey <bilboed@bilboed.com>
+
+ Patch by: Rene Stadler <mail@renestadler.de>
+ * 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 <edward@fluendo.com>
* gst/gstbuffer.override:
-Subproject commit e6a9941c662289c0743e5d8f4150458a664226f2
+Subproject commit 5167bced491ffe62251c62d6c5e7b9a7541e97e5
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())
matcher.register_reverse("gulong", ULongParam)
matcher.register_reverse_ret("gulong", ULongReturn)
+matcher.register("GStrv", StringArrayArg())
+
del arg
(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
(define-method get_extensions
(of-object "GstTypeFindFactory")
(c-name "gst_type_find_factory_get_extensions")
- (return-type "gchar**")
+ (return-type "GStrv")
)
(define-method get_caps
(define-method get_protocols
(of-object "GstURIHandler")
(c-name "gst_uri_handler_get_protocols")
- (return-type "gchar**")
+ (return-type "GStrv")
)
(define-method get_uri
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)