gstreamer/gst/arg-types.py
Johan Dahlin a37dede09c examples/gstreamer/filesrc.py,player.py: New examples
Original commit message from CVS:
* examples/gstreamer/filesrc.py,player.py: New examples

* gstreamer/gstreamer.override: Add a dict like interface to GstTagList

* gstreamer/gstpad-handlers.override: New file, split out from gstreamer.override

* gstreamer/gst-types.defs: Don't use
gst_buffer_free/gst_data_free, use gst_data_unref instead.

* gstreamer/gst-types.c (PyGstData_to_value): Don't send address here.

* gstreamer/arg-types.py (GstDataPtrArg.write_param): Send the
address to stuff, since we really want to avoid segfaults :)

* gstreamer/0.6.[c,defs,h,override]: Remove, we're focusing on 0.7

* gstreamer/0.7.[c,defs,h,override]: Remove, merge with
gstreamer.*

* gstreamer/Makefile.am: Clean up, remove versioning support.
2004-02-27 18:01:52 +00:00

58 lines
2.3 KiB
Python

#
# gst-python
# Copyright (C) 2002 David I. Lehn
# 2004 Johan Dahlin
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Author: David I. Lehn <dlehn@users.sourceforge.net>
#
from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, matcher
class GstDataPtrArg(ArgType):
normal = (' if (!pygst_data_from_pyobject(py_%(name)s, &%(name)s))\n'
' return NULL;\n')
null = (' if (py_%(name)s == Py_None)\n'
' %(name)s = NULL;\n'
' else if (pyst_data_from_pyobject(py_%(name)s, %(name)s_rect))\n'
' %(name)s = &%(name)s_rect;\n'
' else\n'
' return NULL;\n')
def write_param(self, ptype, pname, pdflt, pnull, info):
if pnull:
info.varlist.add('GstData', pname + '_data')
info.varlist.add('GstData', '*' + pname)
info.varlist.add('PyObject', '*py_' + pname + ' = Py_None')
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append(pname)
info.codebefore.append(self.null % {'name': pname})
else:
info.varlist.add('GstData*', pname)
info.varlist.add('PyObject', '*py_' + pname)
info.add_parselist('O', ['&py_' + pname], [pname])
info.arglist.append(pname)
info.codebefore.append(self.normal % {'name': pname})
arg = GstDataPtrArg()
matcher.register('GstData*', arg)
matcher.register('GstClockTime', UInt64Arg())
matcher.register('GstClockTimeDiff', Int64Arg())
arg = PointerArg('gpointer', 'G_TYPE_POINTER')
matcher.register('GstClockID', arg)
del arg