From 15e0e2d67cf8d52339402151f983429271430351 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 20 Apr 2011 11:13:56 +0200 Subject: [PATCH] python bindings: add GstRTSPUrlParam Needed to implement MediaFactory virtual proxies --- bindings/python/arg-types.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bindings/python/arg-types.py b/bindings/python/arg-types.py index ec1d749e05..112fb301cc 100644 --- a/bindings/python/arg-types.py +++ b/bindings/python/arg-types.py @@ -213,6 +213,31 @@ class GstMiniObjectParam(Parameter): matcher.register_reverse('GstMiniObject*', GstMiniObjectParam) +class GstRTSPUrlParam(Parameter): + + def get_c_type(self): + c_type = self.props.get('c_type', None) + if c_type and c_type.startswith('const'): + return 'const GstRTSPUrl *' + return 'GstRTSPUrl *' + + def convert_c2py(self): + self.wrapper.add_declaration("char *%s_str = NULL;" % self.name) + self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) + self.wrapper.write_code(code=("if (%(name)s) {\n" + " %(name)s_str = gst_rtsp_url_get_request_uri ((GstRTSPUrl*) %(name)s);\n" + " py_%(name)s = PyString_FromString (%(name)s_str);\n" + " g_free (%(name)s_str);\n" + "} else {\n" + " Py_INCREF(Py_None);\n" + " py_%(name)s = Py_None;\n" + "}" % {'name': self.name}), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +matcher.register_reverse('const-GstRTSPUrl*', GstRTSPUrlParam) +matcher.register_reverse('GstRTSPUrl*', GstRTSPUrlParam) + class GstMiniObjectReturn(ReturnType): def get_c_type(self):