mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 05:12:09 +00:00
python bindings: add arg type for GstRTSPUrl
This commit is contained in:
parent
61ae57cbdf
commit
8ab79b0f4b
1 changed files with 50 additions and 0 deletions
|
@ -145,6 +145,54 @@ class GstIteratorArg(ArgType):
|
|||
info.varlist.add('GstIterator', '*ret')
|
||||
info.codeafter.append(' return pygst_iterator_new(ret);')
|
||||
|
||||
class GstRTSPUrlArg(ArgType):
|
||||
"""GstRTSPUrl node generator"""
|
||||
|
||||
before = (' parse_result = gst_rtsp_url_parse (py_%(name)s, &%(name)s);\n'
|
||||
' if (parse_result != GST_RTSP_OK) {\n'
|
||||
' PyErr_SetString(PyExc_TypeError, "invalid url");\n'
|
||||
' return NULL;\n'
|
||||
' }')
|
||||
beforenull = (' if (py_%(name)s == NULL)\n'
|
||||
' %(name)s = NULL;\n'
|
||||
' else\n'
|
||||
' ' + before)
|
||||
after = (' if (%(name)s)\n'
|
||||
' gst_rtsp_url_free (%(name)s);\n')
|
||||
|
||||
def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info):
|
||||
if ptype in ('const-GstRTSPUrl*', 'GstRTSPUrl*'):
|
||||
self.write_normal_param(pname, pdflt, pnull, info)
|
||||
else:
|
||||
raise RuntimeError, "write_param not implemented for %s" % ptype
|
||||
|
||||
def write_normal_param(self, pname, pdflt, pnull, info):
|
||||
info.varlist.add('GstRTSPResult', 'parse_result')
|
||||
if pdflt:
|
||||
assert pdflt == 'NULL'
|
||||
info.varlist.add('const char', '*py_' + pname + ' = NULL')
|
||||
else:
|
||||
info.varlist.add('const char', '*py_' + pname)
|
||||
info.varlist.add('GstRTSPUrl', '*'+pname)
|
||||
info.add_parselist('s', ['&py_'+pname], [pname])
|
||||
info.arglist.append(pname)
|
||||
if pnull:
|
||||
info.codebefore.append (self.beforenull % { 'name' : pname })
|
||||
else:
|
||||
info.codebefore.append (self.before % { 'name' : pname })
|
||||
info.codeafter.append (self.after % { 'name' : pname })
|
||||
|
||||
def write_return(self, ptype, ownsreturn, info):
|
||||
if ptype == 'GstRTSPUrl*':
|
||||
info.varlist.add('GstRTSPUrl', '*ret')
|
||||
copyval = 'FALSE'
|
||||
elif ptype == 'const-GstRTSPUrl*':
|
||||
info.varlist.add('const GstRTSPUrl', '*ret')
|
||||
copyval = 'TRUE'
|
||||
else:
|
||||
raise RuntimeError, "write_return not implemented for %s" % ptype
|
||||
info.codeafter.append(' return pyg_boxed_new (GST_TYPE_CAPS, ret, '+copyval+', TRUE);')
|
||||
|
||||
class GstMiniObjectParam(Parameter):
|
||||
|
||||
def get_c_type(self):
|
||||
|
@ -343,6 +391,8 @@ matcher.register('GstCaps', GstCapsArg()) #FIXME: does this work?
|
|||
matcher.register('GstCaps*', GstCapsArg()) #FIXME: does this work?
|
||||
matcher.register('const-GstCaps*', GstCapsArg())
|
||||
matcher.register('GstIterator*', GstIteratorArg())
|
||||
matcher.register('const-GstRTSPUrl*', GstRTSPUrlArg())
|
||||
matcher.register('GstRTSPUrl*', GstRTSPUrlArg())
|
||||
|
||||
arg = PointerArg('gpointer', 'G_TYPE_POINTER')
|
||||
matcher.register('GstClockID', arg)
|
||||
|
|
Loading…
Reference in a new issue