From a4b7a67f84766be7f793c3da06f95b53da73433e Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 30 Jul 2012 16:24:10 -0400 Subject: [PATCH] Keep only the testsuite as we are now using GObject Introspection for bindings --- Makefile.am | 53 +- codegen/.gitignore | 1 - codegen/Makefile.am | 15 - codegen/__init__.py | 15 - codegen/argtypes.py | 1085 --- codegen/code-coverage.py | 42 - codegen/codegen.py | 1577 ---- codegen/definitions.py | 607 -- codegen/defsparser.py | 143 - codegen/docextract.py | 185 - codegen/docgen.py | 752 -- codegen/h2def.py | 536 -- codegen/mergedefs.py | 26 - codegen/mkskel.py | 89 - codegen/override.py | 290 - codegen/reversewrapper.py | 771 -- codegen/scmexpr.py | 144 - configure.ac | 422 +- gst/.gitignore | 18 - gst/Makefile.am | 196 - gst/__init__.py.in | 229 - gst/arg-types.py | 418 -- gst/audio.defs | 872 --- gst/audio.override | 72 - gst/audiomodule.c | 58 - gst/base.defs | 1164 --- gst/common.h | 73 - gst/extend/.gitignore | 1 - gst/extend/Makefile.am | 5 - gst/extend/__init__.py | 21 - gst/extend/discoverer.py | 355 - gst/extend/jukebox.py | 356 - gst/extend/leveller.py | 285 - gst/extend/pygobject.py | 172 - gst/extend/sources.py | 165 - gst/extend/utils.py | 77 - gst/gst-0.10.21.ignore | 11 - gst/gst-0.10.22.ignore | 18 - gst/gst-0.10.23.ignore | 23 - gst/gst-0.10.24.ignore | 46 - gst/gst-0.10.25.ignore | 4 - gst/gst-0.10.26.ignore | 20 - gst/gst-0.10.29.ignore | 9 - gst/gst-0.10.30.ignore | 14 - gst/gst-0.10.31.ignore | 26 - gst/gst-0.10.32.ignore | 8 - gst/gst-0.10.36.ignore | 5 - gst/gst-argtypes.c | 65 - gst/gst-disable-loadsave.ignore | 14 - gst/gst-extrafuncs.defs | 150 - gst/gst-pb-0.10.23.ignore | 19 - gst/gst-pb-0.10.25.ignore | 9 - gst/gst-pb-0.10.26.ignore | 10 - gst/gst-pb-0.10.29.ignore | 9 - gst/gst-pb-0.10.30.ignore | 7 - gst/gst-pb-0.10.31.ignore | 31 - gst/gst-pb-0.10.32.ignore | 50 - gst/gst-pb-0.10.36.ignore | 8 - gst/gst-types.defs | 1240 ---- gst/gst.defs | 9504 ------------------------ gst/gst.override | 1748 ----- gst/gstbase.override | 905 --- gst/gstbin.override | 265 - gst/gstbuffer.override | 611 -- gst/gstbus.override | 272 - gst/gstcaps.override | 474 -- gst/gstelement.override | 637 -- gst/gstelementfactory.override | 153 - gst/gstevent.override | 331 - gst/gstlibs.override | 402 - gst/gstmessage.override | 540 -- gst/gstmodule.c | 395 - gst/gstobject.override | 165 - gst/gstpad.override | 1690 ----- gst/gstquery.override | 324 - gst/gstreamer.py | 21 - gst/gststructure.override | 348 - gst/gsttaglist.override | 160 - gst/gstversion.override.in | 23 - gst/interfaces.defs | 1255 ---- gst/interfaces.override | 486 -- gst/interfacesmodule.c | 55 - gst/libs.defs | 684 -- gst/pbutils.defs | 1056 --- gst/pbutils.override | 486 -- gst/pbutilsmodule.c | 65 - gst/pygst-private.h | 44 - gst/pygst.h | 102 - gst/pygstexception.c | 269 - gst/pygstexception.h | 36 - gst/pygstiterator.c | 160 - gst/pygstminiobject-private.h | 169 - gst/pygstminiobject.c | 381 - gst/pygstminiobject.h | 39 - gst/pygstvalue.c | 414 -- gst/pygstvalue.h | 29 - gst/tag.defs | 306 - gst/tag.override | 105 - gst/tagmodule.c | 58 - gst/video.defs | 425 -- gst/video.override | 67 - gst/videomodule.c | 59 - gst/xoverlay.defs | 53 - gst/xoverlay.override | 24 - gstlibtoolimporter.py | 112 - gstltihooks.py | 0 gstoptionmodule.c | 50 - pkgconfig/.gitignore | 3 - pkgconfig/Makefile.am | 27 - pkgconfig/gst-python-uninstalled.pc.in | 16 - pkgconfig/gst-python.pc.in | 15 - plugin/Makefile.am | 11 - plugin/gstpythonplugin.c | 426 -- testsuite/Makefile.am | 38 +- 114 files changed, 13 insertions(+), 39566 deletions(-) delete mode 100644 codegen/.gitignore delete mode 100644 codegen/Makefile.am delete mode 100644 codegen/__init__.py delete mode 100644 codegen/argtypes.py delete mode 100755 codegen/code-coverage.py delete mode 100644 codegen/codegen.py delete mode 100644 codegen/definitions.py delete mode 100644 codegen/defsparser.py delete mode 100644 codegen/docextract.py delete mode 100644 codegen/docgen.py delete mode 100755 codegen/h2def.py delete mode 100755 codegen/mergedefs.py delete mode 100755 codegen/mkskel.py delete mode 100644 codegen/override.py delete mode 100644 codegen/reversewrapper.py delete mode 100644 codegen/scmexpr.py delete mode 100644 gst/.gitignore delete mode 100644 gst/Makefile.am delete mode 100644 gst/__init__.py.in delete mode 100644 gst/arg-types.py delete mode 100644 gst/audio.defs delete mode 100644 gst/audio.override delete mode 100644 gst/audiomodule.c delete mode 100644 gst/base.defs delete mode 100644 gst/common.h delete mode 100644 gst/extend/.gitignore delete mode 100644 gst/extend/Makefile.am delete mode 100644 gst/extend/__init__.py delete mode 100644 gst/extend/discoverer.py delete mode 100644 gst/extend/jukebox.py delete mode 100644 gst/extend/leveller.py delete mode 100644 gst/extend/pygobject.py delete mode 100644 gst/extend/sources.py delete mode 100644 gst/extend/utils.py delete mode 100644 gst/gst-0.10.21.ignore delete mode 100644 gst/gst-0.10.22.ignore delete mode 100644 gst/gst-0.10.23.ignore delete mode 100644 gst/gst-0.10.24.ignore delete mode 100644 gst/gst-0.10.25.ignore delete mode 100644 gst/gst-0.10.26.ignore delete mode 100644 gst/gst-0.10.29.ignore delete mode 100644 gst/gst-0.10.30.ignore delete mode 100644 gst/gst-0.10.31.ignore delete mode 100644 gst/gst-0.10.32.ignore delete mode 100644 gst/gst-0.10.36.ignore delete mode 100644 gst/gst-argtypes.c delete mode 100644 gst/gst-disable-loadsave.ignore delete mode 100644 gst/gst-extrafuncs.defs delete mode 100644 gst/gst-pb-0.10.23.ignore delete mode 100644 gst/gst-pb-0.10.25.ignore delete mode 100644 gst/gst-pb-0.10.26.ignore delete mode 100644 gst/gst-pb-0.10.29.ignore delete mode 100644 gst/gst-pb-0.10.30.ignore delete mode 100644 gst/gst-pb-0.10.31.ignore delete mode 100644 gst/gst-pb-0.10.32.ignore delete mode 100644 gst/gst-pb-0.10.36.ignore delete mode 100644 gst/gst-types.defs delete mode 100644 gst/gst.defs delete mode 100644 gst/gst.override delete mode 100644 gst/gstbase.override delete mode 100644 gst/gstbin.override delete mode 100644 gst/gstbuffer.override delete mode 100644 gst/gstbus.override delete mode 100644 gst/gstcaps.override delete mode 100644 gst/gstelement.override delete mode 100644 gst/gstelementfactory.override delete mode 100644 gst/gstevent.override delete mode 100644 gst/gstlibs.override delete mode 100644 gst/gstmessage.override delete mode 100644 gst/gstmodule.c delete mode 100644 gst/gstobject.override delete mode 100644 gst/gstpad.override delete mode 100644 gst/gstquery.override delete mode 100644 gst/gstreamer.py delete mode 100644 gst/gststructure.override delete mode 100644 gst/gsttaglist.override delete mode 100644 gst/gstversion.override.in delete mode 100644 gst/interfaces.defs delete mode 100644 gst/interfaces.override delete mode 100644 gst/interfacesmodule.c delete mode 100644 gst/libs.defs delete mode 100644 gst/pbutils.defs delete mode 100644 gst/pbutils.override delete mode 100644 gst/pbutilsmodule.c delete mode 100644 gst/pygst-private.h delete mode 100644 gst/pygst.h delete mode 100644 gst/pygstexception.c delete mode 100644 gst/pygstexception.h delete mode 100644 gst/pygstiterator.c delete mode 100644 gst/pygstminiobject-private.h delete mode 100644 gst/pygstminiobject.c delete mode 100644 gst/pygstminiobject.h delete mode 100644 gst/pygstvalue.c delete mode 100644 gst/pygstvalue.h delete mode 100644 gst/tag.defs delete mode 100644 gst/tag.override delete mode 100644 gst/tagmodule.c delete mode 100644 gst/video.defs delete mode 100644 gst/video.override delete mode 100644 gst/videomodule.c delete mode 100644 gst/xoverlay.defs delete mode 100644 gst/xoverlay.override delete mode 100644 gstlibtoolimporter.py delete mode 100644 gstltihooks.py delete mode 100644 gstoptionmodule.c delete mode 100644 pkgconfig/.gitignore delete mode 100644 pkgconfig/Makefile.am delete mode 100644 pkgconfig/gst-python-uninstalled.pc.in delete mode 100644 pkgconfig/gst-python.pc.in delete mode 100644 plugin/Makefile.am delete mode 100644 plugin/gstpythonplugin.c diff --git a/Makefile.am b/Makefile.am index 89721d52e5..df13f68559 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,68 +1,19 @@ -SUBDIRS = common codegen gst examples plugin testsuite pkgconfig - -common_cflags = $(PYTHON_INCLUDES) $(PYGOBJECT_CFLAGS) $(GST_CFLAGS) $(GST_OPTION_CFLAGS) -fno-strict-aliasing -common_libadd = $(GST_LIBS) $(GST_OPTION_LIBS) -common_ldflags = -module -avoid-version +SUBDIRS = common examples testsuite # include before EXTRA_DIST for win32 assignment include $(top_srcdir)/common/win32.mak ACLOCAL_AMFLAGS = -I m4 -I common/m4 -pyexec_LTLIBRARIES = - -if HAVE_PYGOBJECT_2_16 -pyexec_LTLIBRARIES += gstoption.la -endif - -# GStreamer option bindings -gstoption_la_CFLAGS = $(common_cflags) -gstoption_la_LIBADD = $(common_libadd) -gstoption_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(initgstoption|_PyGObject_API).*" -gstoption_la_SOURCES = gstoptionmodule.c - -EXTRA_DIST = \ - gstlibtoolimporter.py \ - pygst.py.in \ - gst-python.spec.in \ - gst-python.spec \ - RELEASE gst-python.doap \ - $(win32) - -BUILT_SOURCES = pygst.py -CLEANFILES = pygst.py pygst.pyc - include $(top_srcdir)/common/release.mak -pygst.py: $(top_srcdir)/pygst.py.in Makefile - if test -f $@; then chmod +w $@; fi - sed -e "s|@PYGSTDIR\@|$(shell pwd)|g" \ - -e "s|@GST_MAJORMINOR\@|$(GST_MAJORMINOR)|g" \ - $< > $@ - chmod -w $@ - -# rewrite pygst path in installed pygst.py, install pth file. -# they go in pyexecdir, should make 64bit users happy -install-exec-local: Makefile - $(mkinstalldirs) $(DESTDIR)$(pyexecdir) - sed -e "s|@PYGSTDIR\@|$(PYEXECDIR)/gst-$(GST_MAJORMINOR)|g" \ - -e "s|@GST_MAJORMINOR\@|$(GST_MAJORMINOR)|g" \ - $(srcdir)/pygst.py.in > $(DESTDIR)$(pyexecdir)/pygst.py - chmod 644 $(DESTDIR)$(pyexecdir)/pygst.py - echo "gst-$(GST_MAJORMINOR)" > $(DESTDIR)$(pyexecdir)/pygst.pth - -uninstall-local: - @rm $(DESTDIR)/$(pyexecdir)/pygst.py > /dev/null 2>&1 || true - @rm $(DESTDIR)/$(pyexecdir)/pygst.pth > /dev/null 2>&1 || true - check-valgrind: cd testsuite/ && make check-valgrind check-torture: @true -include $(top_srcdir)/common/coverage/lcov.mak +#include $(top_srcdir)/common/coverage/lcov.mak CRUFT_FILES = \ $(top_builddir)/common/shave \ diff --git a/codegen/.gitignore b/codegen/.gitignore deleted file mode 100644 index 0d20b6487c..0000000000 --- a/codegen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/codegen/Makefile.am b/codegen/Makefile.am deleted file mode 100644 index dd3eea0641..0000000000 --- a/codegen/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -EXTRA_DIST = \ - argtypes.py \ - code-coverage.py \ - codegen.py \ - definitions.py \ - defsparser.py \ - docextract.py \ - docgen.py \ - h2def.py \ - __init__.py \ - mergedefs.py \ - mkskel.py \ - override.py \ - reversewrapper.py \ - scmexpr.py diff --git a/codegen/__init__.py b/codegen/__init__.py deleted file mode 100644 index cfa896ee6a..0000000000 --- a/codegen/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- - -__all__ = [ - 'argtypes', - 'codegen', - 'definitions', - 'defsparser', - 'docextract', - 'docgen', - 'h2def', - 'mergedefs', - 'mkskel', - 'override', - 'scmexpr' -] diff --git a/codegen/argtypes.py b/codegen/argtypes.py deleted file mode 100644 index 4dc5faaa90..0000000000 --- a/codegen/argtypes.py +++ /dev/null @@ -1,1085 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -import string -import keyword -import struct - -class VarList: - """Nicely format a C variable list""" - def __init__(self): - self.vars = {} - def add(self, ctype, name): - if self.vars.has_key(ctype): - self.vars[ctype] = self.vars[ctype] + (name,) - else: - self.vars[ctype] = (name,) - def __str__(self): - ret = [] - for type in self.vars.keys(): - ret.append(' ') - ret.append(type) - ret.append(' ') - ret.append(string.join(self.vars[type], ', ')) - ret.append(';\n') - if ret: - ret.append('\n') - return string.join(ret, '') - return '' - -class WrapperInfo: - """A class that holds information about variable defs, code - snippets, etcd for use in writing out the function/method - wrapper.""" - def __init__(self): - self.varlist = VarList() - self.parsestr = '' - self.parselist = ['', 'kwlist'] - self.codebefore = [] - self.codeafter = [] - self.arglist = [] - self.kwlist = [] - def get_parselist(self): - return string.join(self.parselist, ', ') - def get_codebefore(self): - return string.join(self.codebefore, '') - def get_codeafter(self): - return string.join(self.codeafter, '') - def get_arglist(self): - return string.join(self.arglist, ', ') - def get_varlist(self): - return str(self.varlist) - def get_kwlist(self): - ret = ' static char *kwlist[] = { %s };\n' % \ - string.join(self.kwlist + [ 'NULL' ], ', ') - if not self.get_varlist(): - ret = ret + '\n' - return ret - - def add_parselist(self, codes, parseargs, keywords): - self.parsestr = self.parsestr + codes - for arg in parseargs: - self.parselist.append(arg) - for kw in keywords: - if keyword.iskeyword(kw): - kw = kw + '_' - self.kwlist.append('"%s"' % kw) - -class ArgType: - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - """Add code to the WrapperInfo instance to handle - parameter.""" - raise RuntimeError, "write_param not implemented for %s" % \ - self.__class__.__name__ - def write_return(self, ptype, ownsreturn, info): - """Adds a variable named ret of the return type to - info.varlist, and add any required code to info.codeafter to - convert the return value to a python object.""" - raise RuntimeError, "write_return not implemented for %s" % \ - self.__class__.__name__ - -class NoneArg(ArgType): - def write_return(self, ptype, ownsreturn, info): - info.codeafter.append(' Py_INCREF(Py_None);\n' + - ' return Py_None;') - -class StringArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - if pdflt != 'NULL': pdflt = '"' + pdflt + '"' - info.varlist.add('char', '*' + pname + ' = ' + pdflt) - else: - info.varlist.add('char', '*' + pname) - info.arglist.append(pname) - if pnull: - info.add_parselist('z', ['&' + pname], [pname]) - else: - info.add_parselist('s', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - if ownsreturn: - # have to free result ... - info.varlist.add('gchar', '*ret') - info.codeafter.append(' if (ret) {\n' + - ' PyObject *py_ret = PyString_FromString(ret);\n' + - ' g_free(ret);\n' + - ' return py_ret;\n' + - ' }\n' + - ' Py_INCREF(Py_None);\n' + - ' return Py_None;') - else: - info.varlist.add('const gchar', '*ret') - info.codeafter.append(' if (ret)\n' + - ' return PyString_FromString(ret);\n'+ - ' Py_INCREF(Py_None);\n' + - ' return Py_None;') - -class UCharArg(ArgType): - # allows strings with embedded NULLs. - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('guchar', '*' + pname + ' = "' + pdflt + '"') - else: - info.varlist.add('guchar', '*' + pname) - info.varlist.add('int', pname + '_len') - info.arglist.append(pname) - if pnull: - info.add_parselist('z#', ['&' + pname, '&' + pname + '_len'], - [pname]) - else: - info.add_parselist('s#', ['&' + pname, '&' + pname + '_len'], - [pname]) - -class CharArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('char', pname + " = '" + pdflt + "'") - else: - info.varlist.add('char', pname) - info.arglist.append(pname) - info.add_parselist('c', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('gchar', 'ret') - info.codeafter.append(' return PyString_FromStringAndSize(&ret, 1);') -class GUniCharArg(ArgType): - ret_tmpl = ('#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2\n' - ' if (ret > 0xffff) {\n' - ' PyErr_SetString(PyExc_RuntimeError, "returned character can not be represented in 16-bit unicode");\n' - ' return NULL;\n' - ' }\n' - '#endif\n' - ' py_ret = (Py_UNICODE)ret;\n' - ' return PyUnicode_FromUnicode(&py_ret, 1);\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('gunichar', pname + " = '" + pdflt + "'") - else: - info.varlist.add('gunichar', pname) - info.arglist.append(pname) - info.add_parselist('O&', ['pyg_pyobj_to_unichar_conv', '&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('gunichar', 'ret') - info.varlist.add('Py_UNICODE', 'py_ret') - info.codeafter.append(self.ret_tmpl) - - -class IntArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('int', pname + ' = ' + pdflt) - else: - info.varlist.add('int', pname) - info.arglist.append(pname) - info.add_parselist('i', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('int', 'ret') - info.codeafter.append(' return PyInt_FromLong(ret);') - -class UIntArg(ArgType): - dflt = (' if (py_%(name)s) {\n' - ' if (PyLong_Check(py_%(name)s))\n' - ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' - ' else if (PyInt_Check(py_%(name)s))\n' - ' %(name)s = PyInt_AsLong(py_%(name)s);\n' - ' else\n' - ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' - ' if (PyErr_Occurred())\n' - ' return NULL;\n' - ' }\n') - before = (' if (PyLong_Check(py_%(name)s))\n' - ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' - ' else if (PyInt_Check(py_%(name)s))\n' - ' %(name)s = PyInt_AsLong(py_%(name)s);\n' - ' else\n' - ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' - ' if (PyErr_Occurred())\n' - ' return NULL;\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if not pdflt: - pdflt = '0'; - - info.varlist.add(ptype, pname + ' = ' + pdflt) - info.codebefore.append(self.dflt % {'name':pname}) - info.varlist.add('PyObject', "*py_" + pname + ' = NULL') - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype, 'ret') - info.codeafter.append(' return PyLong_FromUnsignedLong(ret);') - -class SizeArg(ArgType): - - if struct.calcsize('P') <= struct.calcsize('l'): - llp64 = True - else: - llp64 = False - - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add(ptype, pname + ' = ' + pdflt) - else: - info.varlist.add(ptype, pname) - info.arglist.append(pname) - if self.llp64: - info.add_parselist('k', ['&' + pname], [pname]) - else: - info.add_parselist('K', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype, 'ret') - if self.llp64: - info.codeafter.append(' return PyLong_FromUnsignedLongLong(ret);\n') - else: - info.codeafter.append(' return PyLong_FromUnsignedLong(ret);\n') - -class SSizeArg(ArgType): - - if struct.calcsize('P') <= struct.calcsize('l'): - llp64 = True - else: - llp64 = False - - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add(ptype, pname + ' = ' + pdflt) - else: - info.varlist.add(ptype, pname) - info.arglist.append(pname) - if self.llp64: - info.add_parselist('l', ['&' + pname], [pname]) - else: - info.add_parselist('L', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype, 'ret') - if self.llp64: - info.codeafter.append(' return PyLong_FromLongLong(ret);\n') - else: - info.codeafter.append(' return PyLong_FromLong(ret);\n') - -class LongArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add(ptype, pname + ' = ' + pdflt) - else: - info.varlist.add(ptype, pname) - info.arglist.append(pname) - info.add_parselist('l', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype, 'ret') - info.codeafter.append(' return PyInt_FromLong(ret);\n') - -class BoolArg(IntArg): - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('int', 'ret') - info.codeafter.append(' return PyBool_FromLong(ret);\n') - -class TimeTArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('time_t', pname + ' = ' + pdflt) - else: - info.varlist.add('time_t', pname) - info.arglist.append(pname) - info.add_parselist('i', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('time_t', 'ret') - info.codeafter.append(' return PyInt_FromLong(ret);') - -class ULongArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('unsigned long', pname + ' = ' + pdflt) - else: - info.varlist.add('unsigned long', pname) - info.arglist.append(pname) - info.add_parselist('k', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype, 'ret') - info.codeafter.append(' return PyLong_FromUnsignedLong(ret);\n') - -class UInt32Arg(ULongArg): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - ULongArg.write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info) - ## if sizeof(unsigned long) > sizeof(unsigned int), we need to - ## check the value is within guint32 range - if struct.calcsize('L') > struct.calcsize('I'): - info.codebefore.append(( - ' if (%(pname)s > G_MAXUINT32) {\n' - ' PyErr_SetString(PyExc_ValueError,\n' - ' "Value out of range in conversion of"\n' - ' " %(pname)s parameter to unsigned 32 bit integer");\n' - ' return NULL;\n' - ' }\n') % vars()) - -class Int64Arg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('gint64', pname + ' = ' + pdflt) - else: - info.varlist.add('gint64', pname) - info.arglist.append(pname) - info.add_parselist('L', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('gint64', 'ret') - info.codeafter.append(' return PyLong_FromLongLong(ret);') - -class UInt64Arg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('guint64', pname + ' = ' + pdflt) - else: - info.varlist.add('guint64', pname) - info.arglist.append(pname) - info.add_parselist('K', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('guint64', 'ret') - info.codeafter.append(' return PyLong_FromUnsignedLongLong(ret);') - - -class DoubleArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('double', pname + ' = ' + pdflt) - else: - info.varlist.add('double', pname) - info.arglist.append(pname) - info.add_parselist('d', ['&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('double', 'ret') - info.codeafter.append(' return PyFloat_FromDouble(ret);') - -class FileArg(ArgType): - nulldflt = (' if (py_%(name)s == Py_None)\n' - ' %(name)s = NULL;\n' - ' else if (py_%(name)s && PyFile_Check(py_%(name)s)\n' - ' %s = PyFile_AsFile(py_%(name)s);\n' - ' else if (py_%(name)s) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a file object or None");\n' - ' return NULL;\n' - ' }') - null = (' if (py_%(name)s && PyFile_Check(py_%(name)s)\n' - ' %(name)s = PyFile_AsFile(py_%(name)s);\n' - ' else if (py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a file object or None");\n' - ' return NULL;\n' - ' }\n') - dflt = (' if (py_%(name)s)\n' - ' %(name)s = PyFile_AsFile(py_%(name)s);\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - if pdflt: - info.varlist.add('FILE', '*' + pname + ' = ' + pdflt) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.nulldflt % {'name':pname}) - else: - info.varlist.add('FILE', '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname) - info.codebefore.append(self.null & {'name':pname}) - info.arglist.appned(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - else: - if pdflt: - info.varlist.add('FILE', '*' + pname + ' = ' + pdflt) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.dflt % {'name':pname}) - info.arglist.append(pname) - else: - info.varlist.add('PyObject', '*' + pname) - info.arglist.append('PyFile_AsFile(' + pname + ')') - info.add_parselist('O!', ['&PyFile_Type', '&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('FILE', '*ret') - info.codeafter.append(' if (ret)\n' + - ' return PyFile_FromFile(ret, "", "", fclose);\n' + - ' Py_INCREF(Py_None);\n' + - ' return Py_None;') - -class EnumArg(ArgType): - enum = (' if (pyg_enum_get_value(%(typecode)s, py_%(name)s, (gint *)&%(name)s))\n' - ' return NULL;\n') - def __init__(self, enumname, typecode): - self.enumname = enumname - self.typecode = typecode - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add(self.enumname, pname + ' = ' + pdflt) - else: - info.varlist.add(self.enumname, pname) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.enum % { 'typecode': self.typecode, - 'name': pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]); - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('gint', 'ret') - info.codeafter.append(' return pyg_enum_from_gtype(%s, ret);' % self.typecode) - -class FlagsArg(ArgType): - flag = (' if (%(default)spyg_flags_get_value(%(typecode)s, py_%(name)s, (gint *)&%(name)s))\n' - ' return NULL;\n') - def __init__(self, flagname, typecode): - self.flagname = flagname - self.typecode = typecode - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add(self.flagname, pname + ' = ' + pdflt) - default = "py_%s && " % (pname,) - else: - info.varlist.add(self.flagname, pname) - default = "" - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.flag % {'default':default, - 'typecode':self.typecode, - 'name':pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('guint', 'ret') - info.codeafter.append(' return pyg_flags_from_gtype(%s, ret);' % self.typecode) - -class ObjectArg(ArgType): - # should change these checks to more typesafe versions that check - # a little further down in the class heirachy. - nulldflt = (' if ((PyObject *)py_%(name)s == Py_None)\n' - ' %(name)s = NULL;\n' - ' else if (py_%(name)s && pygobject_check(py_%(name)s, &Py%(type)s_Type))\n' - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - ' else if (py_%(name)s) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' - ' return NULL;\n' - ' }\n') - null = (' if (py_%(name)s && pygobject_check(py_%(name)s, &Py%(type)s_Type))\n' - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - ' else if ((PyObject *)py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' - ' return NULL;\n' - ' }\n') - dflt = ' if (py_%(name)s)\n' \ - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - def __init__(self, objname, parent, typecode): - self.objname = objname - self.cast = string.replace(typecode, '_TYPE_', '_', 1) - self.parent = parent - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - if pdflt: - info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) - info.varlist.add('PyGObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.nulldflt % {'name':pname, - 'cast':self.cast, - 'type':self.objname}) - else: - info.varlist.add(self.objname, '*' + pname + ' = NULL') - info.varlist.add('PyGObject', '*py_' + pname) - info.codebefore.append(self.null % {'name':pname, - 'cast':self.cast, - 'type':self.objname}) - if ptype.endswith('*'): - typename = ptype[:-1] - try: - const, typename = typename.split('const-') - except ValueError: - const = '' - if typename != ptype: - info.arglist.append('(%s *) %s' % (ptype[:-1], pname)) - else: - info.arglist.append(pname) - - info.add_parselist('O', ['&py_' + pname], [pname]) - else: - if pdflt: - info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) - info.varlist.add('PyGObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.dflt % {'name':pname, - 'cast':self.cast}) - info.arglist.append(pname) - info.add_parselist('O!', ['&Py%s_Type' % self.objname, - '&py_' + pname], [pname]) - else: - info.varlist.add('PyGObject', '*' + pname) - info.arglist.append('%s(%s->obj)' % (self.cast, pname)) - info.add_parselist('O!', ['&Py%s_Type' % self.objname, - '&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - if ptype.endswith('*'): - typename = ptype[:-1] - try: - const, typename = typename.split('const-') - except ValueError: - const = '' - info.varlist.add(typename, '*ret') - if ownsreturn: - info.varlist.add('PyObject', '*py_ret') - # < GLib 2.8: using our custom _new and _unref functions - # makes sure we update the proper GstObject refcount - info.codeafter.append(' py_ret = pygobject_new((GObject *)ret);\n' - ' if (ret != NULL)\n' - ' g_object_unref((GObject *)ret);\n' - ' return py_ret;') - else: - info.codeafter.append(' /* pygobject_new handles NULL checking */\n' + - ' return pygobject_new((GObject *)ret);') - -class MiniObjectArg(ArgType): - # should change these checks to more typesafe versions that check - # a little further down in the class heirachy. - nulldflt = (' if ((PyObject *)py_%(name)s == Py_None)\n' - ' %(name)s = NULL;\n' - ' else if (py_%(name)s) && pygstminiobject_check(py_%(name)s, &Py%(type)s_Type))\n' - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - ' else if (py_%(name)s) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' - ' return NULL;\n' - ' }\n') - null = (' if (py_%(name)s && pygstminiobject_check(py_%(name)s, &Py%(type)s_Type))\n' - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - ' else if ((PyObject *)py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' - ' return NULL;\n' - ' }\n') - dflt = ' if (py_%(name)s)\n' \ - ' %(name)s = %(cast)s(py_%(name)s->obj);\n' - def __init__(self, objname, parent, typecode): - self.objname = objname - self.cast = string.replace(typecode, '_TYPE_', '_', 1) - self.parent = parent - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - if pdflt: - info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) - info.varlist.add('PyGstMiniObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.nulldflt % {'name':pname, - 'cast':self.cast, - 'type':self.objname}) - else: - info.varlist.add(self.objname, '*' + pname + ' = NULL') - info.varlist.add('PyGstMiniObject', '*py_' + pname) - info.codebefore.append(self.null % {'name':pname, - 'cast':self.cast, - 'type':self.objname}) - if ptype.endswith('*'): - typename = ptype[:-1] - try: - const, typename = typename.split('const-') - except ValueError: - const = '' - if typename != ptype: - info.arglist.append('(%s *) %s' % (ptype[:-1], pname)) - else: - info.arglist.append(pname) - - info.add_parselist('O', ['&py_' + pname], [pname]) - else: - if pdflt: - info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) - info.varlist.add('PyGstMiniObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.dflt % {'name':pname, - 'cast':self.cast}) - info.arglist.append(pname) - info.add_parselist('O', ['&Py%s_Type' % self.objname, - '&py_' + pname], [pname]) - else: - info.varlist.add('PyGstMiniObject', '*' + pname) - info.arglist.append('%s(%s->obj)' % (self.cast, pname)) - info.add_parselist('O!', ['&Py%s_Type' % self.objname, - '&' + pname], [pname]) - if keeprefcount: - info.codebefore.append(' gst_mini_object_ref(GST_MINI_OBJECT(%s->obj));\n' % pname) - def write_return(self, ptype, ownsreturn, info): - if ptype.endswith('*'): - typename = ptype[:-1] - try: - const, typename = typename.split('const-') - except ValueError: - const = '' - info.varlist.add(typename, '*ret') - if ownsreturn: - info.varlist.add('PyObject', '*py_ret') - info.codeafter.append(' py_ret = pygstminiobject_new((GstMiniObject *)ret);\n' - ' if (ret != NULL)\n' - ' gst_mini_object_unref((GstMiniObject *)ret);\n' - ' return py_ret;') - else: - info.codeafter.append(' /* pygobject_new handles NULL checking */\n' + - ' return pygstminiobject_new((GstMiniObject *)ret);') - -class BoxedArg(ArgType): - # haven't done support for default args. Is it needed? - check = (' if (pyg_boxed_check(py_%(name)s, %(typecode)s))\n' - ' %(name)s = pyg_boxed_get(py_%(name)s, %(typename)s);\n' - ' else {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s");\n' - ' return NULL;\n' - ' }\n') - null = (' if (pyg_boxed_check(py_%(name)s, %(typecode)s))\n' - ' %(name)s = pyg_boxed_get(py_%(name)s, %(typename)s);\n' - ' else if (py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s or None");\n' - ' return NULL;\n' - ' }\n') - acopy = (' %(name)s = g_boxed_copy(%(typecode)s, %(name)s);\n') - def __init__(self, ptype, typecode): - self.typename = ptype - self.typecode = typecode - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - info.varlist.add(self.typename, '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') - info.codebefore.append(self.null % {'name': pname, - 'typename': self.typename, - 'typecode': self.typecode}) - else: - info.varlist.add(self.typename, '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname) - info.codebefore.append(self.check % {'name': pname, - 'typename': self.typename, - 'typecode': self.typecode}) - if keeprefcount: - # We need to grab a copy of the GBoxed - info.codebefore.append(self.acopy % {'name': pname, - 'typecode': self.typecode}) - if ptype[-1] == '*': - typename = ptype[:-1] - if typename[:6] == 'const-': typename = typename[6:] - if typename != self.typename: - info.arglist.append('(%s *)%s' % (ptype[:-1], pname)) - else: - info.arglist.append(pname) - else: - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - ret_tmpl = ' /* pyg_boxed_new handles NULL checking */\n' \ - ' return pyg_boxed_new(%(typecode)s, (%(saferet)s) %(ret)s, %(copy)s, TRUE);' - def write_return(self, ptype, ownsreturn, info): - if ptype[:6] == 'const-': - ptype = "const " + ptype[6:] - if ptype[-1] == '*': - info.varlist.add(ptype[:-1], '*ret') - ret = 'ret' - stype = self.typename + '*' - else: - info.varlist.add(ptype, 'ret') - ret = '&ret' - ownsreturn = 0 # of course it can't own a ref to a local var ... - stype = self.typename - info.codeafter.append(self.ret_tmpl % - { 'typecode': self.typecode, - 'ret': ret, - 'saferet' : stype, - 'copy': ownsreturn and 'FALSE' or 'TRUE'}) - -class CustomBoxedArg(ArgType): - # haven't done support for default args. Is it needed? - null = (' if (%(check)s(py_%(name)s))\n' - ' %(name)s = %(get)s(py_%(name)s);\n' - ' else if (py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' - ' return NULL;\n' - ' }\n') - def __init__(self, ptype, pytype, getter, new): - self.pytype = pytype - self.getter = getter - self.checker = 'Py' + ptype + '_Check' - self.new = new - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - info.varlist.add(ptype[:-1], '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') - info.codebefore.append(self.null % {'name': pname, - 'get': self.getter, - 'check': self.checker, - 'type': ptype[:-1]}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - else: - info.varlist.add('PyObject', '*' + pname) - info.arglist.append(self.getter + '(' + pname + ')') - info.add_parselist('O!', ['&' + self.pytype, '&' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add(ptype[:-1], '*ret') - info.codeafter.append(' if (ret)\n' + - ' return ' + self.new + '(ret);\n' + - ' Py_INCREF(Py_None);\n' + - ' return Py_None;') - -class PointerArg(ArgType): - # haven't done support for default args. Is it needed? - check = (' if (pyg_pointer_check(py_%(name)s, %(typecode)s))\n' - ' %(name)s = pyg_pointer_get(py_%(name)s, %(typename)s);\n' - ' else {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s");\n' - ' return NULL;\n' - ' }\n') - null = (' if (pyg_pointer_check(py_%(name)s, %(typecode)s))\n' - ' %(name)s = pyg_pointer_get(py_%(name)s, %(typename)s);\n' - ' else if (py_%(name)s != Py_None) {\n' - ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s or None");\n' - ' return NULL;\n' - ' }\n') - def __init__(self, ptype, typecode): - self.typename = ptype - self.typecode = typecode - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - info.varlist.add(self.typename, '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') - info.codebefore.append(self.null % {'name': pname, - 'typename': self.typename, - 'typecode': self.typecode}) - else: - info.varlist.add(self.typename, '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname) - info.codebefore.append(self.check % {'name': pname, - 'typename': self.typename, - 'typecode': self.typecode}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - if ptype[-1] == '*': - info.varlist.add(self.typename, '*ret') - info.codeafter.append(' /* pyg_pointer_new handles NULL checking */\n' + - ' return pyg_pointer_new(' + self.typecode + ', ret);') - else: - info.varlist.add(self.typename, 'ret') - info.codeafter.append(' /* pyg_pointer_new handles NULL checking */\n' + - ' return pyg_pointer_new(' + self.typecode + ', &ret);') - -class AtomArg(IntArg): - dflt = ' if (py_%(name)s) {\n' \ - ' %(name)s = pygdk_atom_from_pyobject(py_%(name)s);\n' \ - ' if (PyErr_Occurred())\n' \ - ' return NULL;\n' \ - ' }\n' - atom = (' %(name)s = pygdk_atom_from_pyobject(py_%(name)s);\n' - ' if (PyErr_Occurred())\n' - ' return NULL;\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - info.varlist.add('GdkAtom', pname + ' = ' + pdflt) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.dflt % {'name': pname}) - else: - info.varlist.add('GdkAtom', pname) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.atom % {'name': pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GdkAtom', 'ret') - info.varlist.add('PyObject *', 'py_ret') - info.varlist.add('gchar *', 'name') - info.codeafter.append(' name = gdk_atom_name(ret);\n' - ' py_ret = PyString_FromString(name);\n' - ' g_free(name);\n' - ' return py_ret;') - -class GTypeArg(ArgType): - gtype = (' if ((%(name)s = pyg_type_from_object(py_%(name)s)) == 0)\n' - ' return NULL;\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - info.varlist.add('GType', pname) - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - info.codebefore.append(self.gtype % {'name': pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GType', 'ret') - info.codeafter.append(' return pyg_type_wrapper_new(ret);') - -# simple GError handler. -class GErrorArg(ArgType): - handleerror = (' if (pyg_error_check(&%(name)s))\n' - ' return NULL;\n') - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - info.varlist.add('GError', '*' + pname + ' = NULL') - info.arglist.append('&' + pname) - info.codeafter.append(self.handleerror % { 'name': pname }) - -class GtkTreePathArg(ArgType): - # haven't done support for default args. Is it needed? - normal = (' %(name)s = pygtk_tree_path_from_pyobject(py_%(name)s);\n' - ' if (!%(name)s) {\n' - ' PyErr_SetString(PyExc_TypeError, "could not convert %(name)s to a GtkTreePath");\n' - ' return NULL;\n' - ' }\n') - null = (' if (py_%(name)s != Py_None) {\n' - ' %(name)s = pygtk_tree_path_from_pyobject(py_%(name)s);\n' - ' if (!%(name)s) {\n' - ' PyErr_SetString(PyExc_TypeError, "could not convert %(name)s to a GtkTreePath");\n' - ' return NULL;\n' - ' }\n' - ' }\n') - freepath = (' if (%(name)s)\n' - ' gtk_tree_path_free(%(name)s);\n') - def __init__(self): - pass - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pnull: - info.varlist.add('GtkTreePath', '*' + pname + ' = NULL') - info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') - info.codebefore.append(self.null % {'name': pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - else: - info.varlist.add('GtkTreePath', '*' + pname) - info.varlist.add('PyObject', '*py_' + pname) - info.codebefore.append(self.normal % {'name': pname}) - info.arglist.append(pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - info.codeafter.append(self.freepath % {'name': pname}) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GtkTreePath', '*ret') - if ownsreturn: - info.codeafter.append(' if (ret) {\n' - ' PyObject *py_ret = pygtk_tree_path_to_pyobject(ret);\n' - ' gtk_tree_path_free(ret);\n' - ' return py_ret;\n' - ' }\n' - ' Py_INCREF(Py_None);\n' - ' return Py_None;') - else: - info.codeafter.append(' if (ret) {\n' - ' PyObject *py_ret = pygtk_tree_path_to_pyobject(ret);\n' - ' return py_ret;\n' - ' }\n' - ' Py_INCREF(Py_None);\n' - ' return Py_None;') - -class GdkRectanglePtrArg(ArgType): - normal = (' if (!pygdk_rectangle_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 (pygdk_rectangle_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, keeprefcount, info): - if pnull: - info.varlist.add('GdkRectangle', pname + '_rect = { 0, 0, 0, 0 }') - info.varlist.add('GdkRectangle', '*' + 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('GdkRectangle', pname + ' = { 0, 0, 0, 0 }') - info.varlist.add('PyObject', '*py_' + pname) - info.add_parselist('O', ['&py_' + pname], [pname]) - info.arglist.append('&' + pname) - info.codebefore.append(self.normal % {'name': pname}) - -class GdkRectangleArg(ArgType): - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GdkRectangle', 'ret') - info.codeafter.append(' return pyg_boxed_new(GDK_TYPE_RECTANGLE, &ret, TRUE, TRUE);') - -class PyObjectArg(ArgType): - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - info.varlist.add('PyObject', '*' + pname) - info.add_parselist('O', ['&' + pname], [pname]) - info.arglist.append(pname) - def write_return(self, ptype, ownsreturn, info): - info.varlist.add("PyObject", "*ret") - if ownsreturn: - info.codeafter.append(' if (ret) {\n' - ' return ret;\n' - ' }\n' - ' Py_INCREF(Py_None);\n' - ' return Py_None;') - else: - info.codeafter.append(' if (!ret) ret = Py_None;\n' - ' Py_INCREF(ret);\n' - ' return ret;') - -class ArgMatcher: - def __init__(self): - self.argtypes = {} - self.reverse_argtypes = {} - self.reverse_rettypes = {} - - def register(self, ptype, handler): - self.argtypes[ptype] = handler - def register_reverse(self, ptype, handler): - self.reverse_argtypes[ptype] = handler - def register_reverse_ret(self, ptype, handler): - self.reverse_rettypes[ptype] = handler - - def register_enum(self, ptype, typecode): - if typecode is None: - typecode = "G_TYPE_NONE" - self.register(ptype, EnumArg(ptype, typecode)) - def register_flag(self, ptype, typecode): - if typecode is None: - typecode = "G_TYPE_NONE" - self.register(ptype, FlagsArg(ptype, typecode)) - def register_object(self, ptype, parent, typecode): - oa = ObjectArg(ptype, parent, typecode) - self.register(ptype, oa) # in case I forget the * in the .defs - self.register(ptype+'*', oa) - self.register('const-'+ptype+'*', oa) - if ptype == 'GdkPixmap': - # hack to handle GdkBitmap synonym. - self.register('GdkBitmap', oa) - self.register('GdkBitmap*', oa) - def register_miniobject(self, ptype, parent, typecode): - oa = MiniObjectArg(ptype, parent, typecode) - self.register(ptype, oa) # in case I forget the * in the .defs - self.register(ptype+'*', oa) - def register_boxed(self, ptype, typecode): - if self.argtypes.has_key(ptype): return - arg = BoxedArg(ptype, typecode) - self.register(ptype, arg) - self.register(ptype+'*', arg) - self.register('const-'+ptype+'*', arg) - def register_custom_boxed(self, ptype, pytype, getter, new): - arg = CustomBoxedArg(ptype, pytype, getter, new) - self.register(ptype+'*', arg) - self.register('const-'+ptype+'*', arg) - def register_pointer(self, ptype, typecode): - arg = PointerArg(ptype, typecode) - self.register(ptype, arg) - self.register(ptype+'*', arg) - self.register('const-'+ptype+'*', arg) - - def get(self, ptype): - try: - return self.argtypes[ptype] - except KeyError: - if ptype[:8] == 'GdkEvent' and ptype[-1] == '*': - return self.argtypes['GdkEvent*'] - raise - def _get_reverse_common(self, ptype, registry): - props = dict(c_type=ptype) - try: - return registry[ptype], props - except KeyError: - try: - handler = self.argtypes[ptype] - except KeyError: - if ptype.startswith('GdkEvent') and ptype.endswith('*'): - handler = self.argtypes['GdkEvent*'] - else: - raise - if isinstance(handler, ObjectArg): - return registry['GObject*'], props - elif isinstance(handler, EnumArg): - props['typecode'] = handler.typecode - props['enumname'] = handler.enumname - return registry['GEnum'], props - elif isinstance(handler, FlagsArg): - props['typecode'] = handler.typecode - props['flagname'] = handler.flagname - return registry['GFlags'], props - elif isinstance(handler, BoxedArg): - props['typecode'] = handler.typecode - props['typename'] = handler.typename - return registry['GBoxed'], props - else: - raise - def get_reverse(self, ptype): - return self._get_reverse_common(ptype, self.reverse_argtypes) - def get_reverse_ret(self, ptype): - return self._get_reverse_common(ptype, self.reverse_rettypes) - - def object_is_a(self, otype, parent): - if otype == None: return 0 - if otype == parent: return 1 - if not self.argtypes.has_key(otype): return 0 - return self.object_is_a(self.get(otype).parent, parent) - -matcher = ArgMatcher() - -arg = NoneArg() -matcher.register(None, arg) -matcher.register('none', arg) - -arg = StringArg() -matcher.register('char*', arg) -matcher.register('gchar*', arg) -matcher.register('const-char*', arg) -matcher.register('char-const*', arg) -matcher.register('const-gchar*', arg) -matcher.register('gchar-const*', arg) -matcher.register('string', arg) -matcher.register('static_string', arg) - -arg = UCharArg() -matcher.register('unsigned-char*', arg) -matcher.register('const-guchar*', arg) -matcher.register('guchar*', arg) - -arg = CharArg() -matcher.register('char', arg) -matcher.register('gchar', arg) -matcher.register('guchar', arg) - -arg = GUniCharArg() -matcher.register('gunichar', arg) - -arg = IntArg() -matcher.register('int', arg) -matcher.register('gint', arg) -matcher.register('short', arg) -matcher.register('gshort', arg) -matcher.register('gushort', arg) -matcher.register('gsize', SizeArg()) -matcher.register('gssize', SSizeArg()) -matcher.register('guint8', arg) -matcher.register('gint8', arg) -matcher.register('guint16', arg) -matcher.register('gint16', arg) -matcher.register('gint32', arg) -matcher.register('GTime', arg) - -arg = LongArg() -matcher.register('long', arg) -matcher.register('glong', arg) - -arg = UIntArg() -matcher.register('guint', arg) - -arg = BoolArg() -matcher.register('gboolean', arg) - -arg = TimeTArg() -matcher.register('time_t', arg) - -matcher.register('guint32', UInt32Arg()) - -arg = ULongArg() -matcher.register('gulong', arg) - -arg = Int64Arg() -matcher.register('gint64', arg) -matcher.register('long-long', arg) - -arg = UInt64Arg() -matcher.register('guint64', arg) -matcher.register('unsigned-long-long', arg) - -arg = DoubleArg() -matcher.register('double', arg) -matcher.register('gdouble', arg) -matcher.register('float', arg) -matcher.register('gfloat', arg) - -arg = FileArg() -matcher.register('FILE*', arg) - -# enums, flags, objects - -matcher.register('GdkAtom', AtomArg()) - -matcher.register('GType', GTypeArg()) -matcher.register('GtkType', GTypeArg()) - -matcher.register('GError**', GErrorArg()) -matcher.register('GtkTreePath*', GtkTreePathArg()) -matcher.register('GdkRectangle*', GdkRectanglePtrArg()) -matcher.register('GtkAllocation*', GdkRectanglePtrArg()) -matcher.register('GdkRectangle', GdkRectangleArg()) -matcher.register('PyObject*', PyObjectArg()) - -matcher.register('GdkNativeWindow', ULongArg()) - -matcher.register_object('GObject', None, 'G_TYPE_OBJECT') -matcher.register_miniobject('GstMiniObject', None, 'GST_TYPE_MINI_OBJECT') - -del arg diff --git a/codegen/code-coverage.py b/codegen/code-coverage.py deleted file mode 100755 index fd15034736..0000000000 --- a/codegen/code-coverage.py +++ /dev/null @@ -1,42 +0,0 @@ -from __future__ import generators -import sys, os - -def read_symbols(file, type=None, dynamic=0): - if dynamic: - cmd = 'nm -D %s' % file - else: - cmd = 'nm %s' % file - for line in os.popen(cmd, 'r'): - if line[0] != ' ': # has an address as first bit of line - while line[0] != ' ': - line = line[1:] - while line[0] == ' ': - line = line[1:] - # we should be up to "type symbolname" now - sym_type = line[0] - symbol = line[1:].strip() - - if not type or type == sym_type: - yield symbol - -def main(): - if len(sys.argv) != 3: - sys.stderr.write('usage: coverage-check library.so wrapper.so\n') - sys.exit(1) - library = sys.argv[1] - wrapper = sys.argv[2] - - # first create a dict with all referenced symbols in the wrapper - # should really be a set, but a dict will do ... - wrapper_symbols = {} - for symbol in read_symbols(wrapper, type='U', dynamic=1): - wrapper_symbols[symbol] = 1 - - # now go through the library looking for matches on the defined symbols: - for symbol in read_symbols(library, type='T', dynamic=1): - if symbol[0] == '_': continue - if symbol not in wrapper_symbols: - print symbol - -if __name__ == '__main__': - main() diff --git a/codegen/codegen.py b/codegen/codegen.py deleted file mode 100644 index 740199d32d..0000000000 --- a/codegen/codegen.py +++ /dev/null @@ -1,1577 +0,0 @@ -import getopt -import keyword -import os -import string -import sys - -import argtypes -import definitions -import defsparser -import override -import reversewrapper - -class Coverage(object): - def __init__(self, name): - self.name = name - self.wrapped = 0 - self.not_wrapped = 0 - - def declare_wrapped(self): - self.wrapped += 1 - - def declare_not_wrapped(self): - self.not_wrapped += 1 - - def printstats(self): - total = self.wrapped + self.not_wrapped - fd = sys.stderr - if total: - fd.write("***INFO*** The coverage of %s is %.2f%% (%i/%i)\n" % - (self.name, - float(self.wrapped*100)/total, - self.wrapped, - total)) - else: - fd.write("***INFO*** There are no declared %s." % self.name) - -functions_coverage = Coverage("global functions") -methods_coverage = Coverage("methods") -vproxies_coverage = Coverage("virtual proxies") -vaccessors_coverage = Coverage("virtual accessors") -iproxies_coverage = Coverage("interface proxies") - -def exc_info(): - #traceback.print_exc() - etype, value, tb = sys.exc_info() - ret = "" - try: - sval = str(value) - if etype == KeyError: - ret = "No ArgType for %s" % (sval,) - else: - ret = sval - finally: - del etype, value, tb - return ret - -def fixname(name): - if keyword.iskeyword(name): - return name + '_' - return name - -class FileOutput: - '''Simple wrapper for file object, that makes writing #line - statements easier.''' # " - def __init__(self, fp, filename=None): - self.fp = fp - self.lineno = 1 - if filename: - self.filename = filename - else: - self.filename = self.fp.name - # handle writing to the file, and keep track of the line number ... - def write(self, str): - self.fp.write(str) - self.lineno = self.lineno + string.count(str, '\n') - def writelines(self, sequence): - for line in sequence: - self.write(line) - def close(self): - self.fp.close() - def flush(self): - self.fp.flush() - - def setline(self, linenum, filename): - '''writes out a #line statement, for use by the C - preprocessor.''' # " - self.write('#line %d "%s"\n' % (linenum, filename)) - def resetline(self): - '''resets line numbering to the original file''' - self.setline(self.lineno + 1, self.filename) - -class Wrapper: - type_tmpl = ( - 'PyTypeObject Py%(typename)s_Type = {\n' - ' PyObject_HEAD_INIT(NULL)\n' - ' 0, /* ob_size */\n' - ' "%(classname)s", /* tp_name */\n' - ' sizeof(%(tp_basicsize)s), /* tp_basicsize */\n' - ' 0, /* tp_itemsize */\n' - ' /* methods */\n' - ' (destructor)%(tp_dealloc)s, /* tp_dealloc */\n' - ' (printfunc)0, /* tp_print */\n' - ' (getattrfunc)%(tp_getattr)s, /* tp_getattr */\n' - ' (setattrfunc)%(tp_setattr)s, /* tp_setattr */\n' - ' (cmpfunc)%(tp_compare)s, /* tp_compare */\n' - ' (reprfunc)%(tp_repr)s, /* tp_repr */\n' - ' (PyNumberMethods*)%(tp_as_number)s, /* tp_as_number */\n' - ' (PySequenceMethods*)%(tp_as_sequence)s, /* tp_as_sequence */\n' - ' (PyMappingMethods*)%(tp_as_mapping)s, /* tp_as_mapping */\n' - ' (hashfunc)%(tp_hash)s, /* tp_hash */\n' - ' (ternaryfunc)%(tp_call)s, /* tp_call */\n' - ' (reprfunc)%(tp_str)s, /* tp_str */\n' - ' (getattrofunc)%(tp_getattro)s, /* tp_getattro */\n' - ' (setattrofunc)%(tp_setattro)s, /* tp_setattro */\n' - ' (PyBufferProcs*)%(tp_as_buffer)s, /* tp_as_buffer */\n' - ' %(tp_flags)s, /* tp_flags */\n' - ' %(tp_doc)s, /* Documentation string */\n' - ' (traverseproc)%(tp_traverse)s, /* tp_traverse */\n' - ' (inquiry)%(tp_clear)s, /* tp_clear */\n' - ' (richcmpfunc)%(tp_richcompare)s, /* tp_richcompare */\n' - ' %(tp_weaklistoffset)s, /* tp_weaklistoffset */\n' - ' (getiterfunc)%(tp_iter)s, /* tp_iter */\n' - ' (iternextfunc)%(tp_iternext)s, /* tp_iternext */\n' - ' (struct PyMethodDef*)%(tp_methods)s, /* tp_methods */\n' - ' (struct PyMemberDef*)0, /* tp_members */\n' - ' (struct PyGetSetDef*)%(tp_getset)s, /* tp_getset */\n' - ' NULL, /* tp_base */\n' - ' NULL, /* tp_dict */\n' - ' (descrgetfunc)%(tp_descr_get)s, /* tp_descr_get */\n' - ' (descrsetfunc)%(tp_descr_set)s, /* tp_descr_set */\n' - ' %(tp_dictoffset)s, /* tp_dictoffset */\n' - ' (initproc)%(tp_init)s, /* tp_init */\n' - ' (allocfunc)%(tp_alloc)s, /* tp_alloc */\n' - ' (newfunc)%(tp_new)s, /* tp_new */\n' - ' (freefunc)%(tp_free)s, /* tp_free */\n' - ' (inquiry)%(tp_is_gc)s /* tp_is_gc */\n' - '};\n\n' - ) - - slots_list = [ - 'tp_getattr', 'tp_setattr', 'tp_getattro', 'tp_setattro', - 'tp_compare', 'tp_repr', - 'tp_as_number', 'tp_as_sequence', 'tp_as_mapping', 'tp_hash', - 'tp_call', 'tp_str', 'tp_as_buffer', 'tp_richcompare', 'tp_iter', - 'tp_iternext', 'tp_descr_get', 'tp_descr_set', 'tp_init', - 'tp_alloc', 'tp_new', 'tp_free', 'tp_is_gc', - 'tp_traverse', 'tp_clear', 'tp_dealloc', 'tp_flags', 'tp_doc' - ] - - getter_tmpl = ( - 'static PyObject *\n' - '%(funcname)s(PyObject *self, void *closure)\n' - '{\n' - '%(varlist)s' - ' ret = %(field)s;\n' - '%(codeafter)s\n' - '}\n\n' - ) - - parse_tmpl = ( - ' if (!PyArg_ParseTupleAndKeywords(args, kwargs,' - '"%(typecodes)s:%(name)s"%(parselist)s))\n' - ' return %(errorreturn)s;\n' - ) - - deprecated_tmpl = ( - ' if (PyErr_Warn(PyExc_DeprecationWarning, ' - '"%(deprecationmsg)s") < 0)\n' - ' return %(errorreturn)s;\n' - ) - - methdef_tmpl = ( - ' { "%(name)s", (PyCFunction)%(cname)s, %(flags)s,\n' - ' %(docstring)s },\n' - ) - - noconstructor = ( - 'static int\n' - 'pygobject_no_constructor(PyObject *self, PyObject *args, ' - 'PyObject *kwargs)\n' - '{\n' - ' gchar buf[512];\n' - '\n' - ' g_snprintf(buf, sizeof(buf), "%s is an abstract widget", ' - 'self->ob_type->tp_name);\n' - ' PyErr_SetString(PyExc_NotImplementedError, buf);\n' - ' return -1;\n' - '}\n\n' - ) - - function_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' %(begin_allow_threads)s\n' - ' %(setreturn)s%(cname)s(%(arglist)s);\n' - ' %(end_allow_threads)s\n' - '%(codeafter)s\n' - '}\n\n' - ) - - virtual_accessor_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *cls%(extraparams)s)\n' - '{\n' - ' gpointer klass;\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' klass = g_type_class_ref(pyg_type_from_object(cls));\n' - ' if (%(class_cast_macro)s(klass)->%(virtual)s) {\n' - ' pyg_begin_allow_threads;\n' - ' %(setreturn)s%(class_cast_macro)s(klass)->' - '%(virtual)s(%(arglist)s);\n' - ' pyg_end_allow_threads;\n' - ' } else {\n' - ' PyErr_SetString(PyExc_NotImplementedError, ' - '"virtual method %(name)s not implemented");\n' - ' g_type_class_unref(klass);\n' - ' return NULL;\n' - ' }\n' - ' g_type_class_unref(klass);\n' - '%(codeafter)s\n' - '}\n\n' - ) - - # template for method calls - constructor_tmpl = None - method_tmpl = None - - def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): - self.parser = parser - self.objinfo = objinfo - self.overrides = overrides - self.fp = fp - - def get_lower_name(self): - return string.lower(string.replace(self.objinfo.typecode, - '_TYPE_', '_', 1)) - - def get_field_accessor(self, fieldname): - raise NotImplementedError - - def get_initial_class_substdict(self): return {} - - def get_initial_constructor_substdict(self, constructor): - return { 'name': '%s.__init__' % self.objinfo.c_name, - 'errorreturn': '-1' } - def get_initial_method_substdict(self, method): - substdict = { 'name': '%s.%s' % (self.objinfo.c_name, method.name) } - substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;' - substdict['end_allow_threads'] = 'pyg_end_allow_threads;' - return substdict - - def write_class(self): - if self.overrides.is_type_ignored(self.objinfo.c_name): - return - self.fp.write('\n/* ----------- %s ----------- */\n\n' % - self.objinfo.c_name) - substdict = self.get_initial_class_substdict() - if not substdict.has_key('tp_flags'): - substdict['tp_flags'] = 'Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE' - substdict['typename'] = self.objinfo.c_name - if self.overrides.modulename: - substdict['classname'] = '%s.%s' % (self.overrides.modulename, - self.objinfo.name) - else: - substdict['classname'] = self.objinfo.name - substdict['tp_doc'] = self.objinfo.docstring - - # Maybe this could be done in a nicer way, but I'll leave it as it is - # for now: -- Johan - if not self.overrides.slot_is_overriden('%s.tp_init' % - self.objinfo.c_name): - substdict['tp_init'] = self.write_constructor() - substdict['tp_methods'] = self.write_methods() - substdict['tp_getset'] = self.write_getsets() - - # handle slots ... - for slot in self.slots_list: - - slotname = '%s.%s' % (self.objinfo.c_name, slot) - slotfunc = '_wrap_%s_%s' % (self.get_lower_name(), slot) - if slot[:6] == 'tp_as_': - slotfunc = '&' + slotfunc - if self.overrides.slot_is_overriden(slotname): - data = self.overrides.slot_override(slotname) - self.write_function(slotname, data) - substdict[slot] = slotfunc - else: - if not substdict.has_key(slot): - substdict[slot] = '0' - - self.fp.write(self.type_tmpl % substdict) - - self.write_virtuals() - - def write_function_wrapper(self, function_obj, template, - handle_return=0, is_method=0, kwargs_needed=0, - substdict=None): - '''This function is the guts of all functions that generate - wrappers for functions, methods and constructors.''' - if not substdict: substdict = {} - - info = argtypes.WrapperInfo() - - substdict.setdefault('errorreturn', 'NULL') - - # for methods, we want the leading comma - if is_method: - info.arglist.append('') - - if function_obj.varargs: - raise ValueError, "varargs functions not supported" - - for param in function_obj.params: - if param.pdflt and '|' not in info.parsestr: - info.add_parselist('|', [], []) - handler = argtypes.matcher.get(param.ptype) - handler.write_param(param.ptype, param.pname, param.pdflt, - param.pnull, param.keeprefcount, info) - - substdict['setreturn'] = '' - if handle_return: - if function_obj.ret not in ('none', None): - substdict['setreturn'] = 'ret = ' - handler = argtypes.matcher.get(function_obj.ret) - handler.write_return(function_obj.ret, - function_obj.caller_owns_return, info) - - if function_obj.deprecated != None: - deprecated = self.deprecated_tmpl % { - 'deprecationmsg': function_obj.deprecated, - 'errorreturn': substdict['errorreturn'] } - else: - deprecated = '' - - # if name isn't set, set it to function_obj.name - substdict.setdefault('name', function_obj.name) - - substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;' - substdict['end_allow_threads'] = 'pyg_end_allow_threads;' - - if self.objinfo: - substdict['typename'] = self.objinfo.c_name - substdict.setdefault('cname', function_obj.c_name) - substdict['varlist'] = info.get_varlist() - substdict['typecodes'] = info.parsestr - substdict['parselist'] = info.get_parselist() - substdict['arglist'] = info.get_arglist() - substdict['codebefore'] = deprecated + ( - string.replace(info.get_codebefore(), - 'return NULL', 'return ' + substdict['errorreturn']) - ) - substdict['codeafter'] = ( - string.replace(info.get_codeafter(), - 'return NULL', - 'return ' + substdict['errorreturn'])) - - if info.parsestr or kwargs_needed: - substdict['parseargs'] = self.parse_tmpl % substdict - substdict['extraparams'] = ', PyObject *args, PyObject *kwargs' - flags = 'METH_VARARGS|METH_KEYWORDS' - - # prepend the keyword list to the variable list - substdict['varlist'] = info.get_kwlist() + substdict['varlist'] - else: - substdict['parseargs'] = '' - substdict['extraparams'] = '' - flags = 'METH_NOARGS' - - return template % substdict, flags - - def write_constructor(self): - initfunc = '0' - constructor = self.parser.find_constructor(self.objinfo,self.overrides) - if not constructor: - return self.write_default_constructor() - - funcname = constructor.c_name - try: - if self.overrides.is_overriden(funcname): - data = self.overrides.override(funcname) - self.write_function(funcname, data) - self.objinfo.has_new_constructor_api = ( - self.objinfo.typecode in - self.overrides.newstyle_constructors) - else: - # ok, a hack to determine if we should use - # new-style constructores :P - property_based = getattr(self, - 'write_property_based_constructor', - None) - if property_based: - if (len(constructor.params) == 0 or - isinstance(constructor.params[0], - definitions.Property)): - # write_property_based_constructor is only - # implemented in GObjectWrapper - return self.write_property_based_constructor( - constructor) - else: - sys.stderr.write( - "Warning: generating old-style constructor for:" + - constructor.c_name + '\n') - - # write constructor from template ... - code = self.write_function_wrapper(constructor, - self.constructor_tmpl, - handle_return=0, is_method=0, kwargs_needed=1, - substdict=self.get_initial_constructor_substdict( - constructor))[0] - self.fp.write(code) - initfunc = '_wrap_' + funcname - except: - sys.stderr.write('Could not write constructor for %s: %s\n' - % (self.objinfo.c_name, exc_info())) - - initfunc = self.write_noconstructor() - return initfunc - - def write_noconstructor(self): - # this is a hack ... - if not hasattr(self.overrides, 'no_constructor_written'): - self.fp.write(self.noconstructor) - self.overrides.no_constructor_written = 1 - initfunc = 'pygobject_no_constructor' - return initfunc - - def write_default_constructor(self): - return self.write_noconstructor() - - def get_methflags(self, funcname): - if self.overrides.wants_kwargs(funcname): - flags = 'METH_VARARGS|METH_KEYWORDS' - elif self.overrides.wants_noargs(funcname): - flags = 'METH_NOARGS' - elif self.overrides.wants_onearg(funcname): - flags = 'METH_O' - else: - flags = 'METH_VARARGS' - if self.overrides.is_staticmethod(funcname): - flags += '|METH_STATIC' - elif self.overrides.is_classmethod(funcname): - flags += '|METH_CLASS' - return flags - - def write_function(self, funcname, data): - lineno, filename = self.overrides.getstartline(funcname) - self.fp.setline(lineno, filename) - self.fp.write(data) - self.fp.resetline() - self.fp.write('\n\n') - - def _get_class_virtual_substdict(self, meth, cname, parent): - substdict = self.get_initial_method_substdict(meth) - substdict['virtual'] = substdict['name'].split('.')[1] - substdict['cname'] = cname - substdict['class_cast_macro'] = parent.typecode.replace( - '_TYPE_', '_', 1) + "_CLASS" - substdict['typecode'] = self.objinfo.typecode - substdict['cast'] = string.replace(parent.typecode, '_TYPE_', '_', 1) - return substdict - - def write_methods(self): - methods = [] - klass = self.objinfo.c_name - # First, get methods from the defs files - for meth in self.parser.find_methods(self.objinfo): - method_name = meth.c_name - if self.overrides.is_ignored(method_name): - continue - try: - if self.overrides.is_overriden(method_name): - if not self.overrides.is_already_included(method_name): - data = self.overrides.override(method_name) - self.write_function(method_name, data) - - methflags = self.get_methflags(method_name) - else: - # write constructor from template ... - code, methflags = self.write_function_wrapper(meth, - self.method_tmpl, handle_return=1, is_method=1, - substdict=self.get_initial_method_substdict(meth)) - self.fp.write(code) - methods.append(self.methdef_tmpl % - { 'name': fixname(meth.name), - 'cname': '_wrap_' + method_name, - 'flags': methflags, - 'docstring': meth.docstring }) - methods_coverage.declare_wrapped() - except: - methods_coverage.declare_not_wrapped() - sys.stderr.write('Could not write method %s.%s: %s\n' - % (klass, meth.name, exc_info())) - - # Now try to see if there are any defined in the override - for method_name in self.overrides.get_defines_for(klass): - c_name = override.class2cname(klass, method_name) - if self.overrides.is_already_included(method_name): - continue - - try: - data = self.overrides.define(klass, method_name) - self.write_function(method_name, data) - methflags = self.get_methflags(method_name) - - methods.append(self.methdef_tmpl % - { 'name': method_name, - 'cname': '_wrap_' + c_name, - 'flags': methflags, - 'docstring': meth.docstring }) - methods_coverage.declare_wrapped() - except: - methods_coverage.declare_not_wrapped() - sys.stderr.write('Could not write method %s.%s: %s\n' - % (klass, meth.name, exc_info())) - - # Add GObject virtual method accessors, for chaining to parent - # virtuals from subclasses - methods += self.write_virtual_accessors() - - if methods: - methoddefs = '_Py%s_methods' % self.objinfo.c_name - # write the PyMethodDef structure - methods.append(' { NULL, NULL, 0, NULL }\n') - self.fp.write('static const PyMethodDef %s[] = {\n' % methoddefs) - self.fp.write(string.join(methods, '')) - self.fp.write('};\n\n') - else: - methoddefs = 'NULL' - return methoddefs - - def write_virtual_accessors(self): - klass = self.objinfo.c_name - methods = [] - for meth in self.parser.find_virtuals(self.objinfo): - method_name = self.objinfo.c_name + "__do_" + meth.name - if self.overrides.is_ignored(method_name): - continue - try: - if self.overrides.is_overriden(method_name): - if not self.overrides.is_already_included(method_name): - data = self.overrides.override(method_name) - self.write_function(method_name, data) - methflags = self.get_methflags(method_name) - else: - # temporarily add a 'self' parameter as first argument - meth.params.insert(0, definitions.Parameter( - ptype=(self.objinfo.c_name + '*'), - pname='self', pdflt=None, pnull=None)) - try: - # write method from template ... - code, methflags = self.write_function_wrapper( - meth, self.virtual_accessor_tmpl, - handle_return=True, is_method=False, - substdict=self._get_class_virtual_substdict( - meth, method_name, self.objinfo)) - self.fp.write(code) - finally: - del meth.params[0] - methods.append(self.methdef_tmpl % - { 'name': "do_" + fixname(meth.name), - 'cname': '_wrap_' + method_name, - 'flags': methflags + '|METH_CLASS', - 'docstring': 'NULL'}) - vaccessors_coverage.declare_wrapped() - except: - vaccessors_coverage.declare_not_wrapped() - sys.stderr.write( - 'Could not write virtual accessor method %s.%s: %s\n' - % (klass, meth.name, exc_info())) - return methods - - def write_virtuals(self): - ''' - Write _wrap_FooBar__proxy_do_zbr() reverse wrapers for - GObject virtuals - ''' - klass = self.objinfo.c_name - virtuals = [] - for meth in self.parser.find_virtuals(self.objinfo): - method_name = self.objinfo.c_name + "__proxy_do_" + meth.name - if self.overrides.is_ignored(method_name): - continue - try: - if self.overrides.is_overriden(method_name): - if not self.overrides.is_already_included(method_name): - data = self.overrides.override(method_name) - self.write_function(method_name, data) - else: - # write virtual proxy ... - ret, props = argtypes.matcher.get_reverse_ret(meth.ret) - wrapper = reversewrapper.ReverseWrapper( - '_wrap_' + method_name, is_static=True) - wrapper.set_return_type(ret(wrapper, **props)) - wrapper.add_parameter(reversewrapper.PyGObjectMethodParam( - wrapper, "self", method_name="do_" + meth.name, - c_type=(klass + ' *'))) - for param in meth.params: - handler, props = argtypes.matcher.get_reverse( - param.ptype) - props["direction"] = param.pdir - wrapper.add_parameter(handler(wrapper, - param.pname, **props)) - buf = reversewrapper.MemoryCodeSink() - wrapper.generate(buf) - self.fp.write(buf.flush()) - virtuals.append((fixname(meth.name), '_wrap_' + method_name)) - vproxies_coverage.declare_wrapped() - except (KeyError, ValueError): - vproxies_coverage.declare_not_wrapped() - virtuals.append((fixname(meth.name), None)) - sys.stderr.write('Could not write virtual proxy %s.%s: %s\n' - % (klass, meth.name, exc_info())) - if virtuals: - # Write a 'pygtk class init' function for this object, - # except when the object type is explicitly ignored (like - # GtkPlug and GtkSocket on win32). - if self.overrides.is_ignored(self.objinfo.typecode): - return - class_cast_macro = self.objinfo.typecode.replace( - '_TYPE_', '_', 1) + "_CLASS" - cast_macro = self.objinfo.typecode.replace('_TYPE_', '_', 1) - funcname = "__%s_class_init" % klass - self.objinfo.class_init_func = funcname - have_implemented_virtuals = not not [True - for name, cname in virtuals - if cname is not None] - self.fp.write( - ('\nstatic int\n' - '%(funcname)s(gpointer gclass, PyTypeObject *pyclass)\n' - '{\n') % vars()) - - if have_implemented_virtuals: - self.fp.write(' PyObject *o;\n') - self.fp.write( - ' %(klass)sClass *klass = ' - '%(class_cast_macro)s(gclass);\n' - ' PyObject *gsignals = ' - 'PyDict_GetItemString(pyclass->tp_dict, "__gsignals__");\n' - % vars()) - - for name, cname in virtuals: - do_name = 'do_' + name - if cname is None: - self.fp.write('\n /* overriding %(do_name)s ' - 'is currently not supported */\n' % vars()) - else: - self.fp.write(''' - o = PyObject_GetAttrString((PyObject *) pyclass, "%(do_name)s"); - if (o == NULL) - PyErr_Clear(); - else { - if (!PyObject_TypeCheck(o, &PyCFunction_Type) - && !(gsignals && PyDict_GetItemString(gsignals, "%(name)s"))) - klass->%(name)s = %(cname)s; - Py_DECREF(o); - } -''' % vars()) - self.fp.write(' return 0;\n}\n') - - def write_getsets(self): - lower_name = self.get_lower_name() - getsets_name = lower_name + '_getsets' - getterprefix = '_wrap_' + lower_name + '__get_' - setterprefix = '_wrap_' + lower_name + '__set_' - - # no overrides for the whole function. If no fields, - # don't write a func - if not self.objinfo.fields: - return '0' - getsets = [] - for ftype, cfname in self.objinfo.fields: - fname = cfname.replace('.', '_') - gettername = '0' - settername = '0' - attrname = self.objinfo.c_name + '.' + fname - if self.overrides.attr_is_overriden(attrname): - code = self.overrides.attr_override(attrname) - self.write_function(attrname, code) - if string.find(code, getterprefix + fname) >= 0: - gettername = getterprefix + fname - if string.find(code, setterprefix + fname) >= 0: - settername = setterprefix + fname - if gettername == '0': - try: - funcname = getterprefix + fname - info = argtypes.WrapperInfo() - handler = argtypes.matcher.get(ftype) - # for attributes, we don't own the "return value" - handler.write_return(ftype, 0, info) - self.fp.write(self.getter_tmpl % - { 'funcname': funcname, - 'varlist': info.varlist, - 'field': self.get_field_accessor(cfname), - 'codeafter': info.get_codeafter() }) - gettername = funcname - except: - sys.stderr.write( - "Could not write getter for %s.%s: %s\n" - % (self.objinfo.c_name, fname, exc_info())) - if gettername != '0' or settername != '0': - getsets.append(' { "%s", (getter)%s, (setter)%s },\n' % - (fixname(fname), gettername, settername)) - - if not getsets: - return '0' - self.fp.write('static const PyGetSetDef %s[] = {\n' % getsets_name) - for getset in getsets: - self.fp.write(getset) - self.fp.write(' { NULL, (getter)0, (setter)0 },\n') - self.fp.write('};\n\n') - - return getsets_name - - def write_functions(self, prefix): - self.fp.write('\n/* ----------- functions ----------- */\n\n') - functions = [] - - # First, get methods from the defs files - for func in self.parser.find_functions(): - funcname = func.c_name - if self.overrides.is_ignored(funcname) or \ - self.overrides.is_type_ignored(func.ret): - continue - try: - if self.overrides.is_overriden(funcname): - data = self.overrides.override(funcname) - self.write_function(funcname, data) - - methflags = self.get_methflags(funcname) - else: - # write constructor from template ... - code, methflags = self.write_function_wrapper(func, - self.function_tmpl, handle_return=1, is_method=0) - self.fp.write(code) - functions.append(self.methdef_tmpl % - { 'name': func.name, - 'cname': '_wrap_' + funcname, - 'flags': methflags, - 'docstring': func.docstring }) - functions_coverage.declare_wrapped() - except: - functions_coverage.declare_not_wrapped() - sys.stderr.write('Could not write function %s: %s\n' - % (func.name, exc_info())) - - # Now try to see if there are any defined in the override - for funcname in self.overrides.get_functions(): - try: - data = self.overrides.function(funcname) - self.write_function(funcname, data) - methflags = self.get_methflags(funcname) - functions.append(self.methdef_tmpl % - { 'name': funcname, - 'cname': '_wrap_' + funcname, - 'flags': methflags, - 'docstring': 'NULL'}) - functions_coverage.declare_wrapped() - except: - functions_coverage.declare_not_wrapped() - sys.stderr.write('Could not write function %s: %s\n' - % (funcname, exc_info())) - - # write the PyMethodDef structure - functions.append(' { NULL, NULL, 0, NULL }\n') - - self.fp.write('const PyMethodDef ' + prefix + '_functions[] = {\n') - self.fp.write(string.join(functions, '')) - self.fp.write('};\n\n') - -class GObjectWrapper(Wrapper): - constructor_tmpl = ( - 'static int\n' - '_wrap_%(cname)s(PyGObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' self->obj = (GObject *)%(cname)s(%(arglist)s);\n' - '%(codeafter)s\n' - ' if (!self->obj) {\n' - ' PyErr_SetString(PyExc_RuntimeError, ' - '"could not create %(typename)s object");\n' - ' return -1;\n' - ' }\n' - '%(aftercreate)s' - ' pygobject_register_wrapper((PyObject *)self);\n' - ' return 0;\n' - '}\n\n' - ) - - method_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyGObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' %(begin_allow_threads)s\n' - ' %(setreturn)s%(cname)s(%(cast)s(self->obj)%(arglist)s);\n' - ' %(end_allow_threads)s\n' - '%(codeafter)s\n' - '}\n\n' - ) - def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): - Wrapper.__init__(self, parser, objinfo, overrides, fp) - if self.objinfo: - self.castmacro = string.replace(self.objinfo.typecode, - '_TYPE_', '_', 1) - - def get_initial_class_substdict(self): - return { 'tp_basicsize' : 'PyGObject', - 'tp_weaklistoffset' : 'offsetof(PyGObject, weakreflist)', - 'tp_dictoffset' : 'offsetof(PyGObject, inst_dict)' } - - def get_field_accessor(self, fieldname): - castmacro = string.replace(self.objinfo.typecode, '_TYPE_', '_', 1) - return '%s(pygobject_get(self))->%s' % (castmacro, fieldname) - - def get_initial_constructor_substdict(self, constructor): - substdict = Wrapper.get_initial_constructor_substdict(self, - constructor) - if not constructor.caller_owns_return: - substdict['aftercreate'] = " g_object_ref(self->obj);\n" - else: - substdict['aftercreate'] = '' - return substdict - - def get_initial_method_substdict(self, method): - substdict = Wrapper.get_initial_method_substdict(self, method) - substdict['cast'] = string.replace(self.objinfo.typecode, - '_TYPE_', '_', 1) - return substdict - - def write_default_constructor(self): - try: - parent = self.parser.find_object(self.objinfo.parent) - except ValueError: - parent = None - if parent is not None: - ## just like the constructor is inheritted, we should - # inherit the new API compatibility flag - self.objinfo.has_new_constructor_api = ( - parent.has_new_constructor_api) - elif self.objinfo.parent == 'GObject': - self.objinfo.has_new_constructor_api = True - return '0' - - def write_property_based_constructor(self, constructor): - self.objinfo.has_new_constructor_api = True - out = self.fp - print >> out, "static int" - print >> out, '_wrap_%s(PyGObject *self, PyObject *args,' \ - ' PyObject *kwargs)\n{' % constructor.c_name - if constructor.params: - s = " GType obj_type = pyg_type_from_object((PyObject *) self);" - print >> out, s - - def py_str_list_to_c(arg): - if arg: - return "{" + ", ".join( - map(lambda s: '"' + s + '"', arg)) + ", NULL }" - else: - return "{ NULL }" - - classname = '%s.%s' % (self.overrides.modulename, - self.objinfo.name) - - if constructor.params: - mandatory_arguments = [param for param in constructor.params - if not param.optional] - optional_arguments = [param for param in constructor.params - if param.optional] - arg_names = py_str_list_to_c( - [param.argname - for param in mandatory_arguments + optional_arguments]) - - prop_names = py_str_list_to_c( - [param.pname - for param in mandatory_arguments + optional_arguments]) - - print >> out, " GParameter params[%i];" % \ - len(constructor.params) - print >> out, " PyObject *parsed_args[%i] = {NULL, };" % \ - len(constructor.params) - print >> out, " char *arg_names[] = %s;" % arg_names - print >> out, " char *prop_names[] = %s;" % prop_names - print >> out, " guint nparams, i;" - print >> out - if constructor.deprecated is not None: - out.write( - ' if (PyErr_Warn(PyExc_DeprecationWarning, ' - '"%s") < 0)\n' % - constructor.deprecated) - print >> out, ' return -1;' - print >> out - out.write(" if (!PyArg_ParseTupleAndKeywords(args, kwargs, ") - template = '"' - if mandatory_arguments: - template += "O"*len(mandatory_arguments) - if optional_arguments: - template += "|" + "O"*len(optional_arguments) - template += ':%s.__init__"' % classname - print >> out, template, ", arg_names", - for i in range(len(constructor.params)): - print >> out, ", &parsed_args[%i]" % i, - - out.write( - "))\n" - " return -1;\n" - "\n" - " memset(params, 0, sizeof(GParameter)*%i);\n" - " if (!pyg_parse_constructor_args(obj_type, arg_names,\n" - " prop_names, params, \n" - " &nparams, parsed_args))\n" - " return -1;\n" - " pygobject_constructv(self, nparams, params);\n" - " for (i = 0; i < nparams; ++i)\n" - " g_value_unset(¶ms[i].value);\n" - % len(constructor.params)) - else: - out.write( - " static char* kwlist[] = { NULL };\n" - "\n") - - if constructor.deprecated is not None: - out.write( - ' if (PyErr_Warn(PyExc_DeprecationWarning, "%s") < 0)\n' - ' return -1;\n' - '\n' % constructor.deprecated) - - out.write( - ' if (!PyArg_ParseTupleAndKeywords(args, kwargs,\n' - ' ":%s.__init__",\n' - ' kwlist))\n' - ' return -1;\n' - '\n' - ' pygobject_constructv(self, 0, NULL);\n' % classname) - out.write( - ' if (!self->obj) {\n' - ' PyErr_SetString(\n' - ' PyExc_RuntimeError, \n' - ' "could not create %s object");\n' - ' return -1;\n' - ' }\n' % classname) - - if not constructor.caller_owns_return: - print >> out, " g_object_ref(self->obj);\n" - - out.write( - ' return 0;\n' - '}\n\n') - - return "_wrap_%s" % constructor.c_name - - -## TODO : Add GstMiniObjectWrapper(Wrapper) -class GstMiniObjectWrapper(Wrapper): - constructor_tmpl = ( - 'static int\n' - '_wrap_%(cname)s(PyGstMiniObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' self->obj = (GstMiniObject *)%(cname)s(%(arglist)s);\n' - '%(codeafter)s\n' - ' if (!self->obj) {\n' - ' PyErr_SetString(PyExc_RuntimeError, ' - '"could not create %(typename)s miniobject");\n' - ' return -1;\n' - ' }\n' - '%(aftercreate)s' - ' pygstminiobject_register_wrapper((PyObject *)self);\n' - ' return 0;\n' - '}\n\n' - ) - method_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyGstMiniObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' %(begin_allow_threads)s\n' - ' %(setreturn)s%(cname)s(%(cast)s(self->obj)%(arglist)s);\n' - ' %(end_allow_threads)s\n' - '%(codeafter)s\n' - '}\n\n' - ) - def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): - Wrapper.__init__(self, parser, objinfo, overrides, fp) - if self.objinfo: - self.castmacro = string.replace(self.objinfo.typecode, - '_TYPE_', '_', 1) - - def get_initial_class_substdict(self): - return { 'tp_basicsize' : 'PyGstMiniObject', - 'tp_weaklistoffset' : 'offsetof(PyGstMiniObject, weakreflist)', - 'tp_dictoffset' : 'offsetof(PyGstMiniObject, inst_dict)' } - - def get_field_accessor(self, fieldname): - castmacro = string.replace(self.objinfo.typecode, '_TYPE_', '_', 1) - return '%s(pygstminiobject_get(self))->%s' % (castmacro, fieldname) - - def get_initial_constructor_substdict(self, constructor): - substdict = Wrapper.get_initial_constructor_substdict(self, - constructor) - if not constructor.caller_owns_return: - substdict['aftercreate'] = " gst_mini_object_ref(self->obj);\n" - else: - substdict['aftercreate'] = '' - return substdict - - def get_initial_method_substdict(self, method): - substdict = Wrapper.get_initial_method_substdict(self, method) - substdict['cast'] = string.replace(self.objinfo.typecode, - '_TYPE_', '_', 1) - return substdict - - - -class GInterfaceWrapper(GObjectWrapper): - virtual_accessor_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *cls%(extraparams)s)\n' - '{\n' - ' %(vtable)s *iface;\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' iface = g_type_interface_peek(' - 'g_type_class_peek(pyg_type_from_object(cls)), %(typecode)s);\n' - ' if (iface->%(virtual)s)\n' - ' %(setreturn)siface->%(virtual)s(%(arglist)s);\n' - ' else {\n' - ' PyErr_SetString(PyExc_NotImplementedError, ' - '"interface method %(name)s not implemented");\n' - ' return NULL;\n' - ' }\n' - '%(codeafter)s\n' - '}\n\n' - ) - - def get_initial_class_substdict(self): - return { 'tp_basicsize' : 'PyObject', - 'tp_weaklistoffset' : '0', - 'tp_dictoffset' : '0'} - - def write_constructor(self): - # interfaces have no constructors ... - return '0' - def write_getsets(self): - # interfaces have no fields ... - return '0' - - def _get_class_virtual_substdict(self, meth, cname, parent): - substdict = self.get_initial_method_substdict(meth) - substdict['virtual'] = substdict['name'].split('.')[1] - substdict['cname'] = cname - substdict['typecode'] = self.objinfo.typecode - substdict['vtable'] = self.objinfo.vtable - return substdict - - def write_virtuals(self): - ## Now write reverse method wrappers, which let python code - ## implement interface methods. - # First, get methods from the defs files - klass = self.objinfo.c_name - proxies = [] - for meth in self.parser.find_virtuals(self.objinfo): - method_name = self.objinfo.c_name + "__proxy_do_" + meth.name - if self.overrides.is_ignored(method_name): - continue - try: - if self.overrides.is_overriden(method_name): - if not self.overrides.is_already_included(method_name): - data = self.overrides.override(method_name) - self.write_function(method_name, data) - else: - # write proxy ... - ret, props = argtypes.matcher.get_reverse_ret(meth.ret) - wrapper = reversewrapper.ReverseWrapper( - '_wrap_' + method_name, is_static=True) - wrapper.set_return_type(ret(wrapper, **props)) - wrapper.add_parameter(reversewrapper.PyGObjectMethodParam( - wrapper, "self", method_name="do_" + meth.name, - c_type=(klass + ' *'))) - for param in meth.params: - handler, props = argtypes.matcher.get_reverse( - param.ptype) - props["direction"] = param.pdir - wrapper.add_parameter( - handler(wrapper, param.pname, **props)) - buf = reversewrapper.MemoryCodeSink() - wrapper.generate(buf) - self.fp.write(buf.flush()) - proxies.append((fixname(meth.name), '_wrap_' + method_name)) - iproxies_coverage.declare_wrapped() - except (KeyError, ValueError): - iproxies_coverage.declare_not_wrapped() - proxies.append((fixname(meth.name), None)) - sys.stderr.write('Could not write interface proxy %s.%s: %s\n' - % (klass, meth.name, exc_info())) - - if not proxies: - return - - # Make sure we have at least one proxy function - if not [cname for name,cname in proxies if not cname is None]: - return - - ## Write an interface init function for this object - funcname = "__%s__interface_init" % klass - vtable = self.objinfo.vtable - self.fp.write( - '\nstatic void\n' - '%(funcname)s(%(vtable)s *iface, PyTypeObject *pytype)\n' - '{\n' - ' %(vtable)s *parent_iface = ' - 'g_type_interface_peek_parent(iface);\n' - ' PyObject *py_method;\n' - '\n' - % vars()) - - for name, cname in proxies: - do_name = 'do_' + name - if cname is None: - continue - - self.fp.write(( - ' py_method = pytype? PyObject_GetAttrString(' - '(PyObject *) pytype, "%(do_name)s") : NULL;\n' - ' if (py_method && !PyObject_TypeCheck(py_method, ' - '&PyCFunction_Type)) {\n' - ' iface->%(name)s = %(cname)s;\n' - ' } else {\n' - ' PyErr_Clear();\n' - ' if (parent_iface) {\n' - ' iface->%(name)s = parent_iface->%(name)s;\n' - ' }\n' - ' Py_XDECREF(py_method);\n' - ' }\n' - ) % vars()) - self.fp.write('}\n\n') - interface_info = "__%s__iinfo" % klass - self.fp.write(''' -static const GInterfaceInfo %s = { - (GInterfaceInitFunc) %s, - NULL, - NULL -}; -''' % (interface_info, funcname)) - self.objinfo.interface_info = interface_info - -class GBoxedWrapper(Wrapper): - constructor_tmpl = ( - 'static int\n' - '_wrap_%(cname)s(PyGBoxed *self%(extraparams)s)\n' - '{\n' \ - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' self->gtype = %(typecode)s;\n' - ' self->free_on_dealloc = FALSE;\n' - ' self->boxed = %(cname)s(%(arglist)s);\n' - '%(codeafter)s\n' - ' if (!self->boxed) {\n' - ' PyErr_SetString(PyExc_RuntimeError, ' - '"could not create %(typename)s object");\n' - ' return -1;\n' - ' }\n' - ' self->free_on_dealloc = TRUE;\n' - ' return 0;\n' - '}\n\n' - ) - - method_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' %(begin_allow_threads)s\n' - ' %(setreturn)s%(cname)s(pyg_boxed_get(self, ' - '%(typename)s)%(arglist)s);\n' - ' %(end_allow_threads)s\n' - '%(codeafter)s\n' - '}\n\n' - ) - - def get_initial_class_substdict(self): - return { 'tp_basicsize' : 'PyGBoxed', - 'tp_weaklistoffset' : '0', - 'tp_dictoffset' : '0' } - - def get_field_accessor(self, fieldname): - return 'pyg_boxed_get(self, %s)->%s' % (self.objinfo.c_name, fieldname) - - def get_initial_constructor_substdict(self, constructor): - substdict = Wrapper.get_initial_constructor_substdict( - self, constructor) - substdict['typecode'] = self.objinfo.typecode - return substdict - -class GPointerWrapper(GBoxedWrapper): - constructor_tmpl = ( - 'static int\n' - '_wrap_%(cname)s(PyGPointer *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' self->gtype = %(typecode)s;\n' - ' self->pointer = %(cname)s(%(arglist)s);\n' - '%(codeafter)s\n' - ' if (!self->pointer) {\n' - ' PyErr_SetString(PyExc_RuntimeError, ' - '"could not create %(typename)s object");\n' - ' return -1;\n' - ' }\n' - ' return 0;\n' - '}\n\n' - ) - - method_tmpl = ( - 'static PyObject *\n' - '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' - '{\n' - '%(varlist)s' - '%(parseargs)s' - '%(codebefore)s' - ' %(setreturn)s%(cname)s(pyg_pointer_get(self, ' - '%(typename)s)%(arglist)s);\n' - '%(codeafter)s\n' - '}\n\n' - ) - - def get_initial_class_substdict(self): - return { 'tp_basicsize' : 'PyGPointer', - 'tp_weaklistoffset' : '0', - 'tp_dictoffset' : '0' } - - def get_field_accessor(self, fieldname): - return 'pyg_pointer_get(self, %s)->%s' % (self.objinfo.c_name, - fieldname) - - def get_initial_constructor_substdict(self, constructor): - substdict = Wrapper.get_initial_constructor_substdict( - self, constructor) - substdict['typecode'] = self.objinfo.typecode - return substdict - -def write_headers(data, fp): - fp.write('/* -- THIS FILE IS GENERATED - DO NOT EDIT */') - fp.write('/* -*- Mode: C; c-basic-offset: 4 -*- */\n\n') - fp.write('#include \n\n\n') - fp.write(data) - fp.resetline() - fp.write('\n\n') - -def write_body(data, fp): - fp.write(data) - fp.resetline() - fp.write('\n\n') - -def write_imports(overrides, fp): - fp.write('/* ---------- types from other modules ---------- */\n') - for module, pyname, cname in overrides.get_imports(): - fp.write('static PyTypeObject *_%s;\n' % cname) - fp.write('#define %s (*_%s)\n' % (cname, cname)) - fp.write('\n\n') - -def write_type_declarations(parser, fp): - fp.write('/* ---------- forward type declarations ---------- */\n') - for obj in parser.boxes: - fp.write('PyTypeObject Py' + obj.c_name + '_Type;\n') - for obj in parser.objects: - fp.write('PyTypeObject Py' + obj.c_name + '_Type;\n') - for obj in parser.miniobjects: - fp.write('PyTypeObject Py' + obj.c_name + '_Type;\n') - for interface in parser.interfaces: - fp.write('PyTypeObject Py' + interface.c_name + '_Type;\n') - fp.write('\n') - - -def sort_parent_children(objects): - objects = list(objects) - modified = True - while modified: - modified = False - parent_index = None - child_index = None - for i, obj in enumerate(objects): - if obj.parent == 'GObject': - continue - if obj.parent not in [info.c_name for info in objects[:i]]: - for j, info in enumerate(objects[i+1:]): - if info.c_name == obj.parent: - parent_index = i + 1 + j - child_index = i - break - else: - continue - break - if child_index is not None and parent_index is not None: - if child_index != parent_index: - objects.insert(child_index, objects.pop(parent_index)) - modified = True - return objects - -def write_classes(parser, overrides, fp): - ## Sort the objects, so that we generate code for the parent types - ## before their children. - objects = sort_parent_children(parser.objects) - for klass, items in ((GBoxedWrapper, parser.boxes), - (GPointerWrapper, parser.pointers), - (GObjectWrapper, objects), - (GstMiniObjectWrapper, parser.miniobjects), - (GInterfaceWrapper, parser.interfaces)): - for item in items: - instance = klass(parser, item, overrides, fp) - instance.write_class() - fp.write('\n') - -def write_enums(parser, overrides, prefix, fp=sys.stdout): - if not parser.enums: - return - fp.write('\n/* ----------- enums and flags ----------- */\n\n') - fp.write( - 'void\n' + prefix + - '_add_constants(PyObject *module, const gchar *strip_prefix)\n{\n') - - for enum in parser.enums: - if overrides.is_type_ignored(enum.c_name): - continue - if enum.typecode is None: - for nick, value in enum.values: - if overrides.is_ignored(value): - continue - fp.write( - ' PyModule_AddIntConstant(module, ' - '(char *) pyg_constant_strip_prefix("%s", strip_prefix), %s);\n' - % (value, value)) - else: - if enum.deftype == 'enum': - fp.write(' pyg_enum_add(module, "%s", strip_prefix, %s);\n' - % (enum.name, enum.typecode)) - else: - fp.write(' pyg_flags_add(module, "%s", strip_prefix, %s);\n' - % (enum.name, enum.typecode)) - - fp.write('\n') - fp.write(' if (PyErr_Occurred())\n') - fp.write(' PyErr_Print();\n') - fp.write('}\n\n') - -def write_extension_init(overrides, prefix, fp): - fp.write('/* initialise stuff extension classes */\n') - fp.write('void\n' + prefix + '_register_classes(PyObject *d)\n{\n') - imports = overrides.get_imports()[:] - if imports: - bymod = {} - for module, pyname, cname in imports: - bymod.setdefault(module, []).append((pyname, cname)) - fp.write(' PyObject *module;\n\n') - for module in bymod: - fp.write( - ' if ((module = PyImport_ImportModule("%s")) != NULL) {\n' - % module) - fp.write( - ' PyObject *moddict = PyModule_GetDict(module);\n\n') - for pyname, cname in bymod[module]: - fp.write( - ' _%s = (PyTypeObject *)PyDict_GetItemString(' - 'moddict, "%s");\n' % (cname, pyname)) - fp.write(' if (_%s == NULL) {\n' % cname) - fp.write(' PyErr_SetString(PyExc_ImportError,\n') - fp.write(' "cannot import name %s from %s");\n' - % (pyname, module)) - fp.write(' return;\n') - fp.write(' }\n') - fp.write(' } else {\n') - fp.write(' PyErr_SetString(PyExc_ImportError,\n') - fp.write(' "could not import %s");\n' % module) - fp.write(' return;\n') - fp.write(' }\n') - fp.write('\n') - fp.write(overrides.get_init() + '\n') - fp.resetline() - -def write_registers(parser, overrides, fp): - for boxed in parser.boxes: - if overrides.is_type_ignored(boxed.c_name): - continue - fp.write(' pyg_register_boxed(d, "' + boxed.name + - '", ' + boxed.typecode + - ', &Py' + boxed.c_name + - '_Type);\n') - for pointer in parser.pointers: - if overrides.is_type_ignored(pointer.c_name): - continue - fp.write(' pyg_register_pointer(d, "' + pointer.name + - '", ' + pointer.typecode + - ', &Py' + pointer.c_name + '_Type);\n') - for interface in parser.interfaces: - if overrides.is_type_ignored(interface.c_name): - continue - fp.write(' pyg_register_interface(d, "' + interface.name + - '", '+ interface.typecode + ', &Py' + interface.c_name + - '_Type);\n') - if interface.interface_info is not None: - fp.write(' pyg_register_interface_info(%s, &%s);\n' % - (interface.typecode, interface.interface_info)) - - objects = parser.objects[:] - pos = 0 - while pos < len(objects): - parent = objects[pos].parent - for i in range(pos+1, len(objects)): - if objects[i].c_name == parent: - objects.insert(i+1, objects[pos]) - del objects[pos] - break - else: - pos = pos + 1 - for obj in objects: - if overrides.is_type_ignored(obj.c_name): - continue - bases = [] - if obj.parent != None: - bases.append(obj.parent) - bases = bases + obj.implements - if bases: - fp.write(' pygobject_register_class(d, "' + obj.c_name + - '", ' + obj.typecode + ', &Py' + obj.c_name + - '_Type, Py_BuildValue("(' + 'O' * len(bases) + ')", ' + - string.join(map(lambda s: '&Py'+s+'_Type', bases), ', ') + - '));\n') - else: - fp.write(' pygobject_register_class(d, "' + obj.c_name + - '", ' + obj.typecode + ', &Py' + obj.c_name + - '_Type, NULL);\n') - if obj.has_new_constructor_api: - fp.write(' pyg_set_object_has_new_constructor(%s);\n' % - obj.typecode) - else: - print >> sys.stderr, ( - "Warning: Constructor for %s needs to be updated to new API\n" - " See http://live.gnome.org/PyGTK_2fWhatsNew28" - "#update-constructors") % obj.c_name - if obj.class_init_func is not None: - fp.write(' pyg_register_class_init(%s, %s);\n' % - (obj.typecode, obj.class_init_func)) - #TODO: register mini-objects - miniobjects = parser.miniobjects[:] - for obj in miniobjects: - if overrides.is_type_ignored(obj.c_name): - continue - bases = [] - if obj.parent != None: - bases.append(obj.parent) - bases = bases + obj.implements - if bases: - fp.write(' pygstminiobject_register_class(d, "' + obj.c_name + - '", ' + obj.typecode + ', &Py' + obj.c_name + - '_Type, Py_BuildValue("(' + 'O' * len(bases) + ')", ' + - string.join(map(lambda s: '&Py'+s+'_Type', bases), ', ') + - '));\n') - else: - fp.write(' pygstminiobject_register_class(d, "' + obj.c_name + - '", ' + obj.typecode + ', &Py' + obj.c_name + - '_Type, NULL);\n') - - fp.write('}\n') - -def write_source(parser, overrides, prefix, fp=FileOutput(sys.stdout)): - write_headers(overrides.get_headers(), fp) - write_imports(overrides, fp) - write_type_declarations(parser, fp) - write_body(overrides.get_body(), fp) - write_classes(parser, overrides, fp) - - wrapper = Wrapper(parser, None, overrides, fp) - wrapper.write_functions(prefix) - - write_enums(parser, overrides, prefix, fp) - write_extension_init(overrides, prefix, fp) - write_registers(parser, overrides, fp) - -def register_types(parser): - for boxed in parser.boxes: - argtypes.matcher.register_boxed(boxed.c_name, boxed.typecode) - for pointer in parser.pointers: - argtypes.matcher.register_pointer(pointer.c_name, pointer.typecode) - for obj in parser.objects: - argtypes.matcher.register_object(obj.c_name, obj.parent, obj.typecode) - for obj in parser.miniobjects: - argtypes.matcher.register_miniobject(obj.c_name, obj.parent, obj.typecode) - for obj in parser.interfaces: - argtypes.matcher.register_object(obj.c_name, None, obj.typecode) - for enum in parser.enums: - if enum.deftype == 'flags': - argtypes.matcher.register_flag(enum.c_name, enum.typecode) - else: - argtypes.matcher.register_enum(enum.c_name, enum.typecode) - -usage = 'usage: codegen.py [-o overridesfile] [-p prefix] defsfile' -def main(argv): - o = override.Overrides() - prefix = 'pygtk' - outfilename = None - errorfilename = None - extendpath = [] - opts, args = getopt.getopt(argv[1:], "o:p:r:t:D:x", - ["override=", "prefix=", "register=", "outfilename=", - "load-types=", "errorfilename=", "extendpath="]) - defines = {} # -Dkey[=val] options - - for opt, arg in opts: - if opt in ('-x', '--extendpath'): - extendpath.append(arg) - extendpath.insert(0, os.getcwd()) - o = override.Overrides(path=extendpath) - - for opt, arg in opts: - if opt in ('-o', '--override'): - o = override.Overrides(arg, path=extendpath) - elif opt in ('-p', '--prefix'): - prefix = arg - elif opt in ('-r', '--register'): - # Warning: user has to make sure all -D options appear before -r - p = defsparser.DefsParser(arg, defines) - p.startParsing() - register_types(p) - del p - elif opt == '--outfilename': - outfilename = arg - elif opt == '--errorfilename': - errorfilename = arg - elif opt in ('-t', '--load-types'): - globals = {} - execfile(arg, globals) - elif opt == '-D': - nameval = arg.split('=') - try: - defines[nameval[0]] = nameval[1] - except IndexError: - defines[nameval[0]] = None - if len(args) < 1: - print >> sys.stderr, usage - return 1 - if errorfilename: - sys.stderr = open(errorfilename, "w") - p = defsparser.DefsParser(args[0], defines) - if not outfilename: - outfilename = os.path.splitext(args[0])[0] + '.c' - - p.startParsing() - - register_types(p) - write_source(p, o, prefix, FileOutput(sys.stdout, outfilename)) - - functions_coverage.printstats() - methods_coverage.printstats() - vproxies_coverage.printstats() - vaccessors_coverage.printstats() - iproxies_coverage.printstats() - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/codegen/definitions.py b/codegen/definitions.py deleted file mode 100644 index 911c8ddb4b..0000000000 --- a/codegen/definitions.py +++ /dev/null @@ -1,607 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -import copy -import sys - -def get_valid_scheme_definitions(defs): - return [x for x in defs if isinstance(x, tuple) and len(x) >= 2] - -def unescape(s): - s = s.replace('\r\n', '\\r\\n').replace('\t', '\\t') - return s.replace('\r', '\\r').replace('\n', '\\n') - -def make_docstring(lines): - return "(char *) " + '\n'.join(['"%s"' % unescape(s) for s in lines]) - -# New Parameter class, wich emulates a tuple for compatibility reasons -class Parameter(object): - def __init__(self, ptype, pname, pdflt, pnull, pdir=None, keeprefcount = False): - self.ptype = ptype - self.pname = pname - self.pdflt = pdflt - self.pnull = pnull - self.pdir = pdir - self.keeprefcount = keeprefcount - - def __len__(self): return 4 - def __getitem__(self, i): - return (self.ptype, self.pname, self.pdflt, self.pnull)[i] - - def merge(self, old): - if old.pdflt is not None: - self.pdflt = old.pdflt - if old.pnull is not None: - self.pnull = old.pnull - -# Parameter for property based constructors -class Property(object): - def __init__(self, pname, optional, argname): - self.pname = pname - self.optional = optional - self.argname = argname - - def merge(self, old): - if old.optional is not None: - self.optional = old.optional - if old.argname is not None: - self.argname = old.argname - - -class Definition: - docstring = "NULL" - def __init__(self, *args): - """Create a new defs object of this type. The arguments are the - components of the definition""" - raise RuntimeError, "this is an abstract class" - def merge(self, old): - """Merge in customisations from older version of definition""" - raise RuntimeError, "this is an abstract class" - def write_defs(self, fp=sys.stdout): - """write out this definition in defs file format""" - raise RuntimeError, "this is an abstract class" - - def guess_return_value_ownership(self): - "return 1 if caller owns return value" - if getattr(self, 'is_constructor_of', False): - self.caller_owns_return = True - elif self.ret in ('char*', 'gchar*', 'string'): - self.caller_owns_return = True - else: - self.caller_owns_return = False - - -class ObjectDef(Definition): - def __init__(self, name, *args): - self.name = name - self.module = None - self.parent = None - self.c_name = None - self.typecode = None - self.fields = [] - self.implements = [] - self.class_init_func = None - self.has_new_constructor_api = False - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.module = arg[1] - elif arg[0] == 'docstring': - self.docstring = make_docstring(arg[1:]) - elif arg[0] == 'parent': - self.parent = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'fields': - for parg in arg[1:]: - self.fields.append((parg[0], parg[1])) - elif arg[0] == 'implements': - self.implements.append(arg[1]) - def merge(self, old): - # currently the .h parser doesn't try to work out what fields of - # an object structure should be public, so we just copy the list - # from the old version ... - self.fields = old.fields - self.implements = old.implements - def write_defs(self, fp=sys.stdout): - fp.write('(define-object ' + self.name + '\n') - if self.module: - fp.write(' (in-module "' + self.module + '")\n') - if self.parent != (None, None): - fp.write(' (parent "' + self.parent + '")\n') - for interface in self.implements: - fp.write(' (implements "' + interface + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.fields: - fp.write(' (fields\n') - for (ftype, fname) in self.fields: - fp.write(' \'("' + ftype + '" "' + fname + '")\n') - fp.write(' )\n') - fp.write(')\n\n') - -class MiniObjectDef(Definition): - def __init__(self, name, *args): - self.name = name - self.module = None - self.parent = None - self.c_name = None - self.typecode = None - self.fields = [] - self.implements = [] - for arg in args: - if type(arg) != type(()) or len(arg) < 2: - continue - if arg[0] == 'in-module': - self.module = arg[1] - elif arg[0] == 'parent': - self.parent = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'fields': - for parg in arg[1:]: - self.fields.append((parg[0], parg[1])) - elif arg[0] == 'implements': - self.implements.append(arg[1]) - def merge(self, old): - # currently the .h parser doesn't try to work out what fields of - # an object structure should be public, so we just copy the list - # from the old version ... - self.fields = old.fields - self.implements = old.implements - def write_defs(self, fp=sys.stdout): - fp.write('(define-object ' + self.name + '\n') - if self.module: - fp.write(' (in-module "' + self.module + '")\n') - if self.parent != (None, None): - fp.write(' (parent "' + self.parent + '")\n') - for interface in self.implements: - fp.write(' (implements "' + interface + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.fields: - fp.write(' (fields\n') - for (ftype, fname) in self.fields: - fp.write(' \'("' + ftype + '" "' + fname + '")\n') - fp.write(' )\n') - fp.write(')\n\n') - - -class InterfaceDef(Definition): - def __init__(self, name, *args): - self.name = name - self.module = None - self.c_name = None - self.typecode = None - self.vtable = None - self.fields = [] - self.interface_info = None - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.module = arg[1] - elif arg[0] == 'docstring': - self.docstring = make_docstring(arg[1:]) - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'vtable': - self.vtable = arg[1] - if self.vtable is None: - self.vtable = self.c_name + "Iface" - def write_defs(self, fp=sys.stdout): - fp.write('(define-interface ' + self.name + '\n') - if self.module: - fp.write(' (in-module "' + self.module + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - fp.write(')\n\n') - -class EnumDef(Definition): - def __init__(self, name, *args): - self.deftype = 'enum' - self.name = name - self.in_module = None - self.c_name = None - self.typecode = None - self.values = [] - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.in_module = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'values': - for varg in arg[1:]: - self.values.append((varg[0], varg[1])) - def merge(self, old): - pass - def write_defs(self, fp=sys.stdout): - fp.write('(define-' + self.deftype + ' ' + self.name + '\n') - if self.in_module: - fp.write(' (in-module "' + self.in_module + '")\n') - fp.write(' (c-name "' + self.c_name + '")\n') - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.values: - fp.write(' (values\n') - for name, val in self.values: - fp.write(' \'("' + name + '" "' + val + '")\n') - fp.write(' )\n') - fp.write(')\n\n') - -class FlagsDef(EnumDef): - def __init__(self, *args): - apply(EnumDef.__init__, (self,) + args) - self.deftype = 'flags' - -class BoxedDef(Definition): - def __init__(self, name, *args): - self.name = name - self.module = None - self.c_name = None - self.typecode = None - self.copy = None - self.release = None - self.fields = [] - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.module = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'copy-func': - self.copy = arg[1] - elif arg[0] == 'release-func': - self.release = arg[1] - elif arg[0] == 'fields': - for parg in arg[1:]: - self.fields.append((parg[0], parg[1])) - def merge(self, old): - # currently the .h parser doesn't try to work out what fields of - # an object structure should be public, so we just copy the list - # from the old version ... - self.fields = old.fields - def write_defs(self, fp=sys.stdout): - fp.write('(define-boxed ' + self.name + '\n') - if self.module: - fp.write(' (in-module "' + self.module + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.copy: - fp.write(' (copy-func "' + self.copy + '")\n') - if self.release: - fp.write(' (release-func "' + self.release + '")\n') - if self.fields: - fp.write(' (fields\n') - for (ftype, fname) in self.fields: - fp.write(' \'("' + ftype + '" "' + fname + '")\n') - fp.write(' )\n') - fp.write(')\n\n') - -class PointerDef(Definition): - def __init__(self, name, *args): - self.name = name - self.module = None - self.c_name = None - self.typecode = None - self.fields = [] - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.module = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'fields': - for parg in arg[1:]: - self.fields.append((parg[0], parg[1])) - def merge(self, old): - # currently the .h parser doesn't try to work out what fields of - # an object structure should be public, so we just copy the list - # from the old version ... - self.fields = old.fields - def write_defs(self, fp=sys.stdout): - fp.write('(define-pointer ' + self.name + '\n') - if self.module: - fp.write(' (in-module "' + self.module + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.fields: - fp.write(' (fields\n') - for (ftype, fname) in self.fields: - fp.write(' \'("' + ftype + '" "' + fname + '")\n') - fp.write(' )\n') - fp.write(')\n\n') - -class MethodDefBase(Definition): - def __init__(self, name, *args): - dump = 0 - self.name = name - self.ret = None - self.caller_owns_return = None - self.unblock_threads = None - self.c_name = None - self.typecode = None - self.of_object = None - self.params = [] # of form (type, name, default, nullok) - self.varargs = 0 - self.deprecated = None - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'of-object': - self.of_object = arg[1] - elif arg[0] == 'docstring': - self.docstring = make_docstring(arg[1:]) - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'return-type': - self.ret = arg[1] - elif arg[0] == 'caller-owns-return': - self.caller_owns_return = arg[1] in ('t', '#t') - elif arg[0] == 'unblock-threads': - self.unblock_threads = arg[1] in ('t', '#t') - elif arg[0] == 'parameters': - for parg in arg[1:]: - ptype = parg[0] - pname = parg[1] - pdflt = None - pnull = 0 - pdir = None - keeprefcount = False - for farg in parg[2:]: - assert isinstance(farg, tuple) - if farg[0] == 'default': - pdflt = farg[1] - elif farg[0] == 'null-ok': - pnull = 1 - elif farg[0] == 'direction': - pdir = farg[1] - elif farg[0] == 'keep-refcount': - keeprefcount = True - self.params.append(Parameter(ptype, pname, pdflt, pnull, pdir, - keeprefcount=keeprefcount)) - elif arg[0] == 'varargs': - self.varargs = arg[1] in ('t', '#t') - elif arg[0] == 'deprecated': - self.deprecated = arg[1] - else: - sys.stderr.write("Warning: %s argument unsupported.\n" - % (arg[0])) - dump = 1 - if dump: - self.write_defs(sys.stderr) - - if self.caller_owns_return is None and self.ret is not None: - self.guess_return_value_ownership() - - def merge(self, old, parmerge): - self.caller_owns_return = old.caller_owns_return - self.varargs = old.varargs - # here we merge extra parameter flags accross to the new object. - if not parmerge: - self.params = copy.deepcopy(old.params) - return - for i in range(len(self.params)): - ptype, pname, pdflt, pnull = self.params[i] - for p2 in old.params: - if p2[1] == pname: - self.params[i] = (ptype, pname, p2[2], p2[3]) - break - def _write_defs(self, fp=sys.stdout): - if self.of_object != (None, None): - fp.write(' (of-object "' + self.of_object + '")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.caller_owns_return: - fp.write(' (caller-owns-return #t)\n') - if self.unblock_threads: - fp.write(' (unblock_threads #t)\n') - if self.ret: - fp.write(' (return-type "' + self.ret + '")\n') - if self.deprecated: - fp.write(' (deprecated "' + self.deprecated + '")\n') - if self.params: - fp.write(' (parameters\n') - for ptype, pname, pdflt, pnull in self.params: - fp.write(' \'("' + ptype + '" "' + pname +'"') - if pdflt: fp.write(' (default "' + pdflt + '")') - if pnull: fp.write(' (null-ok)') - fp.write(')\n') - fp.write(' )\n') - if self.varargs: - fp.write(' (varargs #t)\n') - fp.write(')\n\n') - - -class MethodDef(MethodDefBase): - def __init__(self, name, *args): - MethodDefBase.__init__(self, name, *args) - for item in ('c_name', 'of_object'): - if self.__dict__[item] == None: - self.write_defs(sys.stderr) - raise RuntimeError, "definition missing required %s" % (item,) - - def write_defs(self, fp=sys.stdout): - fp.write('(define-method ' + self.name + '\n') - self._write_defs(fp) - -class VirtualDef(MethodDefBase): - def write_defs(self, fp=sys.stdout): - fp.write('(define-virtual ' + self.name + '\n') - self._write_defs(fp) - -class FunctionDef(Definition): - def __init__(self, name, *args): - dump = 0 - self.name = name - self.in_module = None - self.is_constructor_of = None - self.ret = None - self.caller_owns_return = None - self.unblock_threads = None - self.c_name = None - self.typecode = None - self.params = [] # of form (type, name, default, nullok) - self.varargs = 0 - self.deprecated = None - for arg in get_valid_scheme_definitions(args): - if arg[0] == 'in-module': - self.in_module = arg[1] - elif arg[0] == 'docstring': - self.docstring = make_docstring(arg[1:]) - elif arg[0] == 'is-constructor-of': - self.is_constructor_of = arg[1] - elif arg[0] == 'c-name': - self.c_name = arg[1] - elif arg[0] == 'gtype-id': - self.typecode = arg[1] - elif arg[0] == 'return-type': - self.ret = arg[1] - elif arg[0] == 'caller-owns-return': - self.caller_owns_return = arg[1] in ('t', '#t') - elif arg[0] == 'unblock-threads': - self.unblock_threads = arg[1] in ('t', '#t') - elif arg[0] == 'parameters': - for parg in arg[1:]: - ptype = parg[0] - pname = parg[1] - pdflt = None - pnull = 0 - keeprefcount = False - for farg in parg[2:]: - if farg[0] == 'default': - pdflt = farg[1] - elif farg[0] == 'null-ok': - pnull = 1 - elif farg[0] == 'keep-refcount': - keeprefcount = True - self.params.append(Parameter(ptype, pname, pdflt, pnull, - keeprefcount = keeprefcount)) - elif arg[0] == 'properties': - if self.is_constructor_of is None: - print >> sys.stderr, "Warning: (properties ...) "\ - "is only valid for constructors" - for prop in arg[1:]: - pname = prop[0] - optional = False - argname = pname - for farg in prop[1:]: - if farg[0] == 'optional': - optional = True - elif farg[0] == 'argname': - argname = farg[1] - self.params.append(Property(pname, optional, argname)) - elif arg[0] == 'varargs': - self.varargs = arg[1] in ('t', '#t') - elif arg[0] == 'deprecated': - self.deprecated = arg[1] - else: - sys.stderr.write("Warning: %s argument unsupported\n" - % (arg[0],)) - dump = 1 - if dump: - self.write_defs(sys.stderr) - - if self.caller_owns_return is None and self.ret is not None: - self.guess_return_value_ownership() - for item in ('c_name',): - if self.__dict__[item] == None: - self.write_defs(sys.stderr) - raise RuntimeError, "definition missing required %s" % (item,) - - _method_write_defs = MethodDef.__dict__['write_defs'] - - def merge(self, old, parmerge): - self.caller_owns_return = old.caller_owns_return - self.varargs = old.varargs - if not parmerge: - self.params = copy.deepcopy(old.params) - return - # here we merge extra parameter flags accross to the new object. - def merge_param(param): - for old_param in old.params: - if old_param.pname == param.pname: - if isinstance(old_param, Property): - # h2def never scans Property's, therefore if - # we have one it was manually written, so we - # keep it. - return copy.deepcopy(old_param) - else: - param.merge(old_param) - return param - raise RuntimeError, "could not find %s in old_parameters %r" % ( - param.pname, [p.pname for p in old.params]) - try: - self.params = map(merge_param, self.params) - except RuntimeError: - # parameter names changed and we can't find a match; it's - # safer to keep the old parameter list untouched. - self.params = copy.deepcopy(old.params) - - if not self.is_constructor_of: - try: - self.is_constructor_of = old.is_constructor_of - except AttributeError: - pass - if isinstance(old, MethodDef): - self.name = old.name - # transmogrify from function into method ... - self.write_defs = self._method_write_defs - self.of_object = old.of_object - del self.params[0] - def write_defs(self, fp=sys.stdout): - fp.write('(define-function ' + self.name + '\n') - if self.in_module: - fp.write(' (in-module "' + self.in_module + '")\n') - if self.is_constructor_of: - fp.write(' (is-constructor-of "' + self.is_constructor_of +'")\n') - if self.c_name: - fp.write(' (c-name "' + self.c_name + '")\n') - if self.typecode: - fp.write(' (gtype-id "' + self.typecode + '")\n') - if self.caller_owns_return: - fp.write(' (caller-owns-return #t)\n') - if self.unblock_threads: - fp.write(' (unblock-threads #t)\n') - if self.ret: - fp.write(' (return-type "' + self.ret + '")\n') - if self.deprecated: - fp.write(' (deprecated "' + self.deprecated + '")\n') - if self.params: - if isinstance(self.params[0], Parameter): - fp.write(' (parameters\n') - for ptype, pname, pdflt, pnull in self.params: - fp.write(' \'("' + ptype + '" "' + pname +'"') - if pdflt: fp.write(' (default "' + pdflt + '")') - if pnull: fp.write(' (null-ok)') - fp.write(')\n') - fp.write(' )\n') - elif isinstance(self.params[0], Property): - fp.write(' (properties\n') - for prop in self.params: - fp.write(' \'("' + prop.pname +'"') - if prop.optional: fp.write(' (optional)') - fp.write(')\n') - fp.write(' )\n') - else: - assert False, "strange parameter list %r" % self.params[0] - if self.varargs: - fp.write(' (varargs #t)\n') - - fp.write(')\n\n') diff --git a/codegen/defsparser.py b/codegen/defsparser.py deleted file mode 100644 index e24a969674..0000000000 --- a/codegen/defsparser.py +++ /dev/null @@ -1,143 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -import os, sys -import scmexpr -from definitions import BoxedDef, EnumDef, FlagsDef, FunctionDef, \ - InterfaceDef, MethodDef, ObjectDef, MiniObjectDef, PointerDef, \ - VirtualDef - -class IncludeParser(scmexpr.Parser): - """A simple parser that follows include statements automatically""" - def include(self, filename): - if not os.path.isabs(filename): - filename = os.path.join(os.path.dirname(self.filename), filename) - - # set self.filename to the include name, to handle recursive includes - oldfile = self.filename - self.filename = filename - self.startParsing() - self.filename = oldfile - -class DefsParser(IncludeParser): - def __init__(self, arg, defines={}): - IncludeParser.__init__(self, arg) - self.objects = [] - self.miniobjects = [] - self.interfaces = [] - self.enums = [] # enums and flags - self.boxes = [] # boxed types - self.pointers = [] # pointer types - self.functions = [] # functions and methods - self.virtuals = [] # virtual methods - self.c_name = {} # hash of c names of functions - self.methods = {} # hash of methods of particular objects - self.defines = defines # -Dfoo=bar options, as dictionary - - def define_object(self, *args): - odef = apply(ObjectDef, args) - self.objects.append(odef) - self.c_name[odef.c_name] = odef - # TODO: define_mini_object - def define_miniobject(self, *args): - odef = apply(MiniObjectDef, args) - self.miniobjects.append(odef) - self.c_name[odef.c_name] = odef - def define_interface(self, *args): - idef = apply(InterfaceDef, args) - self.interfaces.append(idef) - self.c_name[idef.c_name] = idef - def define_enum(self, *args): - edef = apply(EnumDef, args) - self.enums.append(edef) - self.c_name[edef.c_name] = edef - def define_flags(self, *args): - fdef = apply(FlagsDef, args) - self.enums.append(fdef) - self.c_name[fdef.c_name] = fdef - def define_boxed(self, *args): - bdef = apply(BoxedDef, args) - self.boxes.append(bdef) - self.c_name[bdef.c_name] = bdef - def define_pointer(self, *args): - pdef = apply(PointerDef, args) - self.pointers.append(pdef) - self.c_name[pdef.c_name] = pdef - def define_function(self, *args): - fdef = apply(FunctionDef, args) - self.functions.append(fdef) - self.c_name[fdef.c_name] = fdef - def define_method(self, *args): - mdef = apply(MethodDef, args) - self.functions.append(mdef) - self.c_name[mdef.c_name] = mdef - def define_virtual(self, *args): - vdef = apply(VirtualDef, args) - self.virtuals.append(vdef) - def merge(self, old, parmerge): - for obj in self.objects: - if old.c_name.has_key(obj.c_name): - obj.merge(old.c_name[obj.c_name]) - for f in self.functions: - if old.c_name.has_key(f.c_name): - f.merge(old.c_name[f.c_name], parmerge) - - def printMissing(self, old): - for obj in self.objects: - if not old.c_name.has_key(obj.c_name): - obj.write_defs() - for f in self.functions: - if not old.c_name.has_key(f.c_name): - f.write_defs() - - def write_defs(self, fp=sys.stdout): - for obj in self.objects: - obj.write_defs(fp) - # TODO: Add miniobject - for obj in self.miniobjects: - obj.write_defs(fp) - for enum in self.enums: - enum.write_defs(fp) - for boxed in self.boxes: - boxed.write_defs(fp) - for pointer in self.pointers: - pointer.write_defs(fp) - for func in self.functions: - func.write_defs(fp) - - def find_object(self, c_name): - for obj in self.objects: - if obj.c_name == c_name: - return obj - else: - raise ValueError, 'object not found' - - def find_constructor(self, obj, overrides): - for func in self.functions: - if isinstance(func, FunctionDef) and \ - func.is_constructor_of == obj.c_name and \ - not overrides.is_ignored(func.c_name): - return func - - def find_methods(self, obj): - objname = obj.c_name - return filter(lambda func, on=objname: isinstance(func, MethodDef) and - func.of_object == on, self.functions) - - def find_virtuals(self, obj): - objname = obj.c_name - retval = filter(lambda func, on=objname: isinstance(func, VirtualDef) and - func.of_object == on, self.virtuals) - return retval - - def find_functions(self): - return filter(lambda func: isinstance(func, FunctionDef) and - not func.is_constructor_of, self.functions) - - def ifdef(self, *args): - if args[0] in self.defines: - for arg in args[1:]: - self.handle(arg) - - def ifndef(self, *args): - if args[0] not in self.defines: - for arg in args[1:]: - self.handle(arg) diff --git a/codegen/docextract.py b/codegen/docextract.py deleted file mode 100644 index e6c65053d6..0000000000 --- a/codegen/docextract.py +++ /dev/null @@ -1,185 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -'''Simple module for extracting GNOME style doc comments from C -sources, so I can use them for other purposes.''' - -import sys, os, string, re - -__all__ = ['extract'] - -class FunctionDoc: - def __init__(self): - self.name = None - self.params = [] - self.description = '' - self.ret = '' - def set_name(self, name): - self.name = name - def add_param(self, name, description): - if name == '...': - name = 'Varargs' - self.params.append((name, description)) - def append_to_last_param(self, extra): - self.params[-1] = (self.params[-1][0], self.params[-1][1] + extra) - def append_to_named_param(self, name, extra): - for i in range(len(self.params)): - if self.params[i][0] == name: - self.params[i] = (name, self.params[i][1] + extra) - return - # fall through to adding extra parameter ... - self.add_param(name, extra) - def append_description(self, extra): - self.description = self.description + extra - def append_return(self, extra): - self.ret = self.ret + extra - - def get_param_description(self, name): - for param, description in self.params: - if param == name: - return description - else: - return '' - -comment_start_pat = re.compile(r'^\s*/\*\*\s') -comment_end_pat = re.compile(r'^\s*\*+/') -comment_line_lead = re.compile(r'^\s*\*\s*') -funcname_pat = re.compile(r'^(\w+)\s*:?') -return_pat = re.compile(r'^(returns:|return\s+value:|returns\s*)(.*\n?)$', - re.IGNORECASE) -param_pat = re.compile(r'^@(\S+)\s*:(.*\n?)$') - -def parse_file(fp, doc_dict): - line = fp.readline() - in_comment_block = 0 - while line: - if not in_comment_block: - if comment_start_pat.match(line): - in_comment_block = 1 - cur_doc = FunctionDoc() - in_description = 0 - in_return = 0 - line = fp.readline() - continue - - # we are inside a comment block ... - if comment_end_pat.match(line): - if not cur_doc.name: - sys.stderr.write("no function name found in doc comment\n") - else: - doc_dict[cur_doc.name] = cur_doc - in_comment_block = 0 - line = fp.readline() - continue - - # inside a comment block, and not the end of the block ... - line = comment_line_lead.sub('', line) - if not line: line = '\n' - - if not cur_doc.name: - match = funcname_pat.match(line) - if match: - cur_doc.set_name(match.group(1)) - elif in_return: - match = return_pat.match(line) - if match: - # assume the last return statement was really part of the - # description - return_start = match.group(1) - cur_doc.ret = match.group(2) - cur_doc.description = cur_doc.description + return_start + \ - cur_doc.ret - else: - cur_doc.append_return(line) - elif in_description: - if line[:12] == 'Description:': - line = line[12:] - match = return_pat.match(line) - if match: - in_return = 1 - return_start = match.group(1) - cur_doc.append_return(match.group(2)) - else: - cur_doc.append_description(line) - elif line == '\n': - # end of parameters - in_description = 1 - else: - match = param_pat.match(line) - if match: - param = match.group(1) - desc = match.group(2) - if param == 'returns': - cur_doc.ret = desc - else: - cur_doc.add_param(param, desc) - else: - # must be continuation - try: - if param == 'returns': - cur_doc.append_return(line) - else: - cur_doc.append_to_last_param(line) - except: - sys.stderr.write('something weird while reading param\n') - line = fp.readline() - -def parse_dir(dir, doc_dict): - for file in os.listdir(dir): - if file in ('.', '..'): continue - path = os.path.join(dir, file) - if os.path.isdir(path): - parse_dir(path, doc_dict) - if len(file) > 2 and file[-2:] == '.c': - parse_file(open(path, 'r'), doc_dict) - -def extract(dirs, doc_dict=None): - if not doc_dict: doc_dict = {} - for dir in dirs: - parse_dir(dir, doc_dict) - return doc_dict - -tmpl_section_pat = re.compile(r'^$') -def parse_tmpl(fp, doc_dict): - cur_doc = None - - line = fp.readline() - while line: - match = tmpl_section_pat.match(line) - if match: - cur_doc = None # new input shouldn't affect the old doc dict - sect_type = match.group(1) - sect_name = match.group(2) - - if sect_type == 'FUNCTION': - cur_doc = doc_dict.get(sect_name) - if not cur_doc: - cur_doc = FunctionDoc() - cur_doc.set_name(sect_name) - doc_dict[sect_name] = cur_doc - elif line == '\n': - cur_doc = None # don't worry about unused params. - elif cur_doc: - if line[:10] == '@Returns: ': - if string.strip(line[10:]): - cur_doc.append_return(line[10:]) - elif line[0] == '@': - pos = string.find(line, ':') - if pos >= 0: - cur_doc.append_to_named_param(line[1:pos], line[pos+1:]) - else: - cur_doc.append_description(line) - else: - cur_doc.append_description(line) - - line = fp.readline() - -def extract_tmpl(dirs, doc_dict=None): - if not doc_dict: doc_dict = {} - for dir in dirs: - for file in os.listdir(dir): - if file in ('.', '..'): continue - path = os.path.join(dir, file) - if os.path.isdir(path): - continue - if len(file) > 2 and file[-2:] == '.sgml': - parse_tmpl(open(path, 'r'), doc_dict) - return doc_dict diff --git a/codegen/docgen.py b/codegen/docgen.py deleted file mode 100644 index 6905a14bf8..0000000000 --- a/codegen/docgen.py +++ /dev/null @@ -1,752 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; py-indent-offset: 4 -*- -import sys, os, string, re, getopt - -import defsparser -import definitions -import override -import docextract - -class Node: - def __init__(self, name, interfaces=[]): - self.name = name - self.interfaces = interfaces - self.subclasses = [] - def add_child(self, node): - self.subclasses.append(node) - -def build_object_tree(parser): - # reorder objects so that parent classes come first ... - objects = parser.objects[:] - pos = 0 - while pos < len(objects): - parent = objects[pos].parent - for i in range(pos+1, len(objects)): - if objects[i].c_name == parent: - objects.insert(i+1, objects[pos]) - del objects[pos] - break - else: - pos = pos + 1 - - root = Node(None) - nodes = { None: root } - for obj_def in objects: - print obj_def.name - parent_node = nodes[obj_def.parent] - node = Node(obj_def.c_name, obj_def.implements) - parent_node.add_child(node) - nodes[node.name] = node - - if parser.interfaces: - interfaces = Node('gobject.GInterface') - root.add_child(interfaces) - nodes[interfaces.name] = interfaces - for obj_def in parser.interfaces: - node = Node(obj_def.c_name) - interfaces.add_child(node) - nodes[node.name] = node - - if parser.boxes: - boxed = Node('gobject.GBoxed') - root.add_child(boxed) - nodes[boxed.name] = boxed - for obj_def in parser.boxes: - node = Node(obj_def.c_name) - boxed.add_child(node) - nodes[node.name] = node - - if parser.pointers: - pointers = Node('gobject.GPointer') - root.add_child(pointers) - nodes[pointers.name] = pointers - for obj_def in parser.pointers: - node = Node(obj_def.c_name) - pointers.add_child(node) - nodes[node.name] = node - - return root - -class DocWriter: - def __init__(self): - # parse the defs file - self.parser = defsparser.DefsParser(()) - self.overrides = override.Overrides() - self.classmap = {} - self.docs = {} - - def add_sourcedirs(self, source_dirs): - self.docs = docextract.extract(source_dirs, self.docs) - def add_tmpldirs(self, tmpl_dirs): - self.docs = docextract.extract_tmpl(tmpl_dirs, self.docs) - - def add_docs(self, defs_file, overrides_file, module_name): - '''parse information about a given defs file''' - self.parser.filename = defs_file - self.parser.startParsing(defs_file) - if overrides_file: - self.overrides.handle_file(overrides_file) - - for obj in self.parser.objects: - if not self.classmap.has_key(obj.c_name): - self.classmap[obj.c_name] = '%s.%s' % (module_name, obj.name) - for obj in self.parser.interfaces: - if not self.classmap.has_key(obj.c_name): - self.classmap[obj.c_name] = '%s.%s' % (module_name, obj.name) - for obj in self.parser.boxes: - if not self.classmap.has_key(obj.c_name): - self.classmap[obj.c_name] = '%s.%s' % (module_name, obj.name) - for obj in self.parser.pointers: - if not self.classmap.has_key(obj.c_name): - self.classmap[obj.c_name] = '%s.%s' % (module_name, obj.name) - - def pyname(self, name): - return self.classmap.get(name, name) - - def __compare(self, obja, objb): - return cmp(self.pyname(obja.c_name), self.pyname(objb.c_name)) - def output_docs(self, output_prefix): - files = [] - - # class hierarchy - hierarchy = build_object_tree(self.parser) - filename = self.create_filename('hierarchy', output_prefix) - fp = open(filename, 'w') - self.write_full_hierarchy(hierarchy, fp) - fp.close() - - obj_defs = self.parser.objects + self.parser.interfaces + \ - self.parser.boxes + self.parser.pointers - obj_defs.sort(self.__compare) - for obj_def in obj_defs: - filename = self.create_filename(obj_def.c_name, output_prefix) - fp = open(filename, 'w') - if isinstance(obj_def, definitions.ObjectDef): - self.output_object_docs(obj_def, fp) - elif isinstance(obj_def, definitions.InterfaceDef): - self.output_interface_docs(obj_def, fp) - elif isinstance(obj_def, definitions.BoxedDef): - self.output_boxed_docs(obj_def, fp) - elif isinstance(obj_def, definitions.PointerDef): - self.output_boxed_docs(obj_def, fp) - fp.close() - files.append((os.path.basename(filename), obj_def)) - - if files: - filename = self.create_toc_filename(output_prefix) - fp = open(filename, 'w') - self.output_toc(files, fp) - fp.close() - - def output_object_docs(self, obj_def, fp=sys.stdout): - self.write_class_header(obj_def.c_name, fp) - - self.write_heading('Synopsis', fp) - self.write_synopsis(obj_def, fp) - self.close_section(fp) - - # construct the inheritence hierarchy ... - ancestry = [ (obj_def.c_name, obj_def.implements) ] - try: - parent = obj_def.parent - while parent != None: - if parent == 'GObject': - ancestry.append(('GObject', [])) - parent = None - else: - parent_def = self.parser.find_object(parent) - ancestry.append((parent_def.c_name, parent_def.implements)) - parent = parent_def.parent - except ValueError: - pass - ancestry.reverse() - self.write_heading('Ancestry', fp) - self.write_hierarchy(obj_def.c_name, ancestry, fp) - self.close_section(fp) - - constructor = self.parser.find_constructor(obj_def, self.overrides) - if constructor: - self.write_heading('Constructor', fp) - self.write_constructor(constructor, - self.docs.get(constructor.c_name, None), - fp) - self.close_section(fp) - - methods = self.parser.find_methods(obj_def) - methods = filter(lambda meth, self=self: - not self.overrides.is_ignored(meth.c_name), methods) - if methods: - self.write_heading('Methods', fp) - for method in methods: - self.write_method(method, self.docs.get(method.c_name, None), fp) - self.close_section(fp) - - self.write_class_footer(obj_def.c_name, fp) - - def output_interface_docs(self, int_def, fp=sys.stdout): - self.write_class_header(int_def.c_name, fp) - - self.write_heading('Synopsis', fp) - self.write_synopsis(int_def, fp) - self.close_section(fp) - - methods = self.parser.find_methods(int_def) - methods = filter(lambda meth, self=self: - not self.overrides.is_ignored(meth.c_name), methods) - if methods: - self.write_heading('Methods', fp) - for method in methods: - self.write_method(method, self.docs.get(method.c_name, None), fp) - self.close_section(fp) - - self.write_class_footer(int_def.c_name, fp) - - def output_boxed_docs(self, box_def, fp=sys.stdout): - self.write_class_header(box_def.c_name, fp) - - self.write_heading('Synopsis', fp) - self.write_synopsis(box_def, fp) - self.close_section(fp) - - constructor = self.parser.find_constructor(box_def, self.overrides) - if constructor: - self.write_heading('Constructor', fp) - self.write_constructor(constructor, - self.docs.get(constructor.c_name, None), - fp) - self.close_section(fp) - - methods = self.parser.find_methods(box_def) - methods = filter(lambda meth, self=self: - not self.overrides.is_ignored(meth.c_name), methods) - if methods: - self.write_heading('Methods', fp) - for method in methods: - self.write_method(method, self.docs.get(method.c_name, None), fp) - self.close_section(fp) - - self.write_class_footer(box_def.c_name, fp) - - def output_toc(self, files, fp=sys.stdout): - fp.write('TOC\n\n') - for filename, obj_def in files: - fp.write(obj_def.c_name + ' - ' + filename + '\n') - - # override the following to create a more complex output format - def create_filename(self, obj_name, output_prefix): - '''Create output filename for this particular object''' - return output_prefix + '-' + string.lower(obj_name) + '.txt' - def create_toc_filename(self, output_prefix): - return self.create_filename(self, 'docs', output_prefix) - - def write_full_hierarchy(self, hierarchy, fp): - def handle_node(node, fp, indent=''): - for child in node.subclasses: - fp.write(indent + node.name) - if node.interfaces: - fp.write(' (implements ') - fp.write(string.join(node.interfaces, ', ')) - fp.write(')\n') - else: - fp.write('\n') - handle_node(child, fp, indent + ' ') - handle_node(hierarchy, fp) - - # these need to handle default args ... - def create_constructor_prototype(self, func_def): - return func_def.is_constructor_of + '(' + \ - string.join(map(lambda x: x[1], func_def.params), ', ') + \ - ')' - def create_function_prototype(self, func_def): - return func_def.name + '(' + \ - string.join(map(lambda x: x[1], func_def.params), ', ') + \ - ')' - def create_method_prototype(self, meth_def): - return meth_def.of_object + '.' + \ - meth_def.name + '(' + \ - string.join(map(lambda x: x[1], meth_def.params), ', ') + \ - ')' - - def write_class_header(self, obj_name, fp): - fp.write('Class %s\n' % obj_name) - fp.write('======%s\n\n' % ('=' * len(obj_name))) - def write_class_footer(self, obj_name, fp): - pass - def write_heading(self, text, fp): - fp.write('\n' + text + '\n' + ('-' * len(text)) + '\n') - def close_section(self, fp): - pass - def write_synopsis(self, obj_def, fp): - fp.write('class %s' % obj_def.c_name) - if isinstance(obj_def, definitions.ObjectDef): - bases = [] - if obj_def.parent: bases.append(obj_def.parent) - bases = bases = obj_def.implements - if bases: - fp.write('(%s)' % string.join(bases, ', ')) - fp.write(':\n') - - constructor = self.parser.find_constructor(obj_def, self.overrides) - if constructor: - prototype = self.create_constructor_prototype(constructor) - fp.write(' def %s\n' % prototype) - methods = self.parser.find_methods(obj_def) - methods = filter(lambda meth, self=self: - not self.overrides.is_ignored(meth.c_name), methods) - for meth in methods: - prototype = self.create_method_prototype(meth) - fp.write(' def %s\n' % prototype) - - def write_hierarchy(self, obj_name, ancestry, fp): - indent = '' - for name, interfaces in ancestry: - fp.write(indent + '+-- ' + name) - if interfaces: - fp.write(' (implements ') - fp.write(string.join(interfaces, ', ')) - fp.write(')\n') - else: - fp.write('\n') - indent = indent + ' ' - fp.write('\n') - def write_constructor(self, func_def, func_doc, fp): - prototype = self.create_constructor_prototype(func_def) - fp.write(prototype + '\n\n') - for type, name, dflt, null in func_def.params: - if func_doc: - descr = func_doc.get_param_description(name) - else: - descr = 'a ' + type - fp.write(' ' + name + ': ' + descr + '\n') - if func_def.ret and func_def.ret != 'none': - if func_doc and func_doc.ret: - descr = func_doc.ret - else: - descr = 'a ' + func_def.ret - fp.write(' Returns: ' + descr + '\n') - if func_doc and func_doc.description: - fp.write(func_doc.description) - fp.write('\n\n\n') - def write_method(self, meth_def, func_doc, fp): - prototype = self.create_method_prototype(meth_def) - fp.write(prototype + '\n\n') - for type, name, dflt, null in meth_def.params: - if func_doc: - descr = func_doc.get_param_description(name) - else: - descr = 'a ' + type - fp.write(' ' + name + ': ' + descr + '\n') - if meth_def.ret and meth_def.ret != 'none': - if func_doc and func_doc.ret: - descr = func_doc.ret - else: - descr = 'a ' + meth_def.ret - fp.write(' Returns: ' + descr + '\n') - if func_doc and func_doc.description: - fp.write('\n') - fp.write(func_doc.description) - fp.write('\n\n') - -class DocbookDocWriter(DocWriter): - def __init__(self, use_xml=0): - DocWriter.__init__(self) - self.use_xml = use_xml - - def create_filename(self, obj_name, output_prefix): - '''Create output filename for this particular object''' - stem = output_prefix + '-' + string.lower(obj_name) - if self.use_xml: - return stem + '.xml' - else: - return stem + '.sgml' - def create_toc_filename(self, output_prefix): - if self.use_xml: - return self.create_filename('classes', output_prefix) - else: - return self.create_filename('docs', output_prefix) - - # make string -> reference translation func - __transtable = [ '-' ] * 256 - for digit in '0123456789': - __transtable[ord(digit)] = digit - for letter in 'abcdefghijklmnopqrstuvwxyz': - __transtable[ord(letter)] = letter - __transtable[ord(string.upper(letter))] = letter - __transtable = string.join(__transtable, '') - - def make_class_ref(self, obj_name): - return 'class-' + string.translate(obj_name, self.__transtable) - def make_method_ref(self, meth_def): - return 'method-' + string.translate(meth_def.of_object, - self.__transtable) + \ - '--' + string.translate(meth_def.name, self.__transtable) - - __function_pat = re.compile(r'(\w+)\s*\(\)') - def __format_function(self, match): - info = self.parser.c_name.get(match.group(1), None) - if info: - if isinstance(info, defsparser.FunctionDef): - if info.is_constructor_of is not None: - # should have a link here - return '%s()' % \ - self.pyname(info.is_constructor_of) - else: - return '' + info.name + '()' - if isinstance(info, defsparser.MethodDef): - return '' + self.pyname(info.of_object) + '.' + \ - info.name + '()' - # fall through through - return '' + match.group(1) + '()' - __parameter_pat = re.compile(r'\@(\w+)') - def __format_param(self, match): - return '' + match.group(1) + '' - __constant_pat = re.compile(r'\%(-?\w+)') - def __format_const(self, match): - return '' + match.group(1) + '' - __symbol_pat = re.compile(r'#([\w-]+)') - def __format_symbol(self, match): - info = self.parser.c_name.get(match.group(1), None) - if info: - if isinstance(info, defsparser.FunctionDef): - if info.is_constructor_of is not None: - # should have a link here - return '' + self.pyname(info.is_constructor_of) + \ - '' - else: - return '' + info.name + '' - if isinstance(info, defsparser.MethodDef): - return '' + self.pyname(info.of_object) + '.' + \ - info.name + '' - if isinstance(info, defsparser.ObjectDef) or \ - isinstance(info, defsparser.InterfaceDef) or \ - isinstance(info, defsparser.BoxedDef) or \ - isinstance(info, defsparser.PointerDef): - return '' + self.pyname(info.c_name) + \ - '' - # fall through through - return '' + match.group(1) + '' - - def reformat_text(self, text, singleline=0): - # replace special strings ... - text = self.__function_pat.sub(self.__format_function, text) - text = self.__parameter_pat.sub(self.__format_param, text) - text = self.__constant_pat.sub(self.__format_const, text) - text = self.__symbol_pat.sub(self.__format_symbol, text) - - # don't bother with expansion for single line text. - if singleline: return text - - lines = string.split(string.strip(text), '\n') - for index in range(len(lines)): - if string.strip(lines[index]) == '': - lines[index] = '\n' - continue - lines.insert(0, '') - lines.append('') - return string.join(lines, '\n') - - # write out hierarchy - def write_full_hierarchy(self, hierarchy, fp): - def handle_node(node, fp, indent=''): - if node.name: - fp.write('%s%s' % - (indent, self.make_class_ref(node.name), - self.pyname(node.name))) - if node.interfaces: - fp.write(' (implements ') - for i in range(len(node.interfaces)): - fp.write('%s' % - (self.make_class_ref(node.interfaces[i]), - self.pyname(node.interfaces[i]))) - if i != len(node.interfaces) - 1: - fp.write(', ') - fp.write(')\n') - else: - fp.write('\n') - - indent = indent + ' ' - node.subclasses.sort(lambda a,b: - cmp(self.pyname(a.name), self.pyname(b.name))) - for child in node.subclasses: - handle_node(child, fp, indent) - if self.use_xml: - fp.write('\n') - fp.write('\n') - fp.write('') - handle_node(hierarchy, fp) - fp.write('\n') - - # these need to handle default args ... - def create_constructor_prototype(self, func_def): - sgml = [ '\n'] - sgml.append(' __init__\n') - for type, name, dflt, null in func_def.params: - sgml.append(' ') - sgml.append(name) - sgml.append('') - if dflt: - sgml.append('') - sgml.append(dflt) - sgml.append('') - sgml.append('\n') - if not func_def.params: - sgml.append(' ') - sgml.append(' ') - return string.join(sgml, '') - def create_function_prototype(self, func_def): - sgml = [ '\n \n'] - sgml.append(' ') - sgml.append(func_def.name) - sgml.append('\n') - for type, name, dflt, null in func_def.params: - sgml.append(' ') - sgml.append(name) - sgml.append('') - if dflt: - sgml.append('') - sgml.append(dflt) - sgml.append('') - sgml.append('\n') - if not func_def.params: - sgml.append(' \n ') - return string.join(sgml, '') - def create_method_prototype(self, meth_def, addlink=0): - sgml = [ '\n'] - sgml.append(' ') - if addlink: - sgml.append('' % self.make_method_ref(meth_def)) - sgml.append(self.pyname(meth_def.name)) - if addlink: - sgml.append('') - sgml.append('\n') - for type, name, dflt, null in meth_def.params: - sgml.append(' ') - sgml.append(name) - sgml.append('') - if dflt: - sgml.append('') - sgml.append(dflt) - sgml.append('') - sgml.append('\n') - if not meth_def.params: - sgml.append(' ') - sgml.append(' ') - return string.join(sgml, '') - - def write_class_header(self, obj_name, fp): - if self.use_xml: - fp.write('\n') - fp.write('\n') - fp.write('\n') - fp.write(' \n') - fp.write(' %s\n' - % self.pyname(obj_name)) - fp.write(' 3\n') - fp.write(' PyGTK Docs\n') - fp.write(' \n\n') - fp.write(' \n') - fp.write(' %s\n' - % self.pyname(obj_name)) - fp.write(' \n\n') - def write_class_footer(self, obj_name, fp): - fp.write('\n') - def write_heading(self, text, fp): - fp.write(' \n') - fp.write(' ' + text + '\n\n') - def close_section(self, fp): - fp.write(' \n') - - def write_synopsis(self, obj_def, fp): - fp.write('\n') - fp.write(' %s\n' - % self.pyname(obj_def.c_name)) - if isinstance(obj_def, definitions.ObjectDef): - if obj_def.parent: - fp.write(' %s' - '\n' - % (self.make_class_ref(obj_def.parent), - self.pyname(obj_def.parent))) - for base in obj_def.implements: - fp.write(' %s' - '\n' - % (self.make_class_ref(base), self.pyname(base))) - elif isinstance(obj_def, definitions.InterfaceDef): - fp.write(' gobject.GInterface' - '\n') - elif isinstance(obj_def, definitions.BoxedDef): - fp.write(' gobject.GBoxed' - '\n') - elif isinstance(obj_def, definitions.PointerDef): - fp.write(' gobject.GPointer' - '\n') - - constructor = self.parser.find_constructor(obj_def, self.overrides) - if constructor: - fp.write('%s\n' % self.create_constructor_prototype(constructor)) - methods = self.parser.find_methods(obj_def) - methods = filter(lambda meth, self=self: - not self.overrides.is_ignored(meth.c_name), methods) - for meth in methods: - fp.write('%s\n' % self.create_method_prototype(meth, addlink=1)) - fp.write('\n\n') - - def write_hierarchy(self, obj_name, ancestry, fp): - fp.write('') - indent = '' - for name, interfaces in ancestry: - fp.write(indent + '+-- '+ self.pyname(name) + '') - if interfaces: - fp.write(' (implements ') - for i in range(len(interfaces)): - fp.write('%s' % - (self.make_class_ref(interfaces[i]), - self.pyname(interfaces[i]))) - if i != len(interfaces) - 1: - fp.write(', ') - fp.write(')\n') - else: - fp.write('\n') - indent = indent + ' ' - fp.write('\n\n') - - def write_params(self, params, ret, func_doc, fp): - if not params and (not ret or ret == 'none'): - return - fp.write(' \n') - for type, name, dflt, null in params: - if func_doc: - descr = string.strip(func_doc.get_param_description(name)) - else: - descr = 'a ' + type - fp.write(' \n') - fp.write(' %s :\n' % name) - fp.write(' %s\n' % - self.reformat_text(descr, singleline=1)) - fp.write(' \n') - if ret and ret != 'none': - if func_doc and func_doc.ret: - descr = string.strip(func_doc.ret) - else: - descr = 'a ' + ret - fp.write(' \n') - fp.write(' Returns :\n') - fp.write(' %s\n' % - self.reformat_text(descr, singleline=1)) - fp.write(' \n') - fp.write(' \n') - - def write_constructor(self, func_def, func_doc, fp): - prototype = self.create_constructor_prototype(func_def) - fp.write('%s\n' % prototype) - self.write_params(func_def.params, func_def.ret, func_doc, fp) - - if func_doc and func_doc.description: - fp.write(self.reformat_text(func_doc.description)) - fp.write('\n\n\n') - - def write_method(self, meth_def, func_doc, fp): - fp.write(' \n') - fp.write(' ' + self.pyname(meth_def.of_object) + '.' + - meth_def.name + '\n\n') - prototype = self.create_method_prototype(meth_def) - fp.write('%s\n' % prototype) - self.write_params(meth_def.params, meth_def.ret, func_doc, fp) - if func_doc and func_doc.description: - fp.write(self.reformat_text(func_doc.description)) - fp.write(' \n\n\n') - - def output_toc(self, files, fp=sys.stdout): - if self.use_xml: - fp.write('\n') - fp.write('\n') - #for filename, obj_def in files: - # fp.write(' \n') - #fp.write(']>\n\n') - - #fp.write('\n') - #fp.write(' Class Documentation\n') - #for filename, obj_def in files: - # fp.write('&' + string.translate(obj_def.c_name, - # self.__transtable) + ';\n') - #fp.write('\n') - - fp.write('\n') - fp.write(' Class Reference\n') - for filename, obj_def in files: - fp.write(' \n' % filename) - fp.write('\n') - else: - fp.write('\n') - fp.write(']>\n\n') - - fp.write('\n\n') - fp.write(' \n') - fp.write(' PyGTK Docs\n') - fp.write(' \n') - fp.write(' \n') - fp.write(' James\n') - fp.write(' Henstridge\n') - fp.write(' \n') - fp.write(' \n') - fp.write(' \n\n') - - fp.write(' \n') - fp.write(' Class Hierarchy\n') - fp.write(' Not done yet\n') - fp.write(' \n\n') - - fp.write(' \n') - fp.write(' Class Documentation\n') - for filename, obj_def in files: - fp.write('&' + string.translate(obj_def.c_name, - self.__transtable) + ';\n') - - fp.write(' \n') - fp.write('\n') - -if __name__ == '__main__': - try: - opts, args = getopt.getopt(sys.argv[1:], "d:s:o:", - ["defs-file=", "override=", "source-dir=", - "output-prefix="]) - except getopt.error, e: - sys.stderr.write('docgen.py: %s\n' % e) - sys.stderr.write( - 'usage: docgen.py -d file.defs [-s /src/dir] [-o output-prefix]\n') - sys.exit(1) - defs_file = None - overrides_file = None - source_dirs = [] - output_prefix = 'docs' - for opt, arg in opts: - if opt in ('-d', '--defs-file'): - defs_file = arg - if opt in ('--override',): - overrides_file = arg - elif opt in ('-s', '--source-dir'): - source_dirs.append(arg) - elif opt in ('-o', '--output-prefix'): - output_prefix = arg - if len(args) != 0 or not defs_file: - sys.stderr.write( - 'usage: docgen.py -d file.defs [-s /src/dir] [-o output-prefix]\n') - sys.exit(1) - - d = DocbookDocWriter() - d.add_sourcedirs(source_dirs) - d.add_docs(defs_file, overrides_file, 'gtk') - d.output_docs(output_prefix) diff --git a/codegen/h2def.py b/codegen/h2def.py deleted file mode 100755 index d4b21356c2..0000000000 --- a/codegen/h2def.py +++ /dev/null @@ -1,536 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; py-indent-offset: 4 -*- -# Search through a header file looking for function prototypes. -# For each prototype, generate a scheme style definition. -# GPL'ed -# Toby D. Reeves -# -# Modified by James Henstridge to output stuff in -# Havoc's new defs format. Info on this format can be seen at: -# http://www.gnome.org/mailing-lists/archives/gtk-devel-list/2000-January/0085.shtml -# Updated to be PEP-8 compatible and refactored to use OOP - -import getopt -import os -import re -import string -import sys - -import defsparser - -# ------------------ Create typecodes from typenames --------- - -_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])') -_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])') -_upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])') - -def to_upper_str(name): - """Converts a typename to the equivalent upercase and underscores - name. This is used to form the type conversion macros and enum/flag - name variables""" - name = _upperstr_pat1.sub(r'\1_\2', name) - name = _upperstr_pat2.sub(r'\1_\2', name) - name = _upperstr_pat3.sub(r'\1_\2', name, count=1) - return string.upper(name) - -def typecode(typename): - """create a typecode (eg. GTK_TYPE_WIDGET) from a typename""" - return string.replace(to_upper_str(typename), '_', '_TYPE_', 1) - - -# ------------------ Find object definitions ----------------- - -def strip_comments(buf): - parts = [] - lastpos = 0 - while 1: - pos = string.find(buf, '/*', lastpos) - if pos >= 0: - parts.append(buf[lastpos:pos]) - pos = string.find(buf, '*/', pos) - if pos >= 0: - lastpos = pos + 2 - else: - break - else: - parts.append(buf[lastpos:]) - break - return string.join(parts, '') - -obj_name_pat = "[A-Z][a-z]*[A-Z][A-Za-z0-9]*" - -split_prefix_pat = re.compile('([A-Z]+[a-z]*)([A-Za-z0-9]+)') - -def find_obj_defs(buf, objdefs=[]): - """ - Try to find object definitions in header files. - """ - - # filter out comments from buffer. - buf = strip_comments(buf) - - maybeobjdefs = [] # contains all possible objects from file - - # first find all structures that look like they may represent a GtkObject - pat = re.compile("struct _(" + obj_name_pat + ")\s*{\s*" + - "(" + obj_name_pat + ")\s+", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - maybeobjdefs.append((m.group(1), m.group(2))) - pos = m.end() - - # handle typedef struct { ... } style struct defs. - pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" + - "(" + obj_name_pat + ")\s+[^}]*}\s*" + - "(" + obj_name_pat + ")\s*;", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - maybeobjdefs.append((m.group(2), m.group(2))) - pos = m.end() - - # now find all structures that look like they might represent a class: - pat = re.compile("struct _(" + obj_name_pat + ")Class\s*{\s*" + - "(" + obj_name_pat + ")Class\s+", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - t = (m.group(1), m.group(2)) - # if we find an object structure together with a corresponding - # class structure, then we have probably found a GtkObject subclass. - if t in maybeobjdefs: - objdefs.append(t) - pos = m.end() - - pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" + - "(" + obj_name_pat + ")Class\s+[^}]*}\s*" + - "(" + obj_name_pat + ")Class\s*;", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - t = (m.group(2), m.group(1)) - # if we find an object structure together with a corresponding - # class structure, then we have probably found a GtkObject subclass. - if t in maybeobjdefs: - objdefs.append(t) - pos = m.end() - - # now find all structures that look like they might represent - # a class inherited from GTypeInterface: - pat = re.compile("struct _(" + obj_name_pat + ")Class\s*{\s*" + - "GTypeInterface\s+", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - t = (m.group(1), '') - t2 = (m.group(1)+'Class', 'GTypeInterface') - # if we find an object structure together with a corresponding - # class structure, then we have probably found a GtkObject subclass. - if t2 in maybeobjdefs: - objdefs.append(t) - pos = m.end() - - # now find all structures that look like they might represent - # an Iface inherited from GTypeInterface: - pat = re.compile("struct _(" + obj_name_pat + ")Iface\s*{\s*" + - "GTypeInterface\s+", re.MULTILINE) - pos = 0 - while pos < len(buf): - m = pat.search(buf, pos) - if not m: break - t = (m.group(1), '') - t2 = (m.group(1)+'Iface', 'GTypeInterface') - # if we find an object structure together with a corresponding - # class structure, then we have probably found a GtkObject subclass. - if t2 in maybeobjdefs: - objdefs.append(t) - pos = m.end() - -def sort_obj_defs(objdefs): - objdefs.sort() # not strictly needed, but looks nice - pos = 0 - while pos < len(objdefs): - klass,parent = objdefs[pos] - for i in range(pos+1, len(objdefs)): - # parent below subclass ... reorder - if objdefs[i][0] == parent: - objdefs.insert(i+1, objdefs[pos]) - del objdefs[pos] - break - else: - pos = pos + 1 - return objdefs - -# ------------------ Find enum definitions ----------------- - -def find_enum_defs(buf, enums=[]): - # strip comments - # bulk comments - buf = strip_comments(buf) - - buf = re.sub('\n', ' ', buf) - - enum_pat = re.compile(r'enum\s*{([^}]*)}\s*([A-Z][A-Za-z]*)(\s|;)') - splitter = re.compile(r'\s*,\s', re.MULTILINE) - pos = 0 - while pos < len(buf): - m = enum_pat.search(buf, pos) - if not m: break - - name = m.group(2) - vals = m.group(1) - isflags = string.find(vals, '<<') >= 0 - entries = [] - for val in splitter.split(vals): - if not string.strip(val): continue - entries.append(string.split(val)[0]) - if name != 'GdkCursorType': - enums.append((name, isflags, entries)) - - pos = m.end() - -# ------------------ Find function definitions ----------------- - -def clean_func(buf): - """ - Ideally would make buf have a single prototype on each line. - Actually just cuts out a good deal of junk, but leaves lines - where a regex can figure prototypes out. - """ - # bulk comments - buf = strip_comments(buf) - - # compact continued lines - pat = re.compile(r"""\\\n""", re.MULTILINE) - buf = pat.sub('', buf) - - # Preprocess directives - pat = re.compile(r"""^[#].*?$""", re.MULTILINE) - buf = pat.sub('', buf) - - #typedefs, stucts, and enums - pat = re.compile(r"""^(typedef|struct|enum)(\s|.|\n)*?;\s*""", - re.MULTILINE) - buf = pat.sub('', buf) - - #strip DECLS macros - pat = re.compile(r"""G_BEGIN_DECLS|BEGIN_LIBGTOP_DECLS""", re.MULTILINE) - buf = pat.sub('', buf) - - #extern "C" - pat = re.compile(r"""^\s*(extern)\s+\"C\"\s+{""", re.MULTILINE) - buf = pat.sub('', buf) - - #multiple whitespace - pat = re.compile(r"""\s+""", re.MULTILINE) - buf = pat.sub(' ', buf) - - #clean up line ends - pat = re.compile(r""";\s*""", re.MULTILINE) - buf = pat.sub('\n', buf) - buf = buf.lstrip() - - #associate *, &, and [] with type instead of variable - #pat = re.compile(r'\s+([*|&]+)\s*(\w+)') - pat = re.compile(r' \s* ([*|&]+) \s* (\w+)', re.VERBOSE) - buf = pat.sub(r'\1 \2', buf) - pat = re.compile(r'\s+ (\w+) \[ \s* \]', re.VERBOSE) - buf = pat.sub(r'[] \1', buf) - - # make return types that are const work. - buf = string.replace(buf, 'G_CONST_RETURN ', 'const-') - buf = string.replace(buf, 'const ', 'const-') - - return buf - -proto_pat=re.compile(r""" -(?P(-|\w|\&|\*)+\s*) # return type -\s+ # skip whitespace -(?P\w+)\s*[(] # match the function name until the opening ( -\s*(?P.*?)\s*[)] # group the function arguments -""", re.IGNORECASE|re.VERBOSE) -#""" -arg_split_pat = re.compile("\s*,\s*") - -get_type_pat = re.compile(r'(const-)?([A-Za-z0-9]+)\*?\s+') -pointer_pat = re.compile('.*\*$') -func_new_pat = re.compile('(\w+)_new$') - -class DefsWriter: - def __init__(self, fp=None, prefix=None, verbose=False, - defsfilter=None): - if not fp: - fp = sys.stdout - - self.fp = fp - self.prefix = prefix - self.verbose = verbose - - self._enums = {} - self._objects = {} - self._functions = {} - if defsfilter: - filter = defsparser.DefsParser(defsfilter) - filter.startParsing() - for func in filter.functions + filter.methods.values(): - self._functions[func.c_name] = func - for obj in filter.objects + filter.boxes + filter.interfaces: - self._objects[obj.c_name] = func - for obj in filter.enums: - self._enums[obj.c_name] = func - - def write_def(self, deffile): - buf = open(deffile).read() - - self.fp.write('\n;; From %s\n\n' % os.path.basename(deffile)) - self._define_func(buf) - self.fp.write('\n') - - def write_enum_defs(self, enums, fp=None): - if not fp: - fp = self.fp - - fp.write(';; Enumerations and flags ...\n\n') - trans = string.maketrans(string.uppercase + '_', - string.lowercase + '-') - filter = self._enums - for cname, isflags, entries in enums: - if filter: - if cname in filter: - continue - name = cname - module = None - m = split_prefix_pat.match(cname) - if m: - module = m.group(1) - name = m.group(2) - if isflags: - fp.write('(define-flags ' + name + '\n') - else: - fp.write('(define-enum ' + name + '\n') - if module: - fp.write(' (in-module "' + module + '")\n') - fp.write(' (c-name "' + cname + '")\n') - fp.write(' (gtype-id "' + typecode(cname) + '")\n') - prefix = entries[0] - for ent in entries: - # shorten prefix til we get a match ... - # and handle GDK_FONT_FONT, GDK_FONT_FONTSET case - while ent[:len(prefix)] != prefix or len(prefix) >= len(ent): - prefix = prefix[:-1] - prefix_len = len(prefix) - fp.write(' (values\n') - for ent in entries: - fp.write(' \'("%s" "%s")\n' % - (string.translate(ent[prefix_len:], trans), ent)) - fp.write(' )\n') - fp.write(')\n\n') - - def write_obj_defs(self, objdefs, fp=None): - if not fp: - fp = self.fp - - fp.write(';; -*- scheme -*-\n') - fp.write('; object definitions ...\n') - - filter = self._objects - for klass, parent in objdefs: - if filter: - if klass in filter: - continue - m = split_prefix_pat.match(klass) - cmodule = None - cname = klass - if m: - cmodule = m.group(1) - cname = m.group(2) - fp.write('(define-object ' + cname + '\n') - if cmodule: - fp.write(' (in-module "' + cmodule + '")\n') - if parent: - fp.write(' (parent "' + parent + '")\n') - fp.write(' (c-name "' + klass + '")\n') - fp.write(' (gtype-id "' + typecode(klass) + '")\n') - # should do something about accessible fields - fp.write(')\n\n') - - def _define_func(self, buf): - buf = clean_func(buf) - buf = string.split(buf,'\n') - filter = self._functions - for p in buf: - if not p: - continue - m = proto_pat.match(p) - if m == None: - if self.verbose: - sys.stderr.write('No match:|%s|\n' % p) - continue - func = m.group('func') - if func[0] == '_': - continue - if filter: - if func in filter: - continue - ret = m.group('ret') - args = m.group('args') - args = arg_split_pat.split(args) - for i in range(len(args)): - spaces = string.count(args[i], ' ') - if spaces > 1: - args[i] = string.replace(args[i], ' ', '-', spaces - 1) - - self._write_func(func, ret, args) - - def _write_func(self, name, ret, args): - if len(args) >= 1: - # methods must have at least one argument - munged_name = name.replace('_', '') - m = get_type_pat.match(args[0]) - if m: - obj = m.group(2) - if munged_name[:len(obj)] == obj.lower(): - self._write_method(obj, name, ret, args) - return - - if self.prefix: - l = len(self.prefix) - if name[:l] == self.prefix and name[l] == '_': - fname = name[l+1:] - else: - fname = name - else: - fname = name - - # it is either a constructor or normal function - self.fp.write('(define-function ' + fname + '\n') - self.fp.write(' (c-name "' + name + '")\n') - - # Hmmm... Let's asume that a constructor function name - # ends with '_new' and it returns a pointer. - m = func_new_pat.match(name) - if pointer_pat.match(ret) and m: - cname = '' - for s in m.group(1).split ('_'): - cname += s.title() - if cname != '': - self.fp.write(' (is-constructor-of "' + cname + '")\n') - - self._write_return(ret) - self._write_arguments(args) - - def _write_method(self, obj, name, ret, args): - regex = string.join(map(lambda x: x+'_?', string.lower(obj)),'') - mname = re.sub(regex, '', name, 1) - if self.prefix: - l = len(self.prefix) + 1 - if mname[:l] == self.prefix and mname[l+1] == '_': - mname = mname[l+1:] - self.fp.write('(define-method ' + mname + '\n') - self.fp.write(' (of-object "' + obj + '")\n') - self.fp.write(' (c-name "' + name + '")\n') - self._write_return(ret) - self._write_arguments(args[1:]) - - def _write_return(self, ret): - if ret != 'void': - self.fp.write(' (return-type "' + ret + '")\n') - else: - self.fp.write(' (return-type "none")\n') - - def _write_arguments(self, args): - is_varargs = 0 - has_args = len(args) > 0 - for arg in args: - if arg == '...': - is_varargs = 1 - elif arg in ('void', 'void '): - has_args = 0 - if has_args: - self.fp.write(' (parameters\n') - for arg in args: - if arg != '...': - tupleArg = tuple(string.split(arg)) - if len(tupleArg) == 2: - self.fp.write(' \'("%s" "%s")\n' % tupleArg) - self.fp.write(' )\n') - if is_varargs: - self.fp.write(' (varargs #t)\n') - self.fp.write(')\n\n') - -# ------------------ Main function ----------------- - -def main(args): - verbose = False - onlyenums = False - onlyobjdefs = False - separate = False - modulename = None - defsfilter = None - opts, args = getopt.getopt(args[1:], 'vs:m:f:', - ['onlyenums', 'onlyobjdefs', - 'modulename=', 'separate=', - 'defsfilter=']) - for o, v in opts: - if o == '-v': - verbose = True - if o == '--onlyenums': - onlyenums = True - if o == '--onlyobjdefs': - onlyobjdefs = True - if o in ('-s', '--separate'): - separate = v - if o in ('-m', '--modulename'): - modulename = v - if o in ('-f', '--defsfilter'): - defsfilter = v - - if not args[0:1]: - print 'Must specify at least one input file name' - return -1 - - # read all the object definitions in - objdefs = [] - enums = [] - for filename in args: - buf = open(filename).read() - find_obj_defs(buf, objdefs) - find_enum_defs(buf, enums) - objdefs = sort_obj_defs(objdefs) - - if separate: - methods = file(separate + '.defs', 'w') - types = file(separate + '-types.defs', 'w') - - dw = DefsWriter(methods, prefix=modulename, verbose=verbose, - defsfilter=defsfilter) - dw.write_obj_defs(objdefs, types) - dw.write_enum_defs(enums, types) - print "Wrote %s-types.defs" % separate - - for filename in args: - dw.write_def(filename) - print "Wrote %s.defs" % separate - else: - dw = DefsWriter(prefix=modulename, verbose=verbose, - defsfilter=defsfilter) - - if onlyenums: - dw.write_enum_defs(enums) - elif onlyobjdefs: - dw.write_obj_defs(objdefs) - else: - dw.write_obj_defs(objdefs) - dw.write_enum_defs(enums) - - for filename in args: - dw.write_def(filename) - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/codegen/mergedefs.py b/codegen/mergedefs.py deleted file mode 100755 index 773e499bb0..0000000000 --- a/codegen/mergedefs.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; py-indent-offset: 4 -*- - -import optparse - -import defsparser - -parser = optparse.OptionParser( - usage="usage: %prog [options] generated-defs old-defs") -parser.add_option("-p", "--merge-parameters", - help="Merge changes in function/methods parameter lists", - action="store_true", dest="parmerge", default=False) -(options, args) = parser.parse_args() - -if len(args) != 2: - parser.error("wrong number of arguments") - -newp = defsparser.DefsParser(args[0]) -oldp = defsparser.DefsParser(args[1]) - -newp.startParsing() -oldp.startParsing() - -newp.merge(oldp, options.parmerge) - -newp.write_defs() diff --git a/codegen/mkskel.py b/codegen/mkskel.py deleted file mode 100755 index 61f520bf73..0000000000 --- a/codegen/mkskel.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; py-indent-offset: 4 -*- - -import sys, os, getopt - -module_init_template = \ -'/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + \ -'#ifdef HAVE_CONFIG_H\n' + \ -'# include "config.h"\n' + \ -'#endif\n' + \ -'#include \n' + \ -'#include \n' + \ -'\n' + \ -'/* include any extra headers needed here */\n' + \ -'\n' + \ -'void %(prefix)s_register_classes(PyObject *d);\n' + \ -'extern PyMethodDef %(prefix)s_functions[];\n' + \ -'\n' + \ -'DL_EXPORT(void)\n' + \ -'init%(module)s(void)\n' + \ -'{\n' + \ -' PyObject *m, *d;\n' + \ -'\n' + \ -' /* perform any initialisation required by the library here */\n' + \ -'\n' + \ -' m = Py_InitModule("%(module)s", %(prefix)s_functions);\n' + \ -' d = PyModule_GetDict(m);\n' + \ -'\n' + \ -' init_pygtk();\n' + \ -'\n' + \ -' %(prefix)s_register_classes(d);\n' + \ -'\n' + \ -' /* add anything else to the module dictionary (such as constants) */\n' +\ -'\n' + \ -' if (PyErr_Occurred())\n' + \ -' Py_FatalError("could not initialise module %(module)s");\n' + \ -'}\n' - -override_template = \ -'/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + \ -'%%%%\n' + \ -'headers\n' + \ -'/* include any required headers here */\n' + \ -'%%%%\n' + \ -'init\n' + \ -' /* include any code here that needs to be executed before the\n' + \ -' * extension classes get initialised */\n' + \ -'%%%%\n' + \ -'\n' + \ -'/* you should add appropriate ignore, ignore-glob and\n' + \ -' * override sections here */\n' - -def open_with_backup(file): - if os.path.exists(file): - try: - os.rename(file, file+'~') - except OSError: - # fail silently if we can't make a backup - pass - return open(file, 'w') - -def write_skels(fileprefix, prefix, module): - fp = open_with_backup(fileprefix+'module.c') - fp.write(module_init_template % { 'prefix': prefix, 'module': module }) - fp.close() - fp = open_with_backup(fileprefix+'.override') - fp.write(override_template % { 'prefix': prefix, 'module': module }) - fp.close() - -if __name__ == '__main__': - opts, args = getopt.getopt(sys.argv[1:], 'f:p:m:h', - ['file-prefix=', 'prefix=', 'module=', 'help']) - fileprefix = None - prefix = None - module = None - for opt, arg in opts: - if opt in ('-f', '--file-prefix'): - fileprefix = arg - elif opt in ('-p', '--prefix'): - prefix = arg - elif opt in ('-m', '--module'): - module = arg - elif opt in ('-h', '--help'): - print 'usage: mkskel.py -f fileprefix -p prefix -m module' - sys.exit(0) - if not fileprefix or not prefix or not module: - print 'usage: mkskel.py -f fileprefix -p prefix -m module' - sys.exit(1) - write_skels(fileprefix, prefix, module) diff --git a/codegen/override.py b/codegen/override.py deleted file mode 100644 index c5932eef27..0000000000 --- a/codegen/override.py +++ /dev/null @@ -1,290 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- - -# this file contains code for loading up an override file. The override file -# provides implementations of functions where the code generator could not -# do its job correctly. - -import fnmatch -import os -import re -import string -import sys - -def class2cname(klass, method): - c_name = '' - for c in klass: - if c.isupper(): - c_name += '_' + c.lower() - else: - c_name += c - return c_name[1:] + '_' + method - -import_pat = re.compile(r'\s*import\s+(\S+)\.([^\s.]+)\s+as\s+(\S+)') - -class Overrides: - def __init__(self, filename=None, path=[]): - self.modulename = None - self.ignores = {} - self.glob_ignores = [] - self.type_ignores = {} - self.overrides = {} - self.overridden = {} - self.kwargs = {} - self.noargs = {} - self.onearg = {} - self.staticmethod = {} - self.classmethod = {} - self.startlines = {} - self.override_attrs = {} - self.override_slots = {} - self.headers = '' - self.body = '' - self.init = '' - self.imports = [] - self.defines = {} - self.functions = {} - self.newstyle_constructors = {} - self.path = [os.path.abspath(x) for x in path] - if filename: - self.handle_file(filename) - - def handle_file(self, filename): - oldpath = os.getcwd() - - fp = None - for path in self.path: - os.chdir(oldpath) - os.chdir(path) - try: - fp = open(filename, 'r') - break - except: - os.chdir(oldpath) - if not fp: - raise Exception, "Couldn't find file %s" % filename - - dirname = path - - if dirname != oldpath: - os.chdir(dirname) - - # read all the components of the file ... - bufs = [] - startline = 1 - lines = [] - line = fp.readline() - linenum = 1 - while line: - if line == '%%\n' or line == '%%': - if lines: - bufs.append((string.join(lines, ''), startline)) - startline = linenum + 1 - lines = [] - else: - lines.append(line) - line = fp.readline() - linenum = linenum + 1 - if lines: - bufs.append((string.join(lines, ''), startline)) - if not bufs: return - - for buf, startline in bufs: - self.__parse_override(buf, startline, filename) - - os.chdir(oldpath) - - def __parse_override(self, buffer, startline, filename): - pos = string.find(buffer, '\n') - if pos >= 0: - line = buffer[:pos] - rest = buffer[pos+1:] - else: - line = buffer ; rest = '' - words = string.split(line) - if len(words) == 0: - return - command = words[0] - if (command == 'ignore' or - command == 'ignore-' + sys.platform): - "ignore/ignore-platform [functions..]" - for func in words[1:]: - self.ignores[func] = 1 - for func in string.split(rest): - self.ignores[func] = 1 - elif (command == 'ignore-glob' or - command == 'ignore-glob-' + sys.platform): - "ignore-glob/ignore-glob-platform [globs..]" - for func in words[1:]: - self.glob_ignores.append(func) - for func in string.split(rest): - self.glob_ignores.append(func) - elif (command == 'ignore-type' or - command == 'ignore-type-' + sys.platform): - "ignore-type/ignore-type-platform [typenames..]" - for typename in words[1:]: - self.type_ignores[typename] = 1 - for typename in string.split(rest): - self.type_ignores[typename] = 1 - elif command == 'override': - "override function/method [kwargs|noargs|onearg] [staticmethod|classmethod]" - func = words[1] - if 'kwargs' in words[1:]: - self.kwargs[func] = 1 - elif 'noargs' in words[1:]: - self.noargs[func] = 1 - elif 'onearg' in words[1:]: - self.onearg[func] = True - - if 'staticmethod' in words[1:]: - self.staticmethod[func] = True - elif 'classmethod' in words[1:]: - self.classmethod[func] = True - if func in self.overrides: - raise RuntimeError("Function %s is being overridden more than once" % (func,)) - self.overrides[func] = rest - self.startlines[func] = (startline + 1, filename) - elif command == 'override-attr': - "override-slot Class.attr" - attr = words[1] - self.override_attrs[attr] = rest - self.startlines[attr] = (startline + 1, filename) - elif command == 'override-slot': - "override-slot Class.slot" - slot = words[1] - self.override_slots[slot] = rest - self.startlines[slot] = (startline + 1, filename) - elif command == 'headers': - "headers" - self.headers = '%s\n#line %d "%s"\n%s' % \ - (self.headers, startline + 1, filename, rest) - elif command == 'body': - "body" - self.body = '%s\n#line %d "%s"\n%s' % \ - (self.body, startline + 1, filename, rest) - elif command == 'init': - "init" - self.init = '%s\n#line %d "%s"\n%s' % \ - (self.init, startline + 1, filename, rest) - elif command == 'modulename': - "modulename name" - self.modulename = words[1] - elif command == 'include': - "include filename" - for filename in words[1:]: - self.handle_file(filename) - for filename in string.split(rest): - self.handle_file(filename) - elif command == 'import': - "import module1 [\n module2, \n module3 ...]" - for line in string.split(buffer, '\n'): - match = import_pat.match(line) - if match: - self.imports.append(match.groups()) - elif command == 'define': - "define funcname [kwargs|noargs|onearg] [classmethod|staticmethod]" - "define Class.method [kwargs|noargs|onearg] [classmethod|staticmethod]" - func = words[1] - klass = None - if func.find('.') != -1: - klass, func = func.split('.', 1) - - if not self.defines.has_key(klass): - self.defines[klass] = {} - self.defines[klass][func] = rest - else: - self.functions[func] = rest - - if 'kwargs' in words[1:]: - self.kwargs[func] = 1 - elif 'noargs' in words[1:]: - self.noargs[func] = 1 - elif 'onearg' in words[1:]: - self.onearg[func] = 1 - - if 'staticmethod' in words[1:]: - self.staticmethod[func] = True - elif 'classmethod' in words[1:]: - self.classmethod[func] = True - - self.startlines[func] = (startline + 1, filename) - - elif command == 'new-constructor': - "new-constructor GType" - gtype, = words[1:] - self.newstyle_constructors[gtype] = True - - def is_ignored(self, name): - if self.ignores.has_key(name): - return 1 - for glob in self.glob_ignores: - if fnmatch.fnmatchcase(name, glob): - return 1 - return 0 - - def is_type_ignored(self, name): - return name.rstrip('*') in self.type_ignores - - def is_overriden(self, name): - return self.overrides.has_key(name) - - def is_already_included(self, name): - return self.overridden.has_key(name) - - def override(self, name): - self.overridden[name] = 1 - return self.overrides[name] - - def define(self, klass, name): - self.overridden[class2cname(klass, name)] = 1 - return self.defines[klass][name] - - def function(self, name): - return self.functions[name] - - def getstartline(self, name): - return self.startlines[name] - - def wants_kwargs(self, name): - return self.kwargs.has_key(name) - - def wants_noargs(self, name): - return self.noargs.has_key(name) - - def wants_onearg(self, name): - return self.onearg.has_key(name) - - def is_staticmethod(self, name): - return self.staticmethod.has_key(name) - - def is_classmethod(self, name): - return self.classmethod.has_key(name) - - def attr_is_overriden(self, attr): - return self.override_attrs.has_key(attr) - - def attr_override(self, attr): - return self.override_attrs[attr] - - def slot_is_overriden(self, slot): - return self.override_slots.has_key(slot) - - def slot_override(self, slot): - return self.override_slots[slot] - - def get_headers(self): - return self.headers - - def get_body(self): - return self.body - - def get_init(self): - return self.init - - def get_imports(self): - return self.imports - - def get_defines_for(self, klass): - return self.defines.get(klass, {}) - - def get_functions(self): - return self.functions diff --git a/codegen/reversewrapper.py b/codegen/reversewrapper.py deleted file mode 100644 index f528828ef1..0000000000 --- a/codegen/reversewrapper.py +++ /dev/null @@ -1,771 +0,0 @@ -### -*- python -*- -### Code to generate "Reverse Wrappers", i.e. C->Python wrappers -### (C) 2004 Gustavo Carneiro -import argtypes -import os - -DEBUG_MODE = ('PYGTK_CODEGEN_DEBUG' in os.environ) - -def join_ctype_name(ctype, name): - '''Joins a C type and a variable name into a single string''' - if ctype[-1] != '*': - return " ".join((ctype, name)) - else: - return "".join((ctype, name)) - - -class CodeSink(object): - def __init__(self): - self.indent_level = 0 # current indent level - self.indent_stack = [] # previous indent levels - - def _format_code(self, code): - assert isinstance(code, str) - l = [] - for line in code.split('\n'): - l.append(' '*self.indent_level + line) - if l[-1]: - l.append('') - return '\n'.join(l) - - def writeln(self, line=''): - raise NotImplementedError - - def indent(self, level=4): - '''Add a certain ammount of indentation to all lines written - from now on and until unindent() is called''' - self.indent_stack.append(self.indent_level) - self.indent_level += level - - def unindent(self): - '''Revert indentation level to the value before last indent() call''' - self.indent_level = self.indent_stack.pop() - - -class FileCodeSink(CodeSink): - def __init__(self, fp): - CodeSink.__init__(self) - assert isinstance(fp, file) - self.fp = fp - - def writeln(self, line=''): - self.fp.write(self._format_code(line)) - -class MemoryCodeSink(CodeSink): - def __init__(self): - CodeSink.__init__(self) - self.lines = [] - - def writeln(self, line=''): - self.lines.append(self._format_code(line)) - - def flush_to(self, sink): - assert isinstance(sink, CodeSink) - for line in self.lines: - sink.writeln(line.rstrip()) - self.lines = [] - - def flush(self): - l = [] - for line in self.lines: - l.append(self._format_code(line)) - self.lines = [] - return "".join(l) - -class ReverseWrapper(object): - '''Object that generates a C->Python wrapper''' - def __init__(self, cname, is_static=True): - assert isinstance(cname, str) - - self.cname = cname - ## function object we will call, or object whose method we will call - self.called_pyobj = None - ## name of method of self.called_pyobj we will call - self.method_name = None - self.is_static = is_static - - self.parameters = [] - self.declarations = MemoryCodeSink() - self.post_return_code = MemoryCodeSink() - self.body = MemoryCodeSink() - self.cleanup_actions = [] - self.pyargv_items = [] - self.pyargv_optional_items = [] - self.pyret_parse_items = [] # list of (format_spec, parameter) - - def set_call_target(self, called_pyobj, method_name=None): - assert called_pyobj is not None - assert self.called_pyobj is None - self.called_pyobj = called_pyobj - self.method_name = method_name - - def set_return_type(self, return_type): - assert isinstance(return_type, ReturnType) - self.return_type = return_type - - def add_parameter(self, param): - assert isinstance(param, Parameter) - self.parameters.append(param) - - def add_declaration(self, decl_code): - self.declarations.writeln(decl_code) - - def add_pyargv_item(self, variable, optional=False): - if optional: - self.pyargv_optional_items.append(variable) - else: - self.pyargv_items.append(variable) - - def add_pyret_parse_item(self, format_specifier, parameter, prepend=False): - if prepend: - self.pyret_parse_items.insert(0, (format_specifier, parameter)) - else: - self.pyret_parse_items.append((format_specifier, parameter)) - - def write_code(self, code, - cleanup=None, - failure_expression=None, - failure_cleanup=None, - failure_exception=None, - code_sink=None): - '''Add a chunk of code with cleanup and error handling - - This method is to be used by TypeHandlers when generating code - - Keywork arguments: - code -- code to add - cleanup -- code to cleanup any dynamic resources created by @code - (except in case of failure) (default None) - failure_expression -- C boolean expression to indicate - if anything failed (default None) - failure_cleanup -- code to cleanup any dynamic resources - created by @code in case of failure (default None) - failure_exception -- code to raise an exception in case of - failure (which will be immediately - printed and cleared), (default None) - code_sink -- "code sink" to use; by default, - ReverseWrapper.body is used, which writes the - main body of the wrapper, before calling the - python method. Alternatively, - ReverseWrapper.after_pyret_parse can be used, to - write code after the PyArg_ParseTuple that - parses the python method return value. - ''' - if code_sink is None: - code_sink = self.body - if code is not None: - code_sink.writeln(code) - if failure_expression is not None: - code_sink.writeln("if (%s) {" % (failure_expression,)) - code_sink.indent() - if failure_exception is None: - code_sink.writeln("if (PyErr_Occurred())") - code_sink.indent() - code_sink.writeln("PyErr_Print();") - code_sink.unindent() - else: - code_sink.writeln(failure_exception) - code_sink.writeln("PyErr_Print();") - if failure_cleanup is not None: - code_sink.writeln(failure_cleanup) - for cleanup_action in self.cleanup_actions: - code_sink.writeln(cleanup_action) - self.return_type.write_error_return() - code_sink.unindent() - code_sink.writeln("}") - if cleanup is not None: - self.cleanup_actions.insert(0, cleanup) - - def generate(self, sink): - '''Generate the code into a CodeSink object''' - assert isinstance(sink, CodeSink) - - if DEBUG_MODE: - self.declarations.writeln("/* begin declarations */") - self.body.writeln("/* begin main body */") - self.post_return_code.writeln("/* begin post-return code */") - - self.add_declaration("PyGILState_STATE __py_state;") - self.write_code(code="__py_state = pyg_gil_state_ensure();", - cleanup="pyg_gil_state_release(__py_state);") - - for param in self.parameters: - param.convert_c2py() - - assert self.called_pyobj is not None,\ - "Parameters failed to provide a target function or method." - - if self.is_static: - sink.writeln('static %s' % self.return_type.get_c_type()) - else: - sink.writeln(self.return_type.get_c_type()) - c_proto_params = map(Parameter.format_for_c_proto, self.parameters) - sink.writeln("%s(%s)\n{" % (self.cname, ", ".join(c_proto_params))) - - self.return_type.write_decl() - self.add_declaration("PyObject *py_retval;") - - ## Handle number of arguments - if self.pyargv_items: - self.add_declaration("PyObject *py_args;") - py_args = "py_args" - if self.pyargv_optional_items: - self.add_declaration("int argc = %i;" % len(self.pyargv_items)) - argc = "argc" - for arg in self.pyargv_optional_items: - self.body.writeln("if (%s)" % arg) - self.body.indent() - self.body.writeln("++argc;") - self.body.unindent() - else: - argc = str(len(self.pyargv_items)) - else: - if self.pyargv_optional_items: - self.add_declaration("PyObject *py_args;") - py_args = "py_args" - self.add_declaration("int argc = 0;") - argc = "argc" - for arg in self.pyargv_optional_items: - self.body.writeln("if (%s)" % arg) - self.body.indent() - self.body.writeln("++argc;") - self.body.unindent() - else: - py_args = "NULL" - argc = None - - self.body.writeln() - - if py_args != "NULL": - self.write_code("py_args = PyTuple_New(%s);" % argc, - cleanup="Py_DECREF(py_args);") - pos = 0 - for arg in self.pyargv_items: - try: # try to remove the Py_DECREF cleanup action, if we can - self.cleanup_actions.remove("Py_DECREF(%s);" % arg) - except ValueError: # otherwise we have to Py_INCREF.. - self.body.writeln("Py_INCREF(%s);" % arg) - self.body.writeln("PyTuple_SET_ITEM(%s, %i, %s);" % (py_args, pos, arg)) - pos += 1 - for arg in self.pyargv_optional_items: - self.body.writeln("if (%s) {" % arg) - self.body.indent() - try: # try to remove the Py_DECREF cleanup action, if we can - self.cleanup_actions.remove("Py_XDECREF(%s);" % arg) - except ValueError: # otherwise we have to Py_INCREF.. - self.body.writeln("Py_INCREF(%s);" % arg) - self.body.writeln("PyTuple_SET_ITEM(%s, %i, %s);" % (py_args, pos, arg)) - self.body.unindent() - self.body.writeln("}") - pos += 1 - - self.body.writeln() - - ## Call the python method - if self.method_name is None: - self.write_code("py_retval = PyObject_Call(%s, %s);" - % (self.called_pyobj, py_args), - cleanup="Py_DECREF(py_retval);", - failure_expression="!py_retval") - else: - self.add_declaration("PyObject *py_method;") - self.write_code("py_method = PyObject_GetAttrString(%s, \"%s\");" - % (self.called_pyobj, self.method_name), - cleanup="Py_DECREF(py_method);", - failure_expression="!py_method") - self.write_code("py_retval = PyObject_CallObject(py_method, %s);" - % (py_args,), - cleanup="Py_DECREF(py_retval);", - failure_expression="!py_retval") - - ## -- Handle the return value -- - - ## we need to check if the return_type object is prepared to cooperate with multiple return values - len_before = len(self.pyret_parse_items) - self.return_type.write_conversion() - len_after = len(self.pyret_parse_items) - assert (self.return_type.get_c_type() == 'void' - or not (len_before == len_after and len_after > 0)),\ - ("Bug in reverse wrappers: return type handler %s" - " is not prepared to cooperate multiple return values") % (type(self.return_type),) - - sink.indent() - - if len(self.pyret_parse_items) == 1: - ## if retval is one item only, pack it in a tuple so we - ## can use PyArg_ParseTuple as usual.. - self.write_code('py_retval = Py_BuildValue("(N)", py_retval);') - if len(self.pyret_parse_items) > 0: - ## Parse return values using PyArg_ParseTuple - self.write_code(code=None, failure_expression=( - '!PyArg_ParseTuple(py_retval, "%s", %s)' % ( - "".join([format for format, param in self.pyret_parse_items]), - ", ".join([param for format, param in self.pyret_parse_items])))) - - if DEBUG_MODE: - self.declarations.writeln("/* end declarations */") - self.declarations.flush_to(sink) - sink.writeln() - if DEBUG_MODE: - self.body.writeln("/* end main body */") - self.body.flush_to(sink) - sink.writeln() - if DEBUG_MODE: - self.post_return_code.writeln("/* end post-return code */") - self.post_return_code.flush_to(sink) - sink.writeln() - - for cleanup_action in self.cleanup_actions: - sink.writeln(cleanup_action) - if self.return_type.get_c_type() != 'void': - sink.writeln() - sink.writeln("return retval;") - sink.unindent() - sink.writeln("}") - -class TypeHandler(object): - def __init__(self, wrapper, **props): - assert isinstance(wrapper, ReverseWrapper) - self.wrapper = wrapper - self.props = props - -class ReturnType(TypeHandler): - - def get_c_type(self): - raise NotImplementedError - - def write_decl(self): - raise NotImplementedError - - def write_error_return(self): - '''Write "return " code in case of error''' - raise NotImplementedError - - def write_conversion(self): - '''Writes code to convert Python return value in 'py_retval' - into C 'retval'. Returns a string with C boolean expression - that determines if anything went wrong. ''' - raise NotImplementedError - -class Parameter(TypeHandler): - - def __init__(self, wrapper, name, **props): - TypeHandler.__init__(self, wrapper, **props) - self.name = name - - def get_c_type(self): - raise NotImplementedError - - def convert_c2py(self): - '''Write some code before calling the Python method.''' - pass - - def format_for_c_proto(self): - return join_ctype_name(self.get_c_type(), self.name) - - -###--- -class StringParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'char *').replace('const-', 'const ') - - def convert_c2py(self): - if self.props.get('optional', False): - self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) - self.wrapper.write_code(code=("if (%s)\n" - " py_%s = PyString_FromString(%s);\n" - % (self.name, self.name, self.name)), - cleanup=("Py_XDECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name, optional=True) - else: - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyString_FromString(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name), - failure_expression=("!py_%s" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -for ctype in ('char*', 'gchar*', 'const-char*', 'char-const*', 'const-gchar*', - 'gchar-const*', 'string', 'static_string'): - argtypes.matcher.register_reverse(ctype, StringParam) -del ctype - -class StringReturn(ReturnType): - - def get_c_type(self): - return "char *" - - def write_decl(self): - self.wrapper.add_declaration("char *retval;") - - def write_error_return(self): - self.wrapper.write_code("return NULL;") - - def write_conversion(self): - self.wrapper.add_pyret_parse_item("s", "&retval", prepend=True) - self.wrapper.write_code("retval = g_strdup(retval);", code_sink=self.wrapper.post_return_code) - -for ctype in ('char*', 'gchar*'): - argtypes.matcher.register_reverse_ret(ctype, StringReturn) -del ctype - - -class VoidReturn(ReturnType): - - def get_c_type(self): - return "void" - - def write_decl(self): - pass - - def write_error_return(self): - self.wrapper.write_code("return;") - - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="py_retval != Py_None", - failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be None");') - -argtypes.matcher.register_reverse_ret('void', VoidReturn) -argtypes.matcher.register_reverse_ret('none', VoidReturn) - -class GObjectParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'GObject *') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) - self.wrapper.write_code(code=("if (%s)\n" - " py_%s = pygobject_new((GObject *) %s);\n" - "else {\n" - " Py_INCREF(Py_None);\n" - " py_%s = Py_None;\n" - "}" - % (self.name, self.name, self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse('GObject*', GObjectParam) - -class GObjectReturn(ReturnType): - - def get_c_type(self): - return self.props.get('c_type', 'GObject *') - - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - - def write_error_return(self): - self.wrapper.write_code("return NULL;") - - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="!PyObject_TypeCheck(py_retval, &PyGObject_Type)", - failure_exception='PyErr_SetString(PyExc_TypeError, "retval should be a GObject");') - self.wrapper.write_code("retval = (%s) pygobject_get(py_retval);" - % self.get_c_type()) - self.wrapper.write_code("g_object_ref((GObject *) retval);") - -argtypes.matcher.register_reverse_ret('GObject*', GObjectReturn) - - - -class IntParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'int') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyInt_FromLong(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -class IntReturn(ReturnType): - def get_c_type(self): - return self.props.get('c_type', 'int') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return -G_MAXINT;") - def write_conversion(self): - self.wrapper.add_pyret_parse_item("i", "&retval", prepend=True) - -for argtype in ('int', 'gint', 'guint', 'short', 'gshort', 'gushort', 'long', - 'glong', 'gsize', 'gssize', 'guint8', 'gint8', 'guint16', - 'gint16', 'gint32', 'GTime'): - argtypes.matcher.register_reverse(argtype, IntParam) - argtypes.matcher.register_reverse_ret(argtype, IntReturn) -del argtype - -class IntPtrParam(Parameter): - def __init__(self, wrapper, name, **props): - if "direction" not in props: - raise ValueError("cannot use int* parameter without direction") - if props["direction"] not in ("out", "inout"): - raise ValueError("cannot use int* parameter with direction '%s'" % (props["direction"],)) - Parameter.__init__(self, wrapper, name, **props) - def get_c_type(self): - return self.props.get('c_type', 'int*') - def convert_c2py(self): - if self.props["direction"] == "inout": - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyInt_FromLong(*%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - self.wrapper.add_pyret_parse_item("i", self.name) -for argtype in ('int*', 'gint*'): - argtypes.matcher.register_reverse(argtype, IntPtrParam) -del argtype - - -class GEnumReturn(IntReturn): - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression=("pyg_enum_get_value(%s, py_retval, (gint *)&retval)" % - self.props['typecode'])) - -argtypes.matcher.register_reverse_ret("GEnum", GEnumReturn) - -class GEnumParam(IntParam): - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = pyg_enum_from_gtype(%s, %s);" % - (self.name, self.props['typecode'], self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name), - failure_expression=("!py_%s" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("GEnum", GEnumParam) - -class GFlagsReturn(IntReturn): - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression=("pyg_flags_get_value(%s, py_retval, (gint *)&retval)" % - self.props['typecode'])) - -argtypes.matcher.register_reverse_ret("GFlags", GFlagsReturn) - -class GFlagsParam(IntParam): - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = pyg_flags_from_gtype(%s, %s);" % - (self.name, self.props['typecode'], self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name), - failure_expression=("!py_%s" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("GFlags", GFlagsParam) - - -class GtkTreePathParam(IntParam): - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = pygtk_tree_path_to_pyobject(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name), - failure_expression=("!py_%s" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("GtkTreePath*", GtkTreePathParam) - - -class BooleanReturn(ReturnType): - def get_c_type(self): - return "gboolean" - def write_decl(self): - self.wrapper.add_declaration("gboolean retval;") - self.wrapper.add_declaration("PyObject *py_main_retval;") - def write_error_return(self): - self.wrapper.write_code("return FALSE;") - def write_conversion(self): - self.wrapper.add_pyret_parse_item("O", "&py_main_retval", prepend=True) - self.wrapper.write_code("retval = PyObject_IsTrue(py_main_retval)? TRUE : FALSE;", - code_sink=self.wrapper.post_return_code) -argtypes.matcher.register_reverse_ret("gboolean", BooleanReturn) - -class BooleanParam(Parameter): - def get_c_type(self): - return "gboolean" - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code("py_%s = %s? Py_True : Py_False;" - % (self.name, self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("gboolean", BooleanParam) - - -class DoubleParam(Parameter): - def get_c_type(self): - return self.props.get('c_type', 'gdouble') - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyFloat_FromDouble(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -class DoublePtrParam(Parameter): - def __init__(self, wrapper, name, **props): - if "direction" not in props: - raise ValueError("cannot use double* parameter without direction") - if props["direction"] not in ("out", ): # inout not yet implemented - raise ValueError("cannot use double* parameter with direction '%s'" % (props["direction"],)) - Parameter.__init__(self, wrapper, name, **props) - def get_c_type(self): - return self.props.get('c_type', 'double*') - def convert_c2py(self): - self.wrapper.add_pyret_parse_item("d", self.name) -for argtype in ('double*', 'gdouble*'): - argtypes.matcher.register_reverse(argtype, DoublePtrParam) -del argtype - -class DoubleReturn(ReturnType): - def get_c_type(self): - return self.props.get('c_type', 'gdouble') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return -G_MAXFLOAT;") - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="!PyFloat_AsDouble(py_retval)", - failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be a float");') - self.wrapper.write_code("retval = PyFloat_AsDouble(py_retval);") - -for argtype in ('float', 'double', 'gfloat', 'gdouble'): - argtypes.matcher.register_reverse(argtype, DoubleParam) - argtypes.matcher.register_reverse_ret(argtype, DoubleReturn) - - -class GBoxedParam(Parameter): - def get_c_type(self): - return self.props.get('c_type').replace('const-', 'const ') - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - ctype = self.get_c_type() - if ctype.startswith('const '): - ctype_no_const = ctype[len('const '):] - self.wrapper.write_code( - code=('py_%s = pyg_boxed_new(%s, (%s) %s, TRUE, TRUE);' % - (self.name, self.props['typecode'], - ctype_no_const, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - else: - self.wrapper.write_code( - code=('py_%s = pyg_boxed_new(%s, %s, FALSE, FALSE);' % - (self.name, self.props['typecode'], self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("GBoxed", GBoxedParam) - -class GBoxedReturn(ReturnType): - def get_c_type(self): - return self.props.get('c_type') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return retval;") - def write_conversion(self): - self.wrapper.write_code( - failure_expression=("!pyg_boxed_check(py_retval, %s)" % - (self.props['typecode'],)), - failure_cleanup=('PyErr_SetString(PyExc_TypeError, "retval should be a %s");' - % (self.props['typename'],))) - self.wrapper.write_code('retval = pyg_boxed_get(py_retval, %s);' % - self.props['typename']) - -argtypes.matcher.register_reverse_ret("GBoxed", GBoxedReturn) - - -class GdkRectanglePtrParam(Parameter): - def get_c_type(self): - return self.props.get('c_type').replace('const-', 'const ') - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code( - code=('py_%s = pyg_boxed_new(GDK_TYPE_RECTANGLE, %s, TRUE, TRUE);' % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -argtypes.matcher.register_reverse("GdkRectangle*", GdkRectanglePtrParam) -argtypes.matcher.register_reverse('GtkAllocation*', GdkRectanglePtrParam) - - -class PyGObjectMethodParam(Parameter): - def __init__(self, wrapper, name, method_name, **props): - Parameter.__init__(self, wrapper, name, **props) - self.method_name = method_name - - def get_c_type(self): - return self.props.get('c_type', 'GObject *') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = pygobject_new((GObject *) %s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name), - failure_expression=("!py_%s" % self.name)) - self.wrapper.set_call_target("py_%s" % self.name, self.method_name) - -class CallbackInUserDataParam(Parameter): - def __init__(self, wrapper, name, free_it, **props): - Parameter.__init__(self, wrapper, name, **props) - self.free_it = free_it - - def get_c_type(self): - return "gpointer" - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject **_user_data;") - cleanup = self.free_it and ("g_free(%s);" % self.name) or None - self.wrapper.write_code(code=("_real_user_data = (PyObject **) %s;" - % self.name), - cleanup=cleanup) - - self.wrapper.add_declaration("PyObject *py_func;") - cleanup = self.free_it and "Py_DECREF(py_func);" or None - self.wrapper.write_code(code="py_func = _user_data[0];", - cleanup=cleanup) - self.wrapper.set_call_target("py_func") - - self.wrapper.add_declaration("PyObject *py_user_data;") - cleanup = self.free_it and "Py_XDECREF(py_user_data);" or None - self.wrapper.write_code(code="py_user_data = _user_data[1];", - cleanup=cleanup) - self.wrapper.add_pyargv_item("py_user_data", optional=True) - -def _test(): - import sys - - if 1: - wrapper = ReverseWrapper("this_is_the_c_function_name", is_static=True) - wrapper.set_return_type(StringReturn(wrapper)) - wrapper.add_parameter(PyGObjectMethodParam(wrapper, "self", method_name="do_xxx")) - wrapper.add_parameter(StringParam(wrapper, "param2", optional=True)) - wrapper.add_parameter(GObjectParam(wrapper, "param3")) - #wrapper.add_parameter(InoutIntParam(wrapper, "param4")) - wrapper.generate(FileCodeSink(sys.stderr)) - - if 0: - wrapper = ReverseWrapper("this_a_callback_wrapper") - wrapper.set_return_type(VoidReturn(wrapper)) - wrapper.add_parameter(StringParam(wrapper, "param1", optional=False)) - wrapper.add_parameter(GObjectParam(wrapper, "param2")) - wrapper.add_parameter(CallbackInUserDataParam(wrapper, "data", free_it=True)) - wrapper.generate(FileCodeSink(sys.stderr)) - -if __name__ == '__main__': - _test() diff --git a/codegen/scmexpr.py b/codegen/scmexpr.py deleted file mode 100644 index d08c517adb..0000000000 --- a/codegen/scmexpr.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python; py-indent-offset: 4 -*- -from __future__ import generators - -import string -import types -from cStringIO import StringIO - -class error(Exception): - def __init__(self, filename, lineno, msg): - Exception.__init__(self, msg) - self.filename = filename - self.lineno = lineno - self.msg = msg - def __str__(self): - return '%s:%d: error: %s' % (self.filename, self.lineno, self.msg) - -trans = [' '] * 256 -for i in range(256): - if chr(i) in string.letters + string.digits + '_': - trans[i] = chr(i) - else: - trans[i] = '_' -trans = string.join(trans, '') - -def parse(filename): - if isinstance(filename, str): - fp = open(filename, 'r') - else: # if not string, assume it is some kind of iterator - fp = filename - filename = getattr(fp, 'name', '') - whitespace = ' \t\n\r\x0b\x0c' - nonsymbol = whitespace + '();\'"' - stack = [] - openlines = [] - lineno = 0 - for line in fp: - pos = 0 - lineno += 1 - while pos < len(line): - if line[pos] in whitespace: # ignore whitespace - pass - elif line[pos] == ';': # comment - break - elif line[pos:pos+2] == "'(": - pass # the open parenthesis will be handled next iteration - elif line[pos] == '(': - stack.append(()) - openlines.append(lineno) - elif line[pos] == ')': - if len(stack) == 0: - raise error(filename, lineno, 'close parenthesis found when none open') - closed = stack[-1] - del stack[-1] - del openlines[-1] - if stack: - stack[-1] += (closed,) - else: - yield closed - elif line[pos] == '"': # quoted string - if not stack: - raise error(filename, lineno, - 'string found outside of s-expression') - endpos = pos + 1 - chars = [] - while endpos < len(line): - if endpos+1 < len(line) and line[endpos] == '\\': - endpos += 1 - if line[endpos] == 'n': - chars.append('\n') - elif line[endpos] == 'r': - chars.append('\r') - elif line[endpos] == 't': - chars.append('\t') - else: - chars.append('\\') - chars.append(line[endpos]) - elif line[endpos] == '"': - break - else: - chars.append(line[endpos]) - endpos += 1 - if endpos >= len(line): - raise error(filename, lineno, "unclosed quoted string") - pos = endpos - stack[-1] += (''.join(chars),) - else: # symbol/number - if not stack: - raise error(filename, lineno, - 'identifier found outside of s-expression') - endpos = pos - while endpos < len(line) and line[endpos] not in nonsymbol: - endpos += 1 - symbol = line[pos:endpos] - pos = max(pos, endpos-1) - try: symbol = int(symbol) - except ValueError: - try: symbol = float(symbol) - except ValueError: pass - stack[-1] += (symbol,) - pos += 1 - if len(stack) != 0: - msg = '%d unclosed parentheses found at end of ' \ - 'file (opened on line(s) %s)' % (len(stack), - ', '.join(map(str, openlines))) - raise error(filename, lineno, msg) - -class Parser: - def __init__(self, filename): - """Argument is either a string, a parse tree, or file object""" - self.filename = filename - def startParsing(self, filename=None): - statements = parse(filename or self.filename) - for statement in statements: - self.handle(statement) - def handle(self, tup): - cmd = string.translate(tup[0], trans) - if hasattr(self, cmd): - getattr(self, cmd)(*tup[1:]) - else: - self.unknown(tup) - def unknown(self, tup): - pass - -_testString = """; a scheme file -(define-func gdk_font_load ; a comment at end of line - GdkFont - ((string name))) - -(define-boxed GdkEvent - gdk_event_copy - gdk_event_free - "sizeof(GdkEvent)") -""" - -if __name__ == '__main__': - import sys - if sys.argv[1:]: - fp = open(sys.argv[1]) - else: - fp = StringIO(_testString) - statements = parse(fp) - for s in statements: - print `s` diff --git a/configure.ac b/configure.ac index 61bbbd4c99..25bcb6f4fd 100644 --- a/configure.ac +++ b/configure.ac @@ -3,12 +3,10 @@ AC_PREREQ(2.60) dnl initialize autoconf dnl when going to/from release please set the nano (fourth number) right ! dnl releases only do Wall, cvs and prerelease does Werror too -AC_INIT(GStreamer Python Bindings, 0.10.22.1, +AC_INIT(GStreamer GObject Introspectin tests for Python , 0.11.92, http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer, gst-python) -AG_GST_INIT - dnl initialize automake AM_INIT_AUTOMAKE([-Wno-portability 1.10]) @@ -19,7 +17,7 @@ dnl check if this is a release version AS_NANO(GST_CVS="no", GST_CVS="yes") dnl can autoconf find the source ? -AC_CONFIG_SRCDIR([gst/gstmodule.c]) +AC_CONFIG_SRCDIR([testsuite/common.py]) dnl define the output header for config AM_CONFIG_HEADER([config.h]) @@ -27,63 +25,26 @@ AM_CONFIG_HEADER([config.h]) dnl AM_MAINTAINER_MODE only provides the option to configure to enable it AM_MAINTAINER_MODE -dnl error out -AC_MSG_ERROR([ - ================================================================================ - Development of gst-python for GStreamer 0.10 has switched to the 0.10 - branch in git. Do: git checkout -b 0.10 origin/0.10 - - The master branch of gst-python is not used any longer for GStreamer 0.11/1.0. - Applications will need to be ported over to the new pygi bindings. - ================================================================================ -]) - dnl use pretty build output with automake >= 1.11 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)]) -AC_DEFINE_UNQUOTED(PYGST_MAJOR_VERSION, $PACKAGE_VERSION_MAJOR, [PyGst major version]) -AC_DEFINE_UNQUOTED(PYGST_MINOR_VERSION, $PACKAGE_VERSION_MINOR, [PyGst minor version]) -AC_DEFINE_UNQUOTED(PYGST_MICRO_VERSION, $PACKAGE_VERSION_MICRO, [PyGst micro version]) -AC_DEFINE_UNQUOTED(PYGST_NANO_VERSION, $PACKAGE_VERSION_NANO, [PyGst nano version]) -AC_SUBST(PACKAGE_VERSION_MAJOR) -AC_SUBST(PACKAGE_VERSION_MINOR) -AC_SUBST(PACKAGE_VERSION_MICRO) -AC_SUBST(PACKAGE_VERSION_NANO) - dnl Add parameters for aclocal AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4") dnl required versions of other packages -AC_SUBST(PYGTK_REQ, 2.6.3) -AC_SUBST(PYGOBJECT_REQ, 2.11.2) -AC_SUBST(GLIB_REQ, 2.8.0) -AC_SUBST(GTK_REQ, 2.6.0) -AC_SUBST(GST_REQ, 0.10.20) -AC_SUBST(GSTPB_REQ, 0.10.20) - -AC_DISABLE_STATIC - -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -dnl find a compiler -AC_PROG_CC -AC_PROG_CC_STDC - -dnl check if the compiler supports '-c' and '-o' options -AM_PROG_CC_C_O - -AG_GST_ARG_GCOV +dnl Note that they are runtime requirements +AC_SUBST(GST_REQ, 0.11.92) +AC_SUBST(GSTPB_REQ, 0.11.92) dnl check for python dnl AM_PATH_PYTHON(2.2) AM_PATH_PYTHON -AC_MSG_CHECKING(for python >= 2.3) +AC_MSG_CHECKING(for python >= 2.5) prog=" import sys, string -minver = (2,3,0,'final',0) +minver = (2,5,0,'final',0) if sys.version_info < minver: sys.exit(1) sys.exit(0)" @@ -94,384 +55,15 @@ then else AC_MSG_ERROR(too old) fi -AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) - -dnl check for GStreamer -GST_MAJORMINOR=0.10 -AC_SUBST(GST_MAJORMINOR) -PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ) -AC_DEFINE_UNQUOTED(GST_MAJORMINOR, "$GST_MAJORMINOR", [Gst MajorMinor version]) -GST_CFLAGS="$GST_CFLAGS $GLIB_EXTRA_CFLAGS" -AC_SUBST(GST_CFLAGS) -AC_SUBST(GST_LIBS) - -dnl get the installed GStreamer core version -GST_MINOR_VERSION=`$PKG_CONFIG --modversion gstreamer-$GST_MAJORMINOR | cut -f 3 -d.` -GST_PB_MINOR_VERSION=`$PKG_CONFIG --modversion gstreamer-plugins-base-$GST_MAJORMINOR | cut -f 3 -d.` -GST_CVS_VERSION=`$PKG_CONFIG --modversion gstreamer-$GST_MAJORMINOR | cut -f 4 -d.` - -echo "Building against GStreamer core 0.10.$GST_MINOR_VERSION , ignoring API additions if needed" - -dnl Magic for allowing new API additions without forcing dependency on new core -dnl release. The lines do the magic so that new API additions are ignored at -dnl compile time. -dnl * Also see gst/gstversion.override.in and gst-0.10.*.override -dnl The following lines should be updated whenever: -dnl _ GST_REQ is up-ed (remove obsolete lines + gst-0.10.MINOR.ignore) -dnl _ new core/base is released (add lines + gst-0.10.MINOR.ignore) - -if test "x$GST_CVS_VERSION" = "x" -then - if test $GST_MINOR_VERSION -lt "21" - then - IGNORE_GST_0_10_21="gst-0.10.21.ignore" - else - IGNORE_GST_0_10_21="" - fi - - if test $GST_MINOR_VERSION -lt "22" - then - IGNORE_GST_0_10_22="gst-0.10.22.ignore" - else - IGNORE_GST_0_10_22="" - fi - - if test $GST_MINOR_VERSION -lt "23" - then - IGNORE_GST_0_10_23="gst-0.10.23.ignore" - else - IGNORE_GST_0_10_23="" - fi - - if test $GST_MINOR_VERSION -lt "24" - then - IGNORE_GST_0_10_24="gst-0.10.24.ignore" - else - IGNORE_GST_0_10_24="" - fi - - if test $GST_MINOR_VERSION -lt "25" - then - IGNORE_GST_0_10_25="gst-0.10.25.ignore" - else - IGNORE_GST_0_10_25="" - fi - - if test $GST_MINOR_VERSION -lt "26" - then - IGNORE_GST_0_10_26="gst-0.10.26.ignore" - else - IGNORE_GST_0_10_26="" - fi - - if test $GST_MINOR_VERSION -lt "29" - then - IGNORE_GST_0_10_29="gst-0.10.29.ignore" - else - IGNORE_GST_0_10_29="" - fi - - if test $GST_MINOR_VERSION -lt "30" - then - IGNORE_GST_0_10_30="gst-0.10.30.ignore" - else - IGNORE_GST_0_10_30="" - fi - - if test $GST_MINOR_VERSION -lt "31" - then - IGNORE_GST_0_10_31="gst-0.10.31.ignore" - else - IGNORE_GST_0_10_31="" - fi - - if test $GST_MINOR_VERSION -lt "32" - then - IGNORE_GST_0_10_32="gst-0.10.32.ignore" - else - IGNORE_GST_0_10_32="" - fi - - if test $GST_MINOR_VERSION -lt "36" - then - IGNORE_GST_0_10_36="gst-0.10.36.ignore" - else - IGNORE_GST_0_10_36="" - fi - - dnl plugins base - if test $GST_PB_MINOR_VERSION -ge "22" - then - AC_DEFINE_UNQUOTED(HAVE_GST_AUDIO, 1, [We can use the gst-audio library]) - AC_DEFINE_UNQUOTED(HAVE_GST_VIDEO, 1, [We can use the gst-video library]) - AC_DEFINE_UNQUOTED(HAVE_GST_TAG, 1, [We can use the gst-tag library]) - fi - - if test $GST_PB_MINOR_VERSION -lt "23" - then - IGNORE_GST_PB_0_10_23="gst-pb-0.10.23.ignore" - else - IGNORE_GST_PB_0_10_23="" - fi - - if test $GST_PB_MINOR_VERSION -lt "25" - then - IGNORE_GST_PB_0_10_25="gst-pb-0.10.25.ignore" - else - IGNORE_GST_PB_0_10_25="" - AC_DEFINE_UNQUOTED(HAVE_STREAM_VOLUME_INTERFACE, 1, [We can use the streamvolume interface]) - fi - - if test $GST_PB_MINOR_VERSION -lt "26" - then - IGNORE_GST_PB_0_10_26="gst-pb-0.10.26.ignore" - else - IGNORE_GST_PB_0_10_26="" - fi - - if test $GST_PB_MINOR_VERSION -lt "29" - then - IGNORE_GST_PB_0_10_29="gst-pb-0.10.29.ignore" - else - IGNORE_GST_PB_0_10_29="" - fi - - if test $GST_PB_MINOR_VERSION -lt "30" - then - IGNORE_GST_PB_0_10_30="gst-pb-0.10.30.ignore" - else - IGNORE_GST_PB_0_10_30="" - fi - - if test $GST_PB_MINOR_VERSION -lt "31" - then - IGNORE_GST_PB_0_10_31="gst-pb-0.10.31.ignore" - else - IGNORE_GST_PB_0_10_31="" - fi - - if test $GST_PB_MINOR_VERSION -lt "32" - then - IGNORE_GST_PB_0_10_32="gst-pb-0.10.32.ignore" - else - IGNORE_GST_PB_0_10_32="" - fi - - if test $GST_PB_MINOR_VERSION -lt "36" - then - IGNORE_GST_PB_0_10_36="gst-pb-0.10.36.ignore" - else - IGNORE_GST_PB_0_10_36="" - fi - -else - IGNORE_GST_0_10_18="" - IGNORE_GST_0_10_21="" - IGNORE_GST_0_10_22="" - IGNORE_GST_0_10_23="" - IGNORE_GST_0_10_24="" - IGNORE_GST_0_10_25="" - IGNORE_GST_0_10_26="" - IGNORE_GST_0_10_29="" - IGNORE_GST_0_10_30="" - IGNORE_GST_0_10_31="" - IGNORE_GST_0_10_32="" - IGNORE_GST_0_10_36="" - IGNORE_GST_PB_0_10_23="" - IGNORE_GST_PB_0_10_25="" - IGNORE_GST_PB_0_10_26="" - IGNORE_GST_PB_0_10_29="" - IGNORE_GST_PB_0_10_30="" - IGNORE_GST_PB_0_10_31="" - IGNORE_GST_PB_0_10_32="" - IGNORE_GST_PB_0_10_36="" - AC_DEFINE_UNQUOTED(HAVE_GST_AUDIO, 1, [We can use the gst-audio library]) - AC_DEFINE_UNQUOTED(HAVE_GST_VIDEO, 1, [We can use the gst-video library]) - AC_DEFINE_UNQUOTED(HAVE_GST_TAG, 1, [We can use the gst-tag library]) -fi -AC_DEFINE_UNQUOTED(HAVE_STREAM_VOLUME_INTERFACE, 1, [We can use the streamvolume interface]) -AC_SUBST(IGNORE_GST_0_10_21) -AC_SUBST(IGNORE_GST_0_10_22) -AC_SUBST(IGNORE_GST_0_10_23) -AC_SUBST(IGNORE_GST_0_10_24) -AC_SUBST(IGNORE_GST_0_10_25) -AC_SUBST(IGNORE_GST_0_10_26) -AC_SUBST(IGNORE_GST_0_10_29) -AC_SUBST(IGNORE_GST_0_10_30) -AC_SUBST(IGNORE_GST_0_10_31) -AC_SUBST(IGNORE_GST_0_10_32) -AC_SUBST(IGNORE_GST_0_10_36) -AC_SUBST(IGNORE_GST_PB_0_10_23) -AC_SUBST(IGNORE_GST_PB_0_10_25) -AC_SUBST(IGNORE_GST_PB_0_10_26) -AC_SUBST(IGNORE_GST_PB_0_10_29) -AC_SUBST(IGNORE_GST_PB_0_10_30) -AC_SUBST(IGNORE_GST_PB_0_10_31) -AC_SUBST(IGNORE_GST_PB_0_10_32) -AC_SUBST(IGNORE_GST_PB_0_10_36) -AM_CONDITIONAL(HAVE_GST_AUDIO, $HAVE_GST_AUDIO) -AM_CONDITIONAL(HAVE_GST_VIDEO, $HAVE_GST_VIDEO) -AM_CONDITIONAL(HAVE_GST_TAG, $HAVE_GST_TAG) - -dnl check for gstreamer-base; uninstalled is selected preferentially -PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST_BASE="yes", HAVE_GST_BASE="no") - -if test "x$HAVE_GST_BASE" = "xno"; then - AC_MSG_ERROR(no GStreamer Base Libs found) -fi - -AC_SUBST(GST_BASE_LIBS) -AC_SUBST(GST_BASE_CFLAGS) - - -dnl check for gstreamer core features (subsystems) -GST_CONFIGPATH=`$PKG_CONFIG --variable=includedir gstreamer-0.10`"/gst/gstconfig.h" -AG_GST_PARSE_SUBSYSTEM_DISABLES($GST_CONFIGPATH) -if test $GST_DISABLE_LOADSAVE = "1"; then - AC_MSG_WARN("Load/Save XML persistence disabled") - IGNORE_GST_LOADSAVE="gst-disable-loadsave.ignore" -else - IGNORE_GST_LOADSAVE="" -fi -AC_SUBST(IGNORE_GST_LOADSAVE) - -dnl check for gstreamer-controller -PKG_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST_CONTROLLER="yes", HAVE_GST_CONTROLLER="no") - -if test "x$HAVE_GST_CONTROLLER" = "xno"; then - AC_MSG_ERROR(no GStreamer Controller Libs found) -fi - -AC_SUBST(GST_CONTROLLER_LIBS) -AC_SUBST(GST_CONTROLLER_CFLAGS) - -dnl check for gstreamer-net -PKG_CHECK_MODULES(GST_NET, gstreamer-net-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST_NET="yes", HAVE_GST_NET="no") - -if test "x$HAVE_GST_NET" = "xno"; then - AC_MSG_ERROR(no GStreamer Networking Libs found) -fi - -AC_SUBST(GST_NET_LIBS) -AC_SUBST(GST_NET_CFLAGS) - -dnl check for gstreamer-dataprotocol -PKG_CHECK_MODULES(GST_DP, gstreamer-dataprotocol-$GST_MAJORMINOR >= $GST_REQ, - HAVE_GST_DP="yes", HAVE_GST_DP="no") - -if test "x$HAVE_GST_DP" = "xno"; then - AC_MSG_ERROR(no GStreamer Data Protocol Libs found) -fi - -AC_SUBST(GST_DP_LIBS) -AC_SUBST(GST_DP_CFLAGS) - - -dnl check for gst-plugins-base -PKG_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQ, - HAVE_GST_PLUGINS_BASE="yes", HAVE_GST_PLUGINS_BASE="no") - -if test "x$HAVE_GST_PLUGINS_BASE" = "xno"; then - AC_MSG_ERROR(no gst-plugins-base found) -fi - -AC_SUBST(GST_PLUGINS_BASE_LIBS) -AC_SUBST(GST_PLUGINS_BASE_CFLAGS) - - -dnl check for pygobject -PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= $PYGOBJECT_REQ, - [ - HAVE_PYGOBJECT="yes" - ], HAVE_PYGOBJECT="no") - -if test "x$HAVE_PYGOBJECT" = "xno"; then - dnl If we don't have pygobject, then check for pygtk - dnl check for pygtk - PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= $PYGTK_REQ) - AC_SUBST(PYGTK_CFLAGS) - PYGOBJECT_CFLAGS="\$(PYGTK_CFLAGS)" -fi -AC_SUBST(PYGOBJECT_CFLAGS) - -dnl FIXME: check for a pygobject with a correct pyg_param_gvalue_from_pyobject -PKG_CHECK_MODULES(PYGOBJECT_2_12, pygobject-2.0 >= 2.11.1, - [ - HAVE_PYGOBJECT_2_12="yes" - AC_DEFINE_UNQUOTED(HAVE_PYGOBJECT_2_12, 1, - [Defined if we have a 2.12 series pygobject]) - ], HAVE_PYGOBJECT_2_12="no") - -dnl FIXME: check for a pygobject which exports pyg_option_group_new -PKG_CHECK_MODULES(PYGOBJECT_2_16, pygobject-2.0 >= 2.15.0, - [ - HAVE_PYGOBJECT_2_16="yes" - AC_DEFINE_UNQUOTED(HAVE_PYGOBJECT_2_16, 1, - [Defined if we have a 2.16 series pygobject]) - ], HAVE_PYGOBJECT_2_16="no") - -AM_CONDITIONAL(HAVE_PYGOBJECT_2_16, test x$HAVE_PYGOBJECT_2_16 != xno) - -dnl define an ERROR_CFLAGS Makefile variable -AG_GST_SET_ERROR_CFLAGS($GST_CVS) - -GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(GCOV_CFLAGS)" -AC_SUBST(GST_OPTION_CFLAGS) -GST_OPTION_LIBS="\$(GCOV_LIBS)" -AC_SUBST(GST_OPTION_LIBS) - -dnl full installation path -AS_AC_EXPAND(PYTHONDIR, $pythondir) -AS_AC_EXPAND(PYEXECDIR, $pyexecdir) - -PYGST_CFLAGS="-I\$(top_srcdir)/gst -I\$(top_builddir)/gst" -AC_SUBST(PYGST_CFLAGS) -dnl add debugging options ... -# changequote(,)dnl -# if test "x$GCC" = xyes; then -# case " $CFLAGS " in -# *[\ \ ]-Wall[\ \ ]*) ;; -# *) CFLAGS="$CFLAGS -Wall" ;; -# esac - -# case " $CFLAGS " in -# *[\ \ ]-std=c9x[\ \ ]*) ;; -# *) CFLAGS="$CFLAGS -std=c9x" ;; -# esac -# fi -# changequote([,])dnl AG_GST_VALGRIND_CHECK -dnl Stuff needed for the python plugin loader - -AM_CHECK_PYTHON_LIBS(,[AC_MSG_ERROR(could not find Python lib)]) - -AG_GST_SET_PLUGINDIR - dnl set release date/time -AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO], - ["${srcdir}/gst-python.doap"], - [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO]) AC_OUTPUT([ Makefile - codegen/Makefile common/Makefile common/m4/Makefile - gst/Makefile - gst/gstversion.override - gst/extend/Makefile examples/Makefile - pkgconfig/Makefile - pkgconfig/gst-python.pc - pkgconfig/gst-python-uninstalled.pc - plugin/Makefile testsuite/Makefile - win32/common/config.h - gst-python.spec - gst/__init__.py ]) diff --git a/gst/.gitignore b/gst/.gitignore deleted file mode 100644 index 5001f41a69..0000000000 --- a/gst/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -*.so -*.py[co] -.libs -.deps -gst.c -pbutils.c -gen-*.c -interfaces.c -play.c -gstversion.override -audio.c -tag.c -video.c diff --git a/gst/Makefile.am b/gst/Makefile.am deleted file mode 100644 index e43c8ff6d9..0000000000 --- a/gst/Makefile.am +++ /dev/null @@ -1,196 +0,0 @@ -common_cflags = $(PYGOBJECT_CFLAGS) $(GST_CFLAGS) $(GST_OPTION_CFLAGS) -fno-strict-aliasing -common_libadd = $(GST_LIBS) $(GST_OPTION_LIBS) -common_ldflags = -module -avoid-version - -pkgpyexecdir = $(pyexecdir)/gst-$(GST_MAJORMINOR)/gst - -# we install everything in pyexecdir; otherwise you end up with a mess for -# multilib -pygstdir = $(pkgpyexecdir) -pygst_PYTHON = __init__.py - -pygstexecdir = $(pkgpyexecdir) -pygstexec_LTLIBRARIES = _gst.la $(interface_lib) $(pbutils_lib) - -interface_lib = interfaces.la -pbutils_lib = pbutils.la - -defs_DATA = gst-types.defs \ - gst-extrafuncs.defs \ - libs.defs \ - base.defs \ - pbutils.defs -defsdir = $(pkgdatadir)/$(GST_MAJORMINOR)/defs - -noinst_HEADERS = common.h pygst-private.h - -pygst_installdir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/ -pygst_install_HEADERS = pygst.h pygstvalue.h pygstminiobject.h pygstexception.h - -versioned_overrides = \ - gst-0.10.21.ignore \ - gst-0.10.22.ignore \ - gst-0.10.23.ignore \ - gst-0.10.24.ignore \ - gst-0.10.25.ignore \ - gst-0.10.26.ignore \ - gst-0.10.29.ignore \ - gst-0.10.30.ignore \ - gst-0.10.31.ignore \ - gst-0.10.32.ignore \ - gst-pb-0.10.23.ignore \ - gst-pb-0.10.25.ignore \ - gst-pb-0.10.26.ignore \ - gst-pb-0.10.29.ignore \ - gst-pb-0.10.30.ignore \ - gst-pb-0.10.31.ignore \ - gst-pb-0.10.32.ignore \ - gst-pb-0.10.36.ignore \ - gst-disable-loadsave.ignore - -INCLUDES = $(PYTHON_INCLUDES) -EXTRA_DIST = $(defs_DATA) $(versioned_overrides) common.h arg-types.py -GEN_FILES = arg-types.py gst-types.defs libs.defs base.defs pbutils.defs - -# GStreamer bindings -_gst_la_CFLAGS = $(common_cflags) -_gst_la_LIBADD = $(common_libadd) $(GST_BASE_LIBS) -_gst_la_LDFLAGS = $(common_ldflags) -export-symbols-regex "^(init_gst|_PyGObject_API|pygstminiobject_).*" \ - $(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_NET_LIBS) $(GST_DP_LIBS) -_gst_la_SOURCES = \ - gst-argtypes.c \ - gstmodule.c \ - pygstiterator.c \ - pygstminiobject.c \ - pygstvalue.c \ - pygstexception.c - -nodist__gst_la_SOURCES = gst.c -GST_OVERRIDES = \ - gst.override \ - gstbin.override \ - gstbuffer.override \ - gstbus.override \ - gstevent.override \ - gstcaps.override \ - gstelement.override \ - gstelementfactory.override \ - gstmessage.override \ - gstobject.override \ - gstquery.override \ - gstpad.override \ - gststructure.override \ - gsttaglist.override \ - gstlibs.override \ - gstbase.override - -GST_DEFS = gst.defs gst-types.defs gst-extrafuncs.defs libs.defs base.defs -CLEANFILES = gst.c __init__.pyc -EXTRA_DIST += $(GST_DEFS) $(GST_OVERRIDES) gstversion.override.in -gst.c: $(GST_DEFS) $(GST_OVERRIDES) $(GEN_FILES) gstversion.override __init__.py - -# GStreamer interfaces bindings -interfaces_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS) -interfaces_la_LIBADD = $(common_libadd) -lgstinterfaces-$(GST_MAJORMINOR) -interfaces_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(initinterface|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS) -interfaces_la_SOURCES = interfacesmodule.c -nodist_interfaces_la_SOURCES = interfaces.c -INTERFACES_OVERRIDES = interfaces.override xoverlay.override -INTERFACES_DEFS = interfaces.defs xoverlay.defs -CLEANFILES += interfaces.c -EXTRA_DIST += $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) -interfaces.c: $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) $(GEN_FILES) - -# GStreamer pbutils bindings -pbutils_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS) -pbutils_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgstpbutils-0.10 -pbutils_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(initpbutils|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS) -pbutils_la_SOURCES = pbutilsmodule.c gst-argtypes.c -nodist_pbutils_la_SOURCES = pbutils.c -PBUTILS_OVERRIDES = pbutils.override -PBUTILS_DEFS = pbutils.defs -CLEANFILES += pbutils.c -EXTRA_DIST += $(PBUTILS_DEFS) $(PBUTILS_OVERRIDES) -pbutils.c: $(PBUTILS_DEFS) $(PBUTILS_OVERRIDES) $(GEN_FILES) - -# GStreamer audio bindings -AUDIO_OVERRIDES = audio.override -AUDIO_DEFS = audio.defs -CLEANFILES += audio.c -EXTRA_DIST += $(AUDIO_DEFS) $(AUDIO_OVERRIDES) -defs_DATA += $(AUDIO_DEFS) -GEN_FILES += $(AUDIO_DEFS) - -if HAVE_GST_AUDIO - - audio_lib = audio.la - pygstexec_LTLIBRARIES += $(audio_lib) - audio_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS) - audio_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgstaudio-0.10 - audio_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(initaudio|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS) - audio_la_SOURCES = audiomodule.c gst-argtypes.c - nodist_audio_la_SOURCES = audio.c -audio.c: $(AUDIO_DEFS) $(AUDIO_OVERRIDES) $(GEN_FILES) - -endif - -# GStreamer video bindings -VIDEO_OVERRIDES = video.override -VIDEO_DEFS = video.defs -CLEANFILES += video.c -EXTRA_DIST += $(VIDEO_DEFS) $(VIDEO_OVERRIDES) -defs_DATA += $(VIDEO_DEFS) -GEN_FILES += $(VIDEO_DEFS) - -if HAVE_GST_VIDEO - - video_lib = video.la - pygstexec_LTLIBRARIES += $(video_lib) - video_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS) - video_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-0.10 - video_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(initvideo|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS) - video_la_SOURCES = videomodule.c gst-argtypes.c - nodist_video_la_SOURCES = video.c -video.c: $(VIDEO_DEFS) $(VIDEO_OVERRIDES) $(GEN_FILES) - -endif - -# GStreamer tag bindings -TAG_OVERRIDES = tag.override -TAG_DEFS = tag.defs -CLEANFILES += tag.c -EXTRA_DIST += $(TAG_DEFS) $(TAG_OVERRIDES) -defs_DATA += $(TAG_DEFS) -GEN_FILES += $(TAG_DEFS) - -if HAVE_GST_TAG - - tag_lib = tag.la - pygstexec_LTLIBRARIES += $(tag_lib) - tag_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS) - tag_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgsttag-0.10 - tag_la_LDFLAGS = $(common_ldflags) \ - -export-symbols-regex "^(inittag|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS) - tag_la_SOURCES = tagmodule.c gst-argtypes.c - nodist_tag_la_SOURCES = tag.c -tag.c: $(TAG_DEFS) $(TAG_OVERRIDES) $(GEN_FILES) - -endif - - -.defs.c: - $(AM_V_GEN)($(PYTHON) $(top_srcdir)/codegen/codegen.py \ - --load-types $(srcdir)/arg-types.py \ - --register $(srcdir)/gst-types.defs \ - --override $(srcdir)/$*.override \ - --extendpath $(top_builddir)/gst/ \ - --extendpath $(srcdir)/ \ - --prefix py$* $<) > gen-$*.c \ - && cp gen-$*.c $*.c \ - && rm -f gen-$*.c - -SUBDIRS = extend diff --git a/gst/__init__.py.in b/gst/__init__.py.in deleted file mode 100644 index 2c439e362c..0000000000 --- a/gst/__init__.py.in +++ /dev/null @@ -1,229 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# gst-python -# Copyright (C) 2002 David I. Lehn -# -# 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 - -try: - import gstlibtoolimporter - gstlibtoolimporter.install() -except ImportError: - gstlibtoolimporter = None - -import sys - -# we always require 2.0 of pygtk; so if pygtk is not imported anywhere -# yet, we import pygtk here and .require -if 'gobject' not in sys.modules: - import pygtk - pygtk.require('2.0') - -class Value: - def __init__(self, type): - assert type in ('fourcc', 'intrange', 'doublerange', 'fractionrange', 'fraction') - self.type = type - -class Fourcc(Value): - def __init__(self, string): - Value.__init__(self, 'fourcc') - self.fourcc = string - - def __repr__(self): - return '' % self.fourcc - - def __eq__(self, other): - if isinstance(other, Fourcc): - return self.fourcc == other.fourcc - - return False - - def __ne__(self, other): - return not self.__eq__(other) - -class IntRange(Value): - def __init__(self, low, high): - Value.__init__(self, 'intrange') - self.low = low - self.high = high - def __repr__(self): - return '' % (self.low, self.high) - -class DoubleRange(Value): - def __init__(self, low, high): - Value.__init__(self, 'doublerange') - self.low = low - self.high = high - def __repr__(self): - return '' % (self.low, self.high) - -class FractionRange(Value): - def __init__(self, low, high): - Value.__init__(self, 'fractionrange') - self.low = low - self.high = high - def __repr__(self): - return '' % (self.low.num, - self.low.denom, - self.high.num, - self.high.denom) - -class Fraction(Value): - def __init__(self, num, denom=1): - def __gcd(a,b): - while b != 0: - tmp = a - a = b - b = tmp % b - return abs(a) - - def __simplify(): - num = self.num - denom = self.denom - - if num < 0: - num = -num - denom = -denom - - # Compute greatest common divisor - gcd = __gcd(num,denom) - if gcd != 0: - num /= gcd - denom /= gcd - - self.num = num - self.denom = denom - - Value.__init__(self, 'fraction') - - self.num = num - self.denom = denom - - __simplify() - - def __repr__(self): - return '' % (self.num, self.denom) - - def __eq__(self, other): - if isinstance(other, Fraction): - return self.num * other.denom == other.num * self.denom - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __mul__(self, other): - if isinstance(other, Fraction): - return Fraction(self.num * other.num, - self.denom * other.denom) - elif isinstance(other, int): - return Fraction(self.num * other, self.denom) - raise TypeError - - __rmul__ = __mul__ - - def __div__(self, other): - if isinstance(other, Fraction): - return Fraction(self.num * other.denom, - self.denom * other.num) - elif isinstance(other, int): - return Fraction(self.num, self.denom * other) - return TypeError - - def __rdiv__(self, other): - if isinstance(other, int): - return Fraction(self.denom * other, self.num) - return TypeError - - def __float__(self): - return float(self.num) / float(self.denom) - -try: - dlsave = sys.getdlopenflags() - from DLFCN import RTLD_GLOBAL, RTLD_LAZY -except AttributeError: - # windows doesn't have sys.getdlopenflags() - RTLD_GLOBAL = -1 - RTLD_LAZY = -1 -except ImportError: - RTLD_GLOBAL = -1 - RTLD_LAZY = -1 - import os - osname = os.uname()[0] - if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD' or osname == 'GNU/kFreeBSD' or osname == 'GNU': - machinename = os.uname()[4] - if machinename == 'mips' or machinename == 'mips64': - RTLD_GLOBAL = 0x4 - RTLD_LAZY = 0x1 - else: - RTLD_GLOBAL = 0x100 - RTLD_LAZY = 0x1 - elif osname == 'Darwin': - RTLD_GLOBAL = 0x8 - RTLD_LAZY = 0x1 - del os -except: - RTLD_GLOBAL = -1 - RTLD_LAZY = -1 - -if RTLD_GLOBAL != -1 and RTLD_LAZY != -1: - sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL) - -try: - import libxml2 -except: - pass - -from _gst import * -import interfaces - -if RTLD_GLOBAL != -1 and RTLD_LAZY != -1: - sys.setdlopenflags(dlsave) -del sys - -version = get_gst_version - -# Fixes for API cleanups that would cause an API breakage. -# See #446674 - -import warnings -if locals().has_key("parse_bin_from_description"): - def gst_parse_bin_from_description(*args, **kwargs): - warnings.warn("gst_parse_bin_from_description() is deprecated, please use parse_bin_from_description instead", - DeprecationWarning) - return parse_bin_from_description(*args, **kwargs) - -if locals().has_key("message_new_buffering"): - def gst_message_new_buffering(*args, **kwargs): - warnings.warn("gst_message_new_buffering() is deprecated, please use message_new_buffering() instead", - DeprecationWarning) - return message_new_buffering(*args, **kwargs) - -# this restores previously installed importhooks, so we don't interfere -# with other people's module importers -# it also clears out the module completely as if it were never loaded, -# so that if anyone else imports gstltihooks the hooks get installed -if gstlibtoolimporter is not None: - import audio - import pbutils - import tag - import video - gstlibtoolimporter.uninstall() - import sys - del sys.modules["gstlibtoolimporter"] diff --git a/gst/arg-types.py b/gst/arg-types.py deleted file mode 100644 index bf45607eac..0000000000 --- a/gst/arg-types.py +++ /dev/null @@ -1,418 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# 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 - -from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, matcher -from reversewrapper import Parameter, ReturnType, GBoxedParam, GBoxedReturn, IntParam, IntReturn - -class XmlNodeArg(ArgType): - """libxml2 node generator""" - - names = {"xobj":"xmlNode", - "xptr":"xmlNodePtr", - "xwrap":"libxml_xmlNodePtrWrap"} - - parm = (' if(xml == NULL) return NULL;\n' - ' xobj = PyObject_GetAttrString(xml, "%(xobj)s");\n' - ' if(!PyObject_IsInstance(py%(name)s, xobj)) {\n' - ' PyErr_Clear();\n' - ' PyErr_SetString(PyExc_RuntimeError,"%(name)s is not a %(xobj)s instance");\n' - ' Py_DECREF(xobj);Py_DECREF(xml);\n' - ' return NULL;\n' - ' }\n' - ' o = PyObject_GetAttrString(py%(name)s, "_o");\n' - ' %(name)s = PyCObject_AsVoidPtr(o);\n') - parmp = (' Py_DECREF(o); Py_DECREF(xobj);Py_DECREF(xml);\n') - - ret = (' if(xml == NULL) return NULL;\n') - retp = (' xargs = PyTuple_New(1);\n' - ' xobj = PyObject_GetAttrString(xml, "%(xobj)s");\n' - ' o = %(xwrap)s(ret);\n' - ' PyTuple_SetItem(xargs, 0, o);\n' - ' return PyInstance_New(xobj, xargs, PyDict_New());\n') - - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - info.varlist.add('PyObject', '*xml = _gst_get_libxml2_module()') - info.varlist.add('PyObject', '*o') - info.varlist.add('PyObject', '*xobj') - info.varlist.add('PyObject', '*py' + pname) - info.varlist.add(self.names["xptr"], pname) - #if pnull: - info.add_parselist('O', ['&py'+pname], [pname]) - info.arglist.append(pname) - self.names["name"] = pname - info.codebefore.append(self.parm % self.names) - info.codeafter.append(self.parmp % self.names); - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('PyObject', '*xml = _gst_get_libxml2_module()') - info.varlist.add('PyObject', '*xargs') - info.varlist.add('PyObject', '*xobj') - info.varlist.add('PyObject', '*o') - info.varlist.add(self.names["xptr"], 'ret') - info.codebefore.append(self.ret % self.names) - info.codeafter.append(self.retp % self.names) - -class XmlDocArg(XmlNodeArg): - """libxml2 doc generator""" - names = {"xobj":"xmlDoc", - "xptr":"xmlDocPtr", - "xwrap":"libxml_xmlDocPtrWrap"} - -class GstCapsArg(ArgType): - """GstCaps node generator""" - - before = (' %(name)s = pygst_caps_from_pyobject (py_%(name)s, %(namecopy)s);\n' - ' if (PyErr_Occurred())\n' - ' return NULL;\n') - beforenull = (' if (py_%(name)s == Py_None || py_%(name)s == NULL)\n' - ' %(name)s = NULL;\n' - ' else\n' - ' ' + before) - after = (' if (%(name)s && %(name)s_is_copy)\n' - ' gst_caps_unref (%(name)s);\n') - - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if ptype == 'const-GstCaps*': - self.write_const_param(pname, pdflt, pnull, info) - elif ptype == 'GstCaps*': - self.write_normal_param(pname, pdflt, pnull, info) - else: - raise RuntimeError, "write_param not implemented for %s" % ptype - - def write_const_param(self, pname, pdflt, pnull, info): - if pdflt: - assert pdflt == 'NULL' - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - else: - info.varlist.add('PyObject', '*py_' + pname) - info.varlist.add('GstCaps', '*'+pname) - info.varlist.add('gboolean', pname+'_is_copy') - info.add_parselist('O', ['&py_'+pname], [pname]) - info.arglist.append(pname) - if pnull: - info.codebefore.append (self.beforenull % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) - else: - info.codebefore.append (self.before % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) - info.codeafter.append (self.after % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) - - def write_normal_param(self, pname, pdflt, pnull, info): - if pdflt: - assert pdflt == 'NULL' - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - else: - info.varlist.add('PyObject', '*py_' + pname) - info.varlist.add('GstCaps', '*'+pname) - info.add_parselist('O', ['&py_'+pname], [pname]) - info.arglist.append(pname) - if pnull: - info.codebefore.append (self.beforenull % { 'name' : pname, 'namecopy' : 'NULL' }) - else: - info.codebefore.append (self.before % { 'name' : pname, 'namecopy' : 'NULL' }) - - def write_return(self, ptype, ownsreturn, info): - if ptype == 'GstCaps*': - info.varlist.add('GstCaps', '*ret') - copyval = 'FALSE' - elif ptype == 'const-GstCaps*': - info.varlist.add('const GstCaps', '*ret') - copyval = 'TRUE' - else: - raise RuntimeError, "write_return not implemented for %s" % ptype - info.codeafter.append(' return pyg_boxed_new (GST_TYPE_CAPS, (GstCaps*) ret, '+copyval+', TRUE);') - -class GstIteratorArg(ArgType): - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GstIterator', '*ret') - info.codeafter.append(' return pygst_iterator_new(ret);') - -class GstMiniObjectArg(ArgType): - - before = (' %(name)s = %(macro)s(pygstminiobject_get (py_%(name)s));\n' - ' if (PyErr_Occurred())\n' - ' return NULL;\n') - - def write_param(self, ptype, pname, pdflt, pnull, keeprefcount, info): - if pdflt: - assert pdflt == 'NULL' - info.varlist.add('PyObject', '*py_' + pname + ' = NULL') - else: - info.varlist.add('PyObject', '*py_' + pname) - - #Converts 'GstBuffer*' to 'GstBuffer' - #and const-GstBuffer* to 'const GstBuffer' - info.varlist.add(ptype.replace('-',' ').replace('*',''), '*'+pname) - - if ptype in ['GstBuffer*', 'const-GstBuffer*']: - info.codebefore.append(self.before % { 'name' : pname, 'macro' : 'GST_BUFFER' }) - - elif ptype in ['GstMessage*', 'const-GstMessage*']: - info.codebefore.append(self.before % { 'name' : pname, 'macro' : 'GST_MESSAGE' }) - - elif ptype in ['GstEvent*', 'const-GstEvent*']: - info.codebefore.append(self.before % { 'name' : pname, 'macro' : 'GST_EVENT' }) - - elif ptype in ['GstQuery*', 'const-GstQuery*']: - info.codebefore.append(self.before % { 'name' : pname, 'macro' : 'GST_QUERY' }) - - else: - raise RuntimeError, "write_param not implemented for %s" % ptype - - info.add_parselist('O', ['&py_'+pname], [pname]) - info.arglist.append(pname) - - def write_return(self, ptype, ownsreturn, info): - info.varlist.add('GstMiniObject', '*ret') - info.codeafter.append(' return pygstminiobject_new((GstMiniObject *) ret);') - -class GstMiniObjectParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'GstMiniObject *') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) - self.wrapper.write_code(code=("if (%s) {\n" - " py_%s = pygstminiobject_new((GstMiniObject *) %s);\n" - " gst_mini_object_unref ((GstMiniObject *) %s);\n" - "} else {\n" - " Py_INCREF(Py_None);\n" - " py_%s = Py_None;\n" - "}" - % (self.name, self.name, self.name, self.name, self.name)), - cleanup=("gst_mini_object_ref ((GstMiniObject *) %s); Py_DECREF(py_%s);" % (self.name, self.name))) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -matcher.register_reverse('GstMiniObject*', GstMiniObjectParam) - -class GstMiniObjectReturn(ReturnType): - - def get_c_type(self): - return self.props.get('c_type', 'GstMiniObject *') - - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - - def write_error_return(self): - self.wrapper.write_code("return NULL;") - - def write_conversion(self): - self.wrapper.write_code("retval = (%s) pygstminiobject_get(py_retval);" - % self.get_c_type()) - self.wrapper.write_code("gst_mini_object_ref((GstMiniObject *) retval);") - -matcher.register_reverse_ret('GstMiniObject*', GstMiniObjectReturn) - -class GstCapsParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'GstCaps *') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) - self.wrapper.write_code(code=("if (%s)\n" - " py_%s = pyg_boxed_new (GST_TYPE_CAPS, %s, FALSE, TRUE);\n" - "else {\n" - " Py_INCREF(Py_None);\n" - " py_%s = Py_None;\n" - "}" - % (self.name, self.name, self.name, self.name)), - cleanup=("gst_caps_ref(%s);\nPy_DECREF(py_%s);" % (self.name, self.name))) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -matcher.register_reverse('GstCaps*', GstCapsParam) - -class GstCapsReturn(ReturnType): - - def get_c_type(self): - return self.props.get('c_type', 'GstCaps *') - - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - - def write_error_return(self): - self.wrapper.write_code("return NULL;") - - def write_conversion(self): - self.wrapper.write_code("retval = (%s) pygst_caps_from_pyobject (py_retval, NULL);" - % self.get_c_type()) -## self.wrapper.write_code("gst_mini_object_ref((GstMiniObject *) retval);") - -matcher.register_reverse_ret('GstCaps*', GstCapsReturn) - - -class Int64Param(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'gint64') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyLong_FromLongLong(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -class Int64Return(ReturnType): - def get_c_type(self): - return self.props.get('c_type', 'gint64') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return -G_MAXINT;") - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="!PyLong_Check(py_retval)", - failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be an long");') - self.wrapper.write_code("retval = PyLong_AsLongLong(py_retval);") - -class UInt64Param(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'guint64') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyLong_FromUnsignedLongLong(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -class UInt64Return(ReturnType): - def get_c_type(self): - return self.props.get('c_type', 'guint64') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return -G_MAXINT;") - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="!PyLong_Check(py_retval)", - failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be an long");') - self.wrapper.write_code("retval = PyLong_AsUnsignedLongLongMask(py_retval);") - -class ULongParam(Parameter): - - def get_c_type(self): - return self.props.get('c_type', 'gulong') - - def convert_c2py(self): - self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = PyLong_FromUnsignedLong(%s);" % - (self.name, self.name)), - cleanup=("Py_DECREF(py_%s);" % self.name)) - self.wrapper.add_pyargv_item("py_%s" % self.name) - -class ULongReturn(ReturnType): - def get_c_type(self): - return self.props.get('c_type', 'gulong') - def write_decl(self): - self.wrapper.add_declaration("%s retval;" % self.get_c_type()) - def write_error_return(self): - self.wrapper.write_code("return -G_MAXINT;") - def write_conversion(self): - self.wrapper.write_code( - code=None, - failure_expression="!PyLong_Check(py_retval)", - failure_cleanup='PyErr_SetString(PyExc_TypeError, "retval should be an long");') - self.wrapper.write_code("retval = PyLong_AsUnsignedLongMask(py_retval);") - -class ConstStringReturn(ReturnType): - - def get_c_type(self): - return "const gchar *" - - def write_decl(self): - self.wrapper.add_declaration("const gchar *retval;") - - def write_error_return(self): - self.wrapper.write_code("return NULL;") - - def write_conversion(self): - self.wrapper.write_code( - code=None, - 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('GstElementFactoryListType', UInt64Arg()) -matcher.register('GstClockTimeDiff', Int64Arg()) -matcher.register('xmlNodePtr', XmlNodeArg()) -matcher.register('xmlDocPtr', XmlDocArg()) -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()) - -arg = PointerArg('gpointer', 'G_TYPE_POINTER') -matcher.register('GstClockID', arg) - -for typename in ["GstPlugin", "GstStructure", "GstTagList", "GError", "GstDate", "GstSegment"]: - matcher.register_reverse(typename, GBoxedParam) - matcher.register_reverse_ret(typename, GBoxedReturn) - -for typename in ["GstBuffer*", "const-GstBuffer*", "GstEvent*", "const-GstEvent*", "GstMessage*", "const-GstMessage*", "GstQuery*", "const-GstQuery*"]: - matcher.register(typename, GstMiniObjectArg()) - matcher.register_reverse(typename, GstMiniObjectParam) - matcher.register_reverse_ret(typename, GstMiniObjectReturn) - -for typename in ["gint64", "GstClockTimeDiff"]: - matcher.register_reverse(typename, Int64Param) - matcher.register_reverse_ret(typename, Int64Return) - -for typename in ["guint64", "GstClockTime", "GstElementFactoryListType"]: - matcher.register_reverse(typename, UInt64Param) - matcher.register_reverse_ret(typename, UInt64Return) - -matcher.register_reverse_ret("const-gchar*", ConstStringReturn) - -matcher.register_reverse("GType", IntParam) -matcher.register_reverse_ret("GType", IntReturn) - -matcher.register_reverse("gulong", ULongParam) -matcher.register_reverse_ret("gulong", ULongReturn) - -matcher.register("GStrv", StringArrayArg()) - -del arg diff --git a/gst/audio.defs b/gst/audio.defs deleted file mode 100644 index 2385ebb361..0000000000 --- a/gst/audio.defs +++ /dev/null @@ -1,872 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object AudioClock - (in-module "Gst") - (parent "GstSystemClock") - (c-name "GstAudioClock") - (gtype-id "GST_TYPE_AUDIO_CLOCK") -) - -(define-object AudioFilter - (in-module "Gst") - (parent "GstBaseTransform") - (c-name "GstAudioFilter") - (gtype-id "GST_TYPE_AUDIO_FILTER") -) - -(define-object BaseAudioSink - (in-module "Gst") - (parent "GstBaseSink") - (c-name "GstBaseAudioSink") - (gtype-id "GST_TYPE_BASE_AUDIO_SINK") -) - -(define-object AudioSink - (in-module "Gst") - (parent "GstBaseAudioSink") - (c-name "GstAudioSink") - (gtype-id "GST_TYPE_AUDIO_SINK") -) - -;; (define-object BaseAudioSrc -;; (in-module "Gst") -;; (parent "GstPushSrc") -;; (c-name "GstBaseAudioSrc") -;; (gtype-id "GST_TYPE_BASE_AUDIO_SRC") -;; ) - -;; (define-object AudioSrc -;; (in-module "Gst") -;; (parent "GstBaseAudioSrc") -;; (c-name "GstAudioSrc") -;; (gtype-id "GST_TYPE_AUDIO_SRC") -;; ) - -(define-object RingBuffer - (in-module "Gst") - (parent "GstObject") - (c-name "GstRingBuffer") - (gtype-id "GST_TYPE_RING_BUFFER") -) - -;; Enumerations and flags ... - -(define-enum BaseAudioSinkSlaveMethod - (in-module "Gst") - (c-name "GstBaseAudioSinkSlaveMethod") - (gtype-id "GST_TYPE_BASE_AUDIO_SINK_SLAVE_METHOD") - (values - '("resample" "GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE") - '("skew" "GST_BASE_AUDIO_SINK_SLAVE_SKEW") - '("none" "GST_BASE_AUDIO_SINK_SLAVE_NONE") - ) -) - -(define-enum BaseAudioSrcSlaveMethod - (in-module "Gst") - (c-name "GstBaseAudioSrcSlaveMethod") - (gtype-id "GST_TYPE_BASE_AUDIO_SRC_SLAVE_METHOD") - (values - '("resample" "GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE") - '("retimestamp" "GST_BASE_AUDIO_SRC_SLAVE_RETIMESTAMP") - '("skew" "GST_BASE_AUDIO_SRC_SLAVE_SKEW") - '("none" "GST_BASE_AUDIO_SRC_SLAVE_NONE") - ) -) - -(define-enum RingBufferState - (in-module "Gst") - (c-name "GstRingBufferState") - (gtype-id "GST_TYPE_RING_BUFFER_STATE") - (values - '("stopped" "GST_RING_BUFFER_STATE_STOPPED") - '("paused" "GST_RING_BUFFER_STATE_PAUSED") - '("started" "GST_RING_BUFFER_STATE_STARTED") - ) -) - -(define-enum RingBufferSegState - (in-module "Gst") - (c-name "GstRingBufferSegState") - (gtype-id "GST_TYPE_RING_BUFFER_SEG_STATE") - (values - '("invalid" "GST_SEGSTATE_INVALID") - '("empty" "GST_SEGSTATE_EMPTY") - '("filled" "GST_SEGSTATE_FILLED") - '("partial" "GST_SEGSTATE_PARTIAL") - ) -) - -(define-enum BufferFormatType - (in-module "Gst") - (c-name "GstBufferFormatType") - (gtype-id "GST_TYPE_BUFFER_FORMAT_TYPE") - (values - '("linear" "GST_BUFTYPE_LINEAR") - '("float" "GST_BUFTYPE_FLOAT") - '("mu-law" "GST_BUFTYPE_MU_LAW") - '("a-law" "GST_BUFTYPE_A_LAW") - '("ima-adpcm" "GST_BUFTYPE_IMA_ADPCM") - '("mpeg" "GST_BUFTYPE_MPEG") - '("gsm" "GST_BUFTYPE_GSM") - '("iec958" "GST_BUFTYPE_IEC958") - '("ac3" "GST_BUFTYPE_AC3") - '("eac3" "GST_BUFTYPE_EAC3") - '("dts" "GST_BUFTYPE_DTS") - ) -) - -(define-enum BufferFormat - (in-module "Gst") - (c-name "GstBufferFormat") - (gtype-id "GST_TYPE_BUFFER_FORMAT") - (values - '("unknown" "GST_UNKNOWN") - '("s8" "GST_S8") - '("u8" "GST_U8") - '("s16-le" "GST_S16_LE") - '("s16-be" "GST_S16_BE") - '("u16-le" "GST_U16_LE") - '("u16-be" "GST_U16_BE") - '("s24-le" "GST_S24_LE") - '("s24-be" "GST_S24_BE") - '("u24-le" "GST_U24_LE") - '("u24-be" "GST_U24_BE") - '("s32-le" "GST_S32_LE") - '("s32-be" "GST_S32_BE") - '("u32-le" "GST_U32_LE") - '("u32-be" "GST_U32_BE") - '("s24-3le" "GST_S24_3LE") - '("s24-3be" "GST_S24_3BE") - '("u24-3le" "GST_U24_3LE") - '("u24-3be" "GST_U24_3BE") - '("s20-3le" "GST_S20_3LE") - '("s20-3be" "GST_S20_3BE") - '("u20-3le" "GST_U20_3LE") - '("u20-3be" "GST_U20_3BE") - '("s18-3le" "GST_S18_3LE") - '("s18-3be" "GST_S18_3BE") - '("u18-3le" "GST_U18_3LE") - '("u18-3be" "GST_U18_3BE") - '("float32-le" "GST_FLOAT32_LE") - '("float32-be" "GST_FLOAT32_BE") - '("float64-le" "GST_FLOAT64_LE") - '("float64-be" "GST_FLOAT64_BE") - '("mu-law" "GST_MU_LAW") - '("a-law" "GST_A_LAW") - '("ima-adpcm" "GST_IMA_ADPCM") - '("mpeg" "GST_MPEG") - '("gsm" "GST_GSM") - '("iec958" "GST_IEC958") - '("ac3" "GST_AC3") - '("eac3" "GST_EAC3") - '("dts" "GST_DTS") - ) -) - -(define-enum AudioChannelPosition - (in-module "Gst") - (c-name "GstAudioChannelPosition") - (gtype-id "GST_TYPE_AUDIO_CHANNEL_POSITION") - (values - '("invalid" "GST_AUDIO_CHANNEL_POSITION_INVALID") - '("front-mono" "GST_AUDIO_CHANNEL_POSITION_FRONT_MONO") - '("front-left" "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT") - '("front-right" "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT") - '("rear-center" "GST_AUDIO_CHANNEL_POSITION_REAR_CENTER") - '("rear-left" "GST_AUDIO_CHANNEL_POSITION_REAR_LEFT") - '("rear-right" "GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT") - '("lfe" "GST_AUDIO_CHANNEL_POSITION_LFE") - '("front-center" "GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER") - '("front-left-of-center" "GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER") - '("front-right-of-center" "GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER") - '("side-left" "GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT") - '("side-right" "GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT") - '("none" "GST_AUDIO_CHANNEL_POSITION_NONE") - '("num" "GST_AUDIO_CHANNEL_POSITION_NUM") - ) -) - - -;; From audio.h - -(define-function frame_byte_size - (c-name "gst_audio_frame_byte_size") - (return-type "int") - (parameters - '("GstPad*" "pad") - ) -) - -(define-function frame_length - (c-name "gst_audio_frame_length") - (return-type "long") - (parameters - '("GstPad*" "pad") - '("GstBuffer*" "buf") - ) -) - -(define-function duration_from_pad_buffer - (c-name "gst_audio_duration_from_pad_buffer") - (return-type "GstClockTime") - (parameters - '("GstPad*" "pad") - '("GstBuffer*" "buf") - ) -) - -(define-function is_buffer_framed - (c-name "gst_audio_is_buffer_framed") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - '("GstBuffer*" "buf") - ) -) - -(define-function buffer_clip - (c-name "gst_audio_buffer_clip") - (return-type "GstBuffer*") - (parameters - '("GstBuffer*" "buffer") - '("GstSegment*" "segment") - '("gint" "rate") - '("gint" "frame_size") - ) -) - - - -;; From gstaudioclock.h - -(define-function gst_audio_clock_get_type - (c-name "gst_audio_clock_get_type") - (return-type "GType") -) - -(define-function gst_audio_clock_new - (c-name "gst_audio_clock_new") - (is-constructor-of "GstAudioClock") - (return-type "GstClock*") - (parameters - '("gchar*" "name") - '("GstAudioClockGetTimeFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-function audio_clock_new_full - (c-name "gst_audio_clock_new_full") - (return-type "GstClock*") - (parameters - '("const-gchar*" "name") - '("GstAudioClockGetTimeFunc" "func") - '("gpointer" "user_data") - '("GDestroyNotify" "destroy_notify") - ) -) - -(define-method reset - (of-object "GstAudioClock") - (c-name "gst_audio_clock_reset") - (return-type "none") - (parameters - '("GstClockTime" "time") - ) -) - -(define-function clock_get_time - (c-name "gst_audio_clock_get_time") - (return-type "GstClockTime") - (parameters - '("GstClock*" "clock") - ) -) - -(define-function clock_adjust - (c-name "gst_audio_clock_adjust") - (return-type "GstClockTime") - (parameters - '("GstClock*" "clock") - '("GstClockTime" "time") - ) -) - -(define-function audio_clock_invalidate - (c-name "gst_audio_clock_invalidate") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -;; From gstaudiofilter.h - -(define-function gst_audio_filter_get_type - (c-name "gst_audio_filter_get_type") - (return-type "GType") -) - -(define-method add_pad_templates - (of-object "GstAudioFilterClass") - (c-name "gst_audio_filter_class_add_pad_templates") - (return-type "none") - (parameters - '("const-GstCaps*" "allowed_caps") - ) -) - -(define-virtual setup - (of-object "GstAudioFilter") - (return-type "gboolean") - (parameters - '("GstRingBufferSpec*" "format") - ) -) - -;; From gstaudiosink.h - -(define-function gst_audio_sink_get_type - (c-name "gst_audio_sink_get_type") - (return-type "GType") -) - -(define-virtual open - (of-object "GstAudioSink") - (return-type "gboolean") -) - -(define-virtual prepare - (of-object "GstAudioSink") - (return-type "gboolean") - (parameters - '("GstRingBufferSpec*" "spec") - ) -) - -(define-virtual unprepare - (of-object "GstAudioSink") - (return-type "gboolean") -) - -(define-virtual close - (of-object "GstAudioSink") - (return-type "gboolean") -) - -(define-virtual write - (of-object "GstAudioSink") - (return-type "guint") - (parameters - '("gpointer" "data") - '("guint" "length") - ) -) - -(define-virtual delay - (of-object "GstAudioSink") - (return-type "guint") -) - -(define-virtual reset - (of-object "GstAudioSink") - (return-type "none") -) - -;; From gstaudiosrc.h - -(define-function gst_audio_src_get_type - (c-name "gst_audio_src_get_type") - (return-type "GType") -) - - - -;; From gstbaseaudiosink.h - -(define-function gst_base_audio_sink_get_type - (c-name "gst_base_audio_sink_get_type") - (return-type "GType") -) - -(define-method create_ringbuffer - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_create_ringbuffer") - (return-type "GstRingBuffer*") -) - -(define-virtual create_ringbuffer - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_create_ringbuffer") - (return-type "GstRingBuffer*") -) -(define-method set_provide_clock - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_set_provide_clock") - (return-type "none") - (parameters - '("gboolean" "provide") - ) -) - -(define-method get_provide_clock - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_get_provide_clock") - (return-type "gboolean") -) - -(define-method set_slave_method - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_set_slave_method") - (return-type "none") - (parameters - '("GstBaseAudioSinkSlaveMethod" "method") - ) -) - -(define-method get_slave_method - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_get_slave_method") - (return-type "GstBaseAudioSinkSlaveMethod") -) - -(define-method set_drift_tolerance - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_set_drift_tolerance") - (return-type "none") - (parameters - '("gint64" "drift_tolerance") - ) -) - -(define-method get_drift_tolerance - (of-object "GstBaseAudioSink") - (c-name "gst_base_audio_sink_get_drift_tolerance") - (return-type "gint64") -) - - - -;; From gstbaseaudiosrc.h - -(define-function gst_base_audio_src_get_type - (c-name "gst_base_audio_src_get_type") - (return-type "GType") -) - -(define-method create_ringbuffer - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_create_ringbuffer") - (return-type "GstRingBuffer*") -) - -(define-virtual create_ringbuffer - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_create_ringbuffer") - (return-type "GstRingBuffer*") -) - -(define-method set_provide_clock - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_set_provide_clock") - (return-type "none") - (parameters - '("gboolean" "provide") - ) -) - -(define-method get_provide_clock - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_get_provide_clock") - (return-type "gboolean") -) - -(define-method set_slave_method - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_set_slave_method") - (return-type "none") - (parameters - '("GstBaseAudioSrcSlaveMethod" "method") - ) -) - -(define-method get_slave_method - (of-object "GstBaseAudioSrc") - (c-name "gst_base_audio_src_get_slave_method") - (return-type "GstBaseAudioSrcSlaveMethod") -) - - - -;; From gstringbuffer.h - -(define-function gst_ring_buffer_get_type - (c-name "gst_ring_buffer_get_type") - (return-type "GType") -) - -(define-method set_callback - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_set_callback") - (return-type "none") - (parameters - '("GstRingBufferCallback" "cb") - '("gpointer" "user_data") - ) -) - -(define-function ring_buffer_parse_caps - (c-name "gst_ring_buffer_parse_caps") - (return-type "gboolean") - (parameters - '("GstRingBufferSpec*" "spec") - '("GstCaps*" "caps") - ) -) - -(define-function ring_buffer_debug_spec_caps - (c-name "gst_ring_buffer_debug_spec_caps") - (return-type "none") - (parameters - '("GstRingBufferSpec*" "spec") - ) -) - -(define-function ring_buffer_debug_spec_buff - (c-name "gst_ring_buffer_debug_spec_buff") - (return-type "none") - (parameters - '("GstRingBufferSpec*" "spec") - ) -) - -(define-method convert - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_fmt") - '("gint64" "src_val") - '("GstFormat" "dest_fmt") - '("gint64*" "dest_val") - ) -) - -(define-method open_device - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_open_device") - (return-type "gboolean") -) - -(define-method close_device - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_close_device") - (return-type "gboolean") -) - -(define-method device_is_open - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_device_is_open") - (return-type "gboolean") -) - -(define-method acquire - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_acquire") - (return-type "gboolean") - (parameters - '("GstRingBufferSpec*" "spec") - ) -) - -(define-method release - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_release") - (return-type "gboolean") -) - -(define-method is_acquired - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_is_acquired") - (return-type "gboolean") -) - -(define-method activate - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_activate") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -(define-method is_active - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_is_active") - (return-type "gboolean") -) - -(define-method set_flushing - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_set_flushing") - (return-type "none") - (parameters - '("gboolean" "flushing") - ) -) - -(define-method start - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_start") - (return-type "gboolean") -) - -(define-method pause - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_pause") - (return-type "gboolean") -) - -(define-method stop - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_stop") - (return-type "gboolean") -) - -(define-method delay - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_delay") - (return-type "guint") -) - -(define-method samples_done - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_samples_done") - (return-type "guint64") -) - -(define-method set_sample - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_set_sample") - (return-type "none") - (parameters - '("guint64" "sample") - ) -) - -(define-method clear_all - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_clear_all") - (return-type "none") -) - -(define-method commit - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_commit") - (return-type "guint") - (parameters - '("guint64" "sample") - '("guchar*" "data") - '("guint" "len") - ) -) - -(define-method commit_full - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_commit_full") - (return-type "guint") - (parameters - '("guint64*" "sample") - '("guchar*" "data") - '("gint" "in_samples") - '("gint" "out_samples") - '("gint*" "accum") - ) -) - -(define-method read - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_read") - (return-type "guint") - (parameters - '("guint64" "sample") - '("guchar*" "data") - '("guint" "len") - ) -) - -(define-method prepare_read - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_prepare_read") - (return-type "gboolean") - (parameters - '("gint*" "segment") - '("guint8**" "readptr") - '("gint*" "len") - ) -) - -(define-method clear - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_clear") - (return-type "none") - (parameters - '("gint" "segment") - ) -) - -(define-method advance - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_advance") - (return-type "none") - (parameters - '("guint" "advance") - ) -) - -(define-method may_start - (of-object "GstRingBuffer") - (c-name "gst_ring_buffer_may_start") - (return-type "none") - (parameters - '("gboolean" "allowed") - ) -) - -(define-virtual open_device - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual acquire - (of-object "GstRingBuffer") - (return-type "gboolean") - (parameters - '("GstRingBufferSpec*" "spec") - ) -) - -(define-virtual release - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual close_device - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual start - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual pause - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual resume - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual stop - (of-object "GstRingBuffer") - (return-type "gboolean") -) - -(define-virtual delay - (of-object "GstRingBuffer") - (return-type "guint") -) - -(define-virtual activate - (of-object "GstRingBuffer") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -;; From mixerutils.h - -(define-function default_registry_mixer_filter - (c-name "gst_audio_default_registry_mixer_filter") - (return-type "GList*") - (parameters - '("GstAudioMixerFilterFunc" "filter_func") - '("gboolean" "first") - '("gpointer" "user_data") - ) -) - - - -;; From multichannel-enumtypes.h - -(define-function gst_audio_channel_position_get_type - (c-name "gst_audio_channel_position_get_type") - (return-type "GType") -) - - - -;; From multichannel.h - -(define-function get_channel_positions - (c-name "gst_audio_get_channel_positions") - (return-type "GstAudioChannelPosition*") - (parameters - '("GstStructure*" "str") - ) -) - -(define-function set_channel_positions - (c-name "gst_audio_set_channel_positions") - (return-type "none") - (parameters - '("GstStructure*" "str") - '("const-GstAudioChannelPosition*" "pos") - ) -) - -(define-function set_structure_channel_positions_list - (c-name "gst_audio_set_structure_channel_positions_list") - (return-type "none") - (parameters - '("GstStructure*" "str") - '("const-GstAudioChannelPosition*" "pos") - '("gint" "num_positions") - ) -) - -(define-function set_caps_channel_positions_list - (c-name "gst_audio_set_caps_channel_positions_list") - (return-type "none") - (parameters - '("GstCaps*" "caps") - '("const-GstAudioChannelPosition*" "pos") - '("gint" "num_positions") - ) -) - -(define-function fixate_channel_positions - (c-name "gst_audio_fixate_channel_positions") - (return-type "GstAudioChannelPosition*") - (parameters - '("GstStructure*" "str") - ) -) - -(define-function check_channel_positions - (c-name "gst_audio_check_channel_positions") - (return-type "gboolean") - (parameters - '("const-GstAudioChannelPosition*" "pos") - '("guint" "channels") - ) -) - - diff --git a/gst/audio.override b/gst/audio.override deleted file mode 100644 index f25234679e..0000000000 --- a/gst/audio.override +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 - * - * 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. - */ -%% -headers - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include "common.h" -#include "pygst.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "pygstminiobject.h" -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/* Boonky define that allows for backwards compatibility with Python 2.4 */ -#if PY_VERSION_HEX < 0x02050000 -#define Py_ssize_t int -#endif - -%% -modulename gst.audio -%% -import gobject.GObject as PyGObject_Type -import gst.Object as PyGstObject_Type -import gst.Structure as PyGstStructure_Type -import gst.Element as PyGstElement_Type -import gst.Pad as PyGstPad_Type -import gst.Buffer as PyGstBuffer_Type -import gst.Message as PyGstMessage_Type -import gst.SystemClock as PyGstSystemClock_Type -import gst.BaseTransform as PyGstBaseTransform_Type -import gst.BaseSink as PyGstBaseSink_Type -import gst.Clock as PyGstClock_Type -%% -include - gstversion.override -%% -ignore-glob - _* - *init - *_free - *_get_type diff --git a/gst/audiomodule.c b/gst/audiomodule.c deleted file mode 100644 index eeab97e01a..0000000000 --- a/gst/audiomodule.c +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 Edward Hervey - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include -#include -#include -#include "pygst.h" - -void pyaudio_register_classes (PyObject * d); -void pyaudio_add_constants (PyObject * module, const gchar * strip_prefix); - -extern PyMethodDef pyaudio_functions[]; - -GST_DEBUG_CATEGORY (pygst_debug); /* for python code */ - -DL_EXPORT (void) -initaudio (void) -{ - PyObject *m, *d; - - init_pygobject (); - pygst_init (); - - m = Py_InitModule ("audio", pyaudio_functions); - d = PyModule_GetDict (m); - - pyaudio_register_classes (d); - pyaudio_add_constants (m, "GST_"); - - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.audio"); - } -} diff --git a/gst/base.defs b/gst/base.defs deleted file mode 100644 index 16aa6923a6..0000000000 --- a/gst/base.defs +++ /dev/null @@ -1,1164 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object Adapter - (in-module "Gst") - (parent "GObject") - (c-name "GstAdapter") - (gtype-id "GST_TYPE_ADAPTER") -) - -(define-object BaseSink - (in-module "Gst") - (parent "GstElement") - (c-name "GstBaseSink") - (gtype-id "GST_TYPE_BASE_SINK") -) - -(define-object BaseSrc - (in-module "Gst") - (parent "GstElement") - (c-name "GstBaseSrc") - (gtype-id "GST_TYPE_BASE_SRC") -) - -(define-object BaseTransform - (in-module "Gst") - (parent "GstElement") - (c-name "GstBaseTransform") - (gtype-id "GST_TYPE_BASE_TRANSFORM") -) - -(define-object CollectPads - (in-module "Gst") - (parent "GstObject") - (c-name "GstCollectPads") - (gtype-id "GST_TYPE_COLLECT_PADS") -) - -(define-object DataQueue - (in-module "Gst") - (parent "GObject") - (c-name "GstDataQueue") - (gtype-id "GST_TYPE_DATA_QUEUE") -) - -; PushSrc doesn't work due to limitations in the code generator, so disable -;(define-object PushSrc -; (in-module "Gst") -; (parent "GstBaseSrc") -; (c-name "GstPushSrc") -; (gtype-id "GST_TYPE_PUSH_SRC") -;) - -;; Enumerations and flags ... - -; (define-flags BaseSrcFlags -; (in-module "Gst") -; (c-name "GstBaseSrcFlags") -; (gtype-id "GST_TYPE_BASE_SRC_FLAGS") -; (values -; '("started" "GST_BASE_SRC_STARTED") -; '("flag-last" "GST_BASE_SRC_FLAG_LAST") -; ) -; ) - - -;; From ../gstreamer/libs/gst/base/gstadapter.h - -(define-function gst_adapter_new - (c-name "gst_adapter_new") - (is-constructor-of "GstAdapter") - (return-type "GstAdapter*") -) - -(define-method clear - (of-object "GstAdapter") - (c-name "gst_adapter_clear") - (return-type "none") -) - -(define-method push - (of-object "GstAdapter") - (c-name "gst_adapter_push") - (return-type "none") - (parameters - '("GstBuffer*" "buf" (keep-refcount)) - ) -) - -(define-method peek - (of-object "GstAdapter") - (c-name "gst_adapter_peek") - (return-type "const-guint8*") - (parameters - '("guint" "size") - ) -) - -(define-method copy - (of-object "GstAdapter") - (c-name "gst_adapter_copy") - (return-type "none") - (parameters - '("guint8*" "dest") - '("guint" "offset") - '("guint" "size") - ) -) - -(define-method flush - (of-object "GstAdapter") - (c-name "gst_adapter_flush") - (return-type "none") - (parameters - '("guint" "flush") - ) -) - -(define-method take - (of-object "GstAdapter") - (c-name "gst_adapter_take") - (return-type "guint8*") - (caller-owns-return #t) - (parameters - '("guint" "nbytes") - ) -) - -(define-method take_buffer - (of-object "GstAdapter") - (c-name "gst_adapter_take_buffer") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("guint" "nbytes") - ) -) - -(define-method take_list - (of-object "GstAdapter") - (c-name "gst_adapter_take_list") - (return-type "GList*") - (parameters - '("guint" "nbytes") - ) -) - -(define-method available - (of-object "GstAdapter") - (c-name "gst_adapter_available") - (return-type "guint") -) - -(define-method available_fast - (of-object "GstAdapter") - (c-name "gst_adapter_available_fast") - (return-type "guint") -) - -(define-method prev_timestamp - (of-object "GstAdapter") - (c-name "gst_adapter_prev_timestamp") - (return-type "GstClockTime") - (parameters - '("guint64*" "distance") - ) -) - -(define-method masked_scan_uint32 - (of-object "GstAdapter") - (c-name "gst_adapter_masked_scan_uint32") - (return-type "guint") - (parameters - '("guint32" "mask") - '("guint32" "pattern") - '("guint" "offset") - '("guint" "size") - ) -) - -(define-method masked_scan_uint32_peek - (of-object "GstAdapter") - (c-name "gst_adapter_masked_scan_uint32_peek") - (return-type "guint") - (parameters - '("guint32" "mask") - '("guint32" "pattern") - '("guint" "offset") - '("guint" "size") - '("guint32*" "value") - ) -) - -(define-function gst_adapter_get_type - (c-name "gst_adapter_get_type") - (return-type "GType") -) - - - -;; From ../gstreamer/libs/gst/base/gstbasesink.h - -(define-function gst_base_sink_get_type - (c-name "gst_base_sink_get_type") - (return-type "GType") -) - -(define-method wait_preroll - (of-object "GstBaseSink") - (c-name "gst_base_sink_wait_preroll") - (return-type "GstFlowReturn") -) - -(define-method set_sync - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_sync") - (return-type "none") - (parameters - '("gboolean" "sync") - ) -) - -(define-method get_sync - (of-object "GstBaseSink") - (c-name "gst_base_sink_get_sync") - (return-type "gboolean") -) - -(define-method set_max_lateness - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_max_lateness") - (return-type "none") - (parameters - '("gint64" "max_lateness") - ) -) - -(define-method get_max_lateness - (of-object "GstBaseSink") - (c-name "gst_base_sink_get_max_lateness") - (return-type "gint64") -) - -(define-method set_qos_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_qos_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-method is_qos_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_is_qos_enabled") - (return-type "gboolean") -) - -(define-method set_async_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_async_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-method is_async_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_is_async_enabled") - (return-type "gboolean") -) - -(define-method set_ts_offset - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_ts_offset") - (return-type "none") - (parameters - '("GstClockTimeDiff" "offset") - ) -) - -(define-method get_ts_offset - (of-object "GstBaseSink") - (c-name "gst_base_sink_get_ts_offset") - (return-type "GstClockTimeDiff") -) - -(define-method get_last_buffer - (of-object "GstBaseSink") - (c-name "gst_base_sink_get_last_buffer") - (return-type "GstBuffer*") - (caller-owns-return #t) -) - -(define-method set_last_buffer_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_set_last_buffer_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-method is_last_buffer_enabled - (of-object "GstBaseSink") - (c-name "gst_base_sink_is_last_buffer_enabled") - (return-type "gboolean") -) - -(define-method query_latency - (of-object "GstBaseSink") - (c-name "gst_base_sink_query_latency") - (return-type "gboolean") - (parameters - '("gboolean*" "live") - '("gboolean*" "upstream_live") - '("GstClockTime*" "min_latency") - '("GstClockTime*" "max_latency") - ) -) - -(define-method get_latency - (of-object "GstBaseSink") - (c-name "gst_base_sink_get_latency") - (return-type "GstClockTime") -) - -(define-method wait_eos - (of-object "GstBaseSink") - (c-name "gst_base_sink_wait_eos") - (return-type "GstFlowReturn") - (parameters - '("GstClockTime" "time") - '("GstClockTimeDiff*" "jitter") - ) -) - -(define-virtual get_caps - (of-object "GstBaseSink") - (return-type "GstCaps*") -) - -(define-virtual set_caps - (of-object "GstBaseSink") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-virtual buffer_alloc - (of-object "GstBaseSink") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("guint" "size") - '("GstCaps*" "caps") - '("GstBuffer**" "buffer") - ) -) - -(define-virtual get_times - (of-object "GstBaseSink") - (return-type "none") - (parameters - '("GstBuffer*" "buffer") - '("GstClockTime*" "start") - '("GstClockTime*" "end") - ) -) - -(define-virtual start - (of-object "GstBaseSink") - (return-type "gboolean") -) - -(define-virtual stop - (of-object "GstBaseSink") - (return-type "gboolean") -) - -(define-virtual unlock - (of-object "GstBaseSink") - (return-type "gboolean") -) - -(define-virtual event - (of-object "GstBaseSink") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -(define-virtual preroll - (of-object "GstBaseSink") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "buffer") - ) -) - -(define-virtual render - (of-object "GstBaseSink") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "buffer") - ) -) - -(define-virtual activate_pull - (of-object "GstBaseSink") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -(define-virtual fixate - (of-object "GstBaseSink") - (return-type "none") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-virtual unlock_stop - (of-object "GstBaseSink") - (return-type "gboolean") -) - -;; From ../gstreamer/libs/gst/base/gstbasesrc.h - -(define-function gst_base_src_get_type - (c-name "gst_base_src_get_type") - (return-type "GType") -) - -(define-method wait_playing - (of-object "GstBaseSrc") - (c-name "gst_base_src_wait_playing") - (return-type "GstFlowReturn") -) - -(define-method set_live - (of-object "GstBaseSrc") - (c-name "gst_base_src_set_live") - (return-type "none") - (parameters - '("gboolean" "live") - ) -) - -(define-method is_live - (of-object "GstBaseSrc") - (c-name "gst_base_src_is_live") - (return-type "gboolean") -) - -(define-method set_format - (of-object "GstBaseSrc") - (c-name "gst_base_src_set_format") - (return-type "none") - (parameters - '("GstFormat" "format") - ) -) - -(define-method query_latency - (of-object "GstBaseSrc") - (c-name "gst_base_src_query_latency") - (return-type "gboolean") - (parameters - '("gboolean*" "live") - '("GstClockTime*" "min_latency") - '("GstClockTime*" "max_latency") - ) -) - -(define-method set_do_timestamp - (of-object "GstBaseSrc") - (c-name "gst_base_src_set_do_timestamp") - (return-type "none") - (parameters - '("gboolean" "timestamp") - ) -) - -(define-method get_do_timestamp - (of-object "GstBaseSrc") - (c-name "gst_base_src_get_do_timestamp") - (return-type "gboolean") -) - -(define-method new_seamless_segment - (of-object "GstBaseSrc") - (c-name "gst_base_src_new_seamless_segment") - (return-type "gboolean") - (parameters - '("gint64" "start") - '("gint64" "stop") - '("gint64" "position") - ) -) - -(define-virtual get_caps - (of-object "GstBaseSrc") - (return-type "GstCaps*") -) - -(define-virtual set_caps - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-virtual negotiate - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual newsegment - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual start - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual stop - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual get_times - (of-object "GstBaseSrc") - (return-type "none") - (parameters - '("GstBuffer*" "buffer") - '("GstClockTime*" "start") - '("GstClockTime*" "end") - ) -) - -(define-virtual get_size - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("guint64*" "size") - ) -) - -(define-virtual is_seekable - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual unlock - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual event - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -(define-virtual create - (of-object "GstBaseSrc") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("guint" "size") - '("GstBuffer**" "buf") - ) -) - -(define-virtual do_seek - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("GstSegment*" "segment") - ) -) - -(define-virtual query - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-virtual check_get_range - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual fixate - (of-object "GstBaseSrc") - (return-type "none") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-virtual unlock_stop - (of-object "GstBaseSrc") - (return-type "gboolean") -) - -(define-virtual prepare_seek_segment - (of-object "GstBaseSrc") - (return-type "gboolean") - (parameters - '("GstEvent*" "seek") - '("GstSegment*" "segment") - ) -) - - -;; From ../gstreamer/libs/gst/base/gstbasetransform.h - -(define-function gst_base_transform_get_type - (c-name "gst_base_transform_get_type") - (return-type "GType") -) - -(define-method set_passthrough - (of-object "GstBaseTransform") - (c-name "gst_base_transform_set_passthrough") - (return-type "none") - (parameters - '("gboolean" "passthrough") - ) -) - -(define-method is_passthrough - (of-object "GstBaseTransform") - (c-name "gst_base_transform_is_passthrough") - (return-type "gboolean") -) - -(define-method set_in_place - (of-object "GstBaseTransform") - (c-name "gst_base_transform_set_in_place") - (return-type "none") - (parameters - '("gboolean" "in_place") - ) -) - -(define-method is_in_place - (of-object "GstBaseTransform") - (c-name "gst_base_transform_is_in_place") - (return-type "gboolean") -) - -(define-method update_qos - (of-object "GstBaseTransform") - (c-name "gst_base_transform_update_qos") - (return-type "none") - (parameters - '("gdouble" "proportion") - '("GstClockTimeDiff" "diff") - '("GstClockTime" "timestamp") - ) -) - -(define-method set_qos_enabled - (of-object "GstBaseTransform") - (c-name "gst_base_transform_set_qos_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-method is_qos_enabled - (of-object "GstBaseTransform") - (c-name "gst_base_transform_is_qos_enabled") - (return-type "gboolean") -) - -(define-method set_gap_aware - (of-object "GstBaseTransform") - (c-name "gst_base_transform_set_gap_aware") - (return-type "none") - (parameters - '("gboolean" "gap_aware") - ) -) - -(define-method suggest - (of-object "GstBaseTransform") - (c-name "gst_base_transform_suggest") - (return-type "none") - (parameters - '("GstCaps*" "caps" (null-ok)) - '("guint" "size") - ) -) - -(define-method reconfigure - (of-object "GstBaseTransform") - (c-name "gst_base_transform_reconfigure") - (return-type "none") -) - -(define-virtual transform_caps - (of-object "GstBaseTransform") - (return-type "GstCaps*") - (parameters - '("GstPadDirection" "direction") - '("GstCaps*" "caps") - ) -) - -(define-virtual fixate_caps - (of-object "GstBaseTransform") - (return-type "none") - (parameters - '("GstPadDirection" "direction") - '("GstCaps*" "caps") - '("GstCaps*" "othercaps") - ) -) - -(define-virtual transform_size - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstPadDirection" "direction") - '("GstCaps*" "caps") - '("guint" "size") - '("GstCaps*" "othercaps") - '("guint*" "othersize") - ) -) - -(define-virtual get_unit_size - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("guint*" "size") - ) -) - -(define-virtual transform_size - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("guint*" "size") - '("GstCaps*" "othercaps") - '("guint*" "othersize") - ) -) - -(define-virtual set_caps - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstCaps*" "incaps") - '("GstCaps*" "outcaps") - ) -) - -(define-virtual start - (of-object "GstBaseTransform") - (return-type "gboolean") -) - -(define-virtual stop - (of-object "GstBaseTransform") - (return-type "gboolean") -) - -(define-virtual event - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -(define-virtual transform - (of-object "GstBaseTransform") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "inbuf") - '("GstBuffer*" "outbuf") - ) -) - -(define-virtual transform_ip - (of-object "GstBaseTransform") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "buf") - ) -) - -(define-virtual prepare_output_buffer - (of-object "GstBaseTransform") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "input") - '("gint" "size") - '("GstCaps*" "caps") - '("GstBuffer**" "buf") - ) -) - -(define-virtual src_event - (of-object "GstBaseTransform") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -;; From ../gstreamer/libs/gst/base/gstcollectpads.h - -(define-function gst_collect_pads_get_type - (c-name "gst_collect_pads_get_type") - (return-type "GType") -) - -(define-function collect_pads_new - (c-name "gst_collect_pads_new") - (is-constructor-of "GstCollectPads") - (return-type "GstCollectPads*") -) - -(define-method set_function - (of-object "GstCollectPads") - (c-name "gst_collect_pads_set_function") - (return-type "none") - (parameters - '("GstCollectPadsFunction" "func") - '("gpointer" "user_data") - ) -) - -(define-method set_clip_function - (of-object "GstCollectPads") - (c-name "gst_collect_pads_set_clip_function") - (return-type "none") - (parameters - '("GstCollectPadsClipFunction" "clipfunc") - '("gpointer" "user_data") - ) -) - -(define-method add_pad - (of-object "GstCollectPads") - (c-name "gst_collect_pads_add_pad") - (return-type "GstCollectData*") - (parameters - '("GstPad*" "pad") - '("guint" "size") - ) -) - -(define-method add_pad_full - (of-object "GstCollectPads") - (c-name "gst_collect_pads_add_pad_full") - (return-type "GstCollectData*") - (parameters - '("GstPad*" "pad") - '("guint" "size") - '("GstCollectDataDestroyNotify" "destroy_notify") - ) -) - -(define-method remove_pad - (of-object "GstCollectPads") - (c-name "gst_collect_pads_remove_pad") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - ) -) - -(define-method is_active - (of-object "GstCollectPads") - (c-name "gst_collect_pads_is_active") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - ) -) - -(define-method collect - (of-object "GstCollectPads") - (c-name "gst_collect_pads_collect") - (return-type "GstFlowReturn") -) - -(define-method collect_range - (of-object "GstCollectPads") - (c-name "gst_collect_pads_collect_range") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("guint" "length") - ) -) - -(define-method start - (of-object "GstCollectPads") - (c-name "gst_collect_pads_start") - (return-type "none") -) - -(define-method stop - (of-object "GstCollectPads") - (c-name "gst_collect_pads_stop") - (return-type "none") -) - -(define-method set_flushing - (of-object "GstCollectPads") - (c-name "gst_collect_pads_set_flushing") - (return-type "none") - (parameters - '("gboolean" "flushing") - ) -) - -(define-method peek - (of-object "GstCollectPads") - (c-name "gst_collect_pads_peek") - (return-type "GstBuffer*") - (parameters - '("GstCollectData*" "data") - ) -) - -(define-method pop - (of-object "GstCollectPads") - (c-name "gst_collect_pads_pop") - (return-type "GstBuffer*") - (parameters - '("GstCollectData*" "data") - ) -) - -(define-method available - (of-object "GstCollectPads") - (c-name "gst_collect_pads_available") - (return-type "guint") -) - -(define-method read - (of-object "GstCollectPads") - (c-name "gst_collect_pads_read") - (return-type "guint") - (parameters - '("GstCollectData*" "data") - '("guint8**" "bytes") - '("guint" "size") - ) -) - -(define-method read_buffer - (of-object "GstCollectPads") - (c-name "gst_collect_pads_read_buffer") - (return-type "GstBuffer*") - (parameters - '("GstCollectData*" "data") - '("guint" "size") - ) -) - -(define-method take_buffer - (of-object "GstCollectPads") - (c-name "gst_collect_pads_take_buffer") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("GstCollectData*" "data") - '("guint" "size") - ) -) - -(define-method flush - (of-object "GstCollectPads") - (c-name "gst_collect_pads_flush") - (return-type "guint") - (parameters - '("GstCollectData*" "data") - '("guint" "size") - ) -) - - - -;; From ../gstreamer/libs/gst/base/gstpushsrc.h - -;(define-function gst_push_src_get_type -; (c-name "gst_push_src_get_type") -; (return-type "GType") -;) - -;(define-virtual create -; (of-object "GstPushSrc") -; (return-type "GstFlowReturn") -; (parameters -; '("GstBuffer**" "buf") -; ) -;) - - - -;; From ../gstreamer/libs/gst/base/gsttypefindhelper.h - -(define-function type_find_helper - (c-name "gst_type_find_helper") - (return-type "GstCaps*") - (parameters - '("GstPad*" "src") - '("guint64" "size") - ) -) - -(define-function type_find_helper_for_buffer - (c-name "gst_type_find_helper_for_buffer") - (return-type "GstCaps*") - (parameters - '("GstObject*" "obj") - '("GstBuffer*" "buf") - '("GstTypeFindProbability*" "prob") - ) -) - -(define-function type_find_helper_get_range - (c-name "gst_type_find_helper_get_range") - (return-type "GstCaps*") - (parameters - '("GstObject*" "obj") - '("GstTypeFindHelperGetRangeFunction" "func") - '("guint64" "size") - '("GstTypeFindProbability*" "prob") - ) -) - -(define-function type_find_helper_get_range_ext - (c-name "gst_type_find_helper_get_range_ext") - (return-type "GstCaps*") - (parameters - '("GstObject*" "obj") - '("GstTypeFindHelperGetRangeFunction" "func") - '("guint64" "size") - '("const-gchar*" "extension") - '("GstTypeFindProbability*" "prob") - ) -) - -(define-function type_find_helper_for_extension - (c-name "gst_type_find_helper_for_extension") - (return-type "GstCaps*") - (parameters - '("GstObject*" "obj") - '("const-gchar*" "extension") - ) -) - -;; From gstdataqueue.h - -(define-function gst_data_queue_get_type - (c-name "gst_data_queue_get_type") - (return-type "GType") -) - -(define-function gst_data_queue_new - (c-name "gst_data_queue_new") - (is-constructor-of "GstDataQueue") - (return-type "GstDataQueue*") - (parameters - '("GstDataQueueCheckFullFunction" "checkfull") - '("gpointer" "checkdata") - ) -) - -(define-method push - (of-object "GstDataQueue") - (c-name "gst_data_queue_push") - (return-type "gboolean") - (parameters - '("GstDataQueueItem*" "item") - ) -) - -(define-method pop - (of-object "GstDataQueue") - (c-name "gst_data_queue_pop") - (return-type "gboolean") - (parameters - '("GstDataQueueItem**" "item") - ) -) - -(define-method flush - (of-object "GstDataQueue") - (c-name "gst_data_queue_flush") - (return-type "none") -) - -(define-method set_flushing - (of-object "GstDataQueue") - (c-name "gst_data_queue_set_flushing") - (return-type "none") - (parameters - '("gboolean" "flushing") - ) -) - -(define-method drop_head - (of-object "GstDataQueue") - (c-name "gst_data_queue_drop_head") - (return-type "gboolean") - (parameters - '("GType" "type") - ) -) - -(define-method is_full - (of-object "GstDataQueue") - (c-name "gst_data_queue_is_full") - (return-type "gboolean") -) - -(define-method is_empty - (of-object "GstDataQueue") - (c-name "gst_data_queue_is_empty") - (return-type "gboolean") -) - -(define-method get_level - (of-object "GstDataQueue") - (c-name "gst_data_queue_get_level") - (return-type "none") - (parameters - '("GstDataQueueSize*" "level") - ) -) - -(define-method limits_changed - (of-object "GstDataQueue") - (c-name "gst_data_queue_limits_changed") - (return-type "none") -) - - diff --git a/gst/common.h b/gst/common.h deleted file mode 100644 index 5d2185478e..0000000000 --- a/gst/common.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 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: Johan Dahlin - */ -#ifndef __COMMON_H__ -#define __COMMON_H__ - -#include -#include -#include -#include -#include - -#include "pygstminiobject.h" - -#if (defined HAVE_OLD_PYGTK && (PY_VERSION_HEX < 0x02030000)) - typedef destructor freefunc; -#endif - -#if PY_VERSION_HEX < 0x02050000 -#define lenfunc inquiry -#define ssizeargfunc intargfunc -#define ssizessizeargfunc intintargfunc -#define ssizeobjargproc intobjargproc -#define ssizessizeobjargproc intintobjargproc -#endif - -typedef struct { - PyGObject *pad; - GClosure *link_function; - GClosure *event_function; - GClosure *chain_function; - GClosure *get_function; - GClosure *getcaps_function; - GClosure *setcaps_function; - GClosure *activate_function; - GClosure *activatepull_function; - GClosure *activatepush_function; - /* Query is not implemented as a closure to avoid refcounting - * making the query immutable and therefore useless */ - PyObject *query_function; -} PyGstPadPrivate; - -typedef struct { - PyObject *func, *data; -} PyGstCustomNotify; - -typedef struct { - PyObject_HEAD - GstIterator *iter; -} PyGstIterator; - -extern PyTypeObject PyGstIterator_Type; - - -#endif /* __COMMON_H__ */ diff --git a/gst/extend/.gitignore b/gst/extend/.gitignore deleted file mode 100644 index 0d20b6487c..0000000000 --- a/gst/extend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/gst/extend/Makefile.am b/gst/extend/Makefile.am deleted file mode 100644 index f1ed499e51..0000000000 --- a/gst/extend/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -pkgpyexecdir = $(pyexecdir)/gst-$(GST_MAJORMINOR)/gst/extend - -pygstdir = $(pkgpyexecdir) -pygst_PYTHON = __init__.py pygobject.py utils.py discoverer.py sources.py \ - leveller.py jukebox.py diff --git a/gst/extend/__init__.py b/gst/extend/__init__.py deleted file mode 100644 index 350c71d2ce..0000000000 --- a/gst/extend/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# GStreamer python bindings -# 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 Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/gst/extend/discoverer.py b/gst/extend/discoverer.py deleted file mode 100644 index 55e761786c..0000000000 --- a/gst/extend/discoverer.py +++ /dev/null @@ -1,355 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 - -# discoverer.py -# (c) 2005-2008 Edward Hervey -# Discovers multimedia information on files - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -""" -Class and functions for getting multimedia information about files -""" - -import os.path - -import gobject - -import gst - -from gst.extend.pygobject import gsignal - -class Discoverer(gst.Pipeline): - """ - Discovers information about files. - This class is event-based and needs a mainloop to work properly. - Emits the 'discovered' signal when discovery is finished. - - The 'discovered' callback has one boolean argument, which is True if the - file contains decodable multimedia streams. - """ - __gsignals__ = { - 'discovered' : (gobject.SIGNAL_RUN_FIRST, - None, - (gobject.TYPE_BOOLEAN, )) - } - - mimetype = None - - audiocaps = {} - videocaps = {} - - videowidth = 0 - videoheight = 0 - videorate = 0 - - audiofloat = False - audiorate = 0 - audiodepth = 0 - audiowidth = 0 - audiochannels = 0 - - audiolength = 0L - videolength = 0L - - is_video = False - is_audio = False - - otherstreams = [] - - finished = False - sinknumber = 0 - tags = {} - - - def __init__(self, filename, max_interleave=1.0, timeout=3000): - """ - filename: str; absolute path of the file to be discovered. - max_interleave: int or float; the maximum frame interleave in seconds. - The value must be greater than the input file frame interleave - or the discoverer may not find out all input file's streams. - The default value is 1 second and you shouldn't have to change it, - changing it mean larger discovering time and bigger memory usage. - timeout: int; duration in ms for the discovery to complete. - """ - gobject.GObject.__init__(self) - - self.mimetype = None - - self.audiocaps = {} - self.videocaps = {} - - self.videowidth = 0 - self.videoheight = 0 - self.videorate = gst.Fraction(0,1) - - self.audiofloat = False - self.audiorate = 0 - self.audiodepth = 0 - self.audiowidth = 0 - self.audiochannels = 0 - - self.audiolength = 0L - self.videolength = 0L - - self.is_video = False - self.is_audio = False - - self.otherstreams = [] - - self.finished = False - self.tags = {} - self._success = False - self._nomorepads = False - - self._timeoutid = 0 - self._timeout = timeout - self._max_interleave = max_interleave - - if not os.path.isfile(filename): - self.debug("File '%s' does not exist, finished" % filename) - self.finished = True - return - - # the initial elements of the pipeline - self.src = gst.element_factory_make("filesrc") - self.src.set_property("location", filename) - self.src.set_property("blocksize", 1000000) - self.dbin = gst.element_factory_make("decodebin") - self.add(self.src, self.dbin) - self.src.link(self.dbin) - self.typefind = self.dbin.get_by_name("typefind") - - # callbacks - self.typefind.connect("have-type", self._have_type_cb) - self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb) - self.dbin.connect("no-more-pads", self._no_more_pads_cb) - self.dbin.connect("unknown-type", self._unknown_type_cb) - - def _timed_out_or_eos(self): - if (not self.is_audio and not self.is_video) or \ - (self.is_audio and not self.audiocaps) or \ - (self.is_video and not self.videocaps): - self._finished(False) - else: - self._finished(True) - - def _finished(self, success=False): - self.debug("success:%d" % success) - self._success = success - self.bus.remove_signal_watch() - if self._timeoutid: - gobject.source_remove(self._timeoutid) - self._timeoutid = 0 - gobject.idle_add(self._stop) - return False - - def _stop(self): - self.debug("success:%d" % self._success) - self.finished = True - self.set_state(gst.STATE_READY) - self.debug("about to emit signal") - self.emit('discovered', self._success) - - def _bus_message_cb(self, bus, message): - if message.type == gst.MESSAGE_EOS: - self.debug("Got EOS") - self._timed_out_or_eos() - elif message.type == gst.MESSAGE_TAG: - for key in message.parse_tag().keys(): - self.tags[key] = message.structure[key] - elif message.type == gst.MESSAGE_ERROR: - self.debug("Got error") - self._finished() - - def discover(self): - """Find the information on the given file asynchronously""" - self.debug("starting discovery") - if self.finished: - self.emit('discovered', False) - return - - self.bus = self.get_bus() - self.bus.add_signal_watch() - self.bus.connect("message", self._bus_message_cb) - - # 3s timeout - self._timeoutid = gobject.timeout_add(self._timeout, self._timed_out_or_eos) - - self.info("setting to PLAY") - if not self.set_state(gst.STATE_PLAYING): - self._finished() - - def _time_to_string(self, value): - """ - transform a value in nanoseconds into a human-readable string - """ - ms = value / gst.MSECOND - sec = ms / 1000 - ms = ms % 1000 - min = sec / 60 - sec = sec % 60 - return "%2dm %2ds %3d" % (min, sec, ms) - - def print_info(self): - """prints out the information on the given file""" - if not self.finished: - return - if not self.mimetype: - print "Unknown media type" - return - print "Mime Type :\t", self.mimetype - if not self.is_video and not self.is_audio: - return - print "Length :\t", self._time_to_string(max(self.audiolength, self.videolength)) - print "\tAudio:", self._time_to_string(self.audiolength), "\tVideo:", self._time_to_string(self.videolength) - if self.is_video and self.videorate: - print "Video :" - print "\t%d x %d @ %d/%d fps" % (self.videowidth, - self.videoheight, - self.videorate.num, self.videorate.denom) - if self.tags.has_key("video-codec"): - print "\tCodec :", self.tags["video-codec"] - if self.is_audio: - print "Audio :" - if self.audiofloat: - print "\t%d channels(s) : %dHz @ %dbits (float)" % (self.audiochannels, - self.audiorate, - self.audiowidth) - else: - print "\t%d channels(s) : %dHz @ %dbits (int)" % (self.audiochannels, - self.audiorate, - self.audiodepth) - if self.tags.has_key("audio-codec"): - print "\tCodec :", self.tags["audio-codec"] - for stream in self.otherstreams: - if not stream == self.mimetype: - print "Other unsuported Multimedia stream :", stream - if self.tags: - print "Additional information :" - for tag in self.tags.keys(): - print "%20s :\t" % tag, self.tags[tag] - - def _no_more_pads_cb(self, dbin): - self.info("no more pads") - self._nomorepads = True - - def _unknown_type_cb(self, dbin, pad, caps): - self.debug("unknown type : %s" % caps.to_string()) - # if we get an unknown type and we don't already have an - # audio or video pad, we are finished ! - self.otherstreams.append(caps.to_string()) - if not self.is_video and not self.is_audio: - self.finished = True - self._finished() - - def _have_type_cb(self, typefind, prob, caps): - self.mimetype = caps.to_string() - - def _notify_caps_cb(self, pad, args): - caps = pad.get_negotiated_caps() - if not caps: - pad.info("no negotiated caps available") - return - pad.info("caps:%s" % caps.to_string()) - # the caps are fixed - # We now get the total length of that stream - q = gst.query_new_duration(gst.FORMAT_TIME) - pad.info("sending duration query") - if pad.get_peer().query(q): - format, length = q.parse_duration() - if format == gst.FORMAT_TIME: - pad.info("got duration (time) : %s" % (gst.TIME_ARGS(length),)) - else: - pad.info("got duration : %d [format:%d]" % (length, format)) - else: - length = -1 - gst.warning("duration query failed") - - # We store the caps and length in the proper location - if "audio" in caps.to_string(): - self.audiocaps = caps - self.audiolength = length - self.audiorate = caps[0]["rate"] - self.audiowidth = caps[0]["width"] - self.audiochannels = caps[0]["channels"] - if "x-raw-float" in caps.to_string(): - self.audiofloat = True - else: - self.audiodepth = caps[0]["depth"] - if self._nomorepads and ((not self.is_video) or self.videocaps): - self._finished(True) - elif "video" in caps.to_string(): - self.videocaps = caps - self.videolength = length - self.videowidth = caps[0]["width"] - self.videoheight = caps[0]["height"] - self.videorate = caps[0]["framerate"] - if self._nomorepads and ((not self.is_audio) or self.audiocaps): - self._finished(True) - - def _new_decoded_pad_cb(self, dbin, pad, is_last): - # Does the file contain got audio or video ? - caps = pad.get_caps() - gst.info("caps:%s" % caps.to_string()) - if "audio" in caps.to_string(): - self.is_audio = True - elif "video" in caps.to_string(): - self.is_video = True - else: - self.warning("got a different caps.. %s" % caps.to_string()) - return - if is_last and not self.is_video and not self.is_audio: - self.debug("is last, not video or audio") - self._finished(False) - return - # we connect a fakesink to the new pad... - pad.info("adding queue->fakesink") - fakesink = gst.element_factory_make("fakesink", "fakesink%d-%s" % - (self.sinknumber, "audio" in caps.to_string() and "audio" or "video")) - self.sinknumber += 1 - queue = gst.element_factory_make("queue") - # we want the queue to buffer up to the specified amount of data - # before outputting. This enables us to cope with formats - # that don't create their source pads straight away, - # but instead wait for the first buffer of that stream. - # The specified time must be greater than the input file - # frame interleave for the discoverer to work properly. - queue.props.min_threshold_time = int(self._max_interleave * gst.SECOND) - queue.props.max_size_time = int(2 * self._max_interleave * gst.SECOND) - queue.props.max_size_bytes = 0 - - # If durations are bad on the buffers (common for video decoders), we'll - # never reach the min_threshold_time or max_size_time. So, set a - # max size in buffers, and if reached, disable the min_threshold_time. - # This ensures we don't fail to discover with various ffmpeg - # demuxers/decoders that provide bogus (or no) duration. - queue.props.max_size_buffers = int(100 * self._max_interleave) - def _disable_min_threshold_cb(queue): - queue.props.min_threshold_time = 0 - queue.disconnect(signal_id) - signal_id = queue.connect('overrun', _disable_min_threshold_cb) - - self.add(fakesink, queue) - queue.link(fakesink) - sinkpad = fakesink.get_pad("sink") - queuepad = queue.get_pad("sink") - # ... and connect a callback for when the caps are fixed - sinkpad.connect("notify::caps", self._notify_caps_cb) - if pad.link(queuepad): - pad.warning("##### Couldn't link pad to queue") - queue.set_state(gst.STATE_PLAYING) - fakesink.set_state(gst.STATE_PLAYING) - gst.info('finished here') diff --git a/gst/extend/jukebox.py b/gst/extend/jukebox.py deleted file mode 100644 index c29b7424f7..0000000000 --- a/gst/extend/jukebox.py +++ /dev/null @@ -1,356 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# GStreamer python bindings -# Copyright (C) 2005 Edward Hervey -# Copyright (C) 2005 Thomas Vander Stichele - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os -import sys -import pickle -import random as rand - -import gobject -gobject.threads_init() -import pygst -pygst.require('0.10') -import gst - -import utils -from pygobject import gsignal -import sources -from leveller import Leveller - -class Jukebox(gst.Bin): - gsignal('done', str) - gsignal('prerolled') # emitted when at least 2 sources are ready - gsignal('changed', str, gobject.TYPE_UINT64) # clocktime, filename - gsignal('looped') - - def __init__(self, files, rms=0.2, loops=0, random=False, - caps="audio/x-raw-int,channels=2,rate=44100", - picklepath='level.pck'): - # with pygtk 2.4 this call is needed for the gsignal to work - self.__gobject_init__() - - self._target_rms = rms - self._loopsleft = loops - self._loopsdone = 0 - self._random = random - self._picklepath = picklepath - self._caps = gst.caps_from_string(caps) - self._files = files[:] # copy - self._levels = {} # filename -> rms, mixin, mixout, length - self._prerolled = False - self._playing = False - self._scani = 0 # index into self._files for scanning - self._playi = 0 # index into self._files for playing - - self._lastadded = None # last file added to composition - self._lastposition = long(0) # last position where file was added - - if not len(files) > 1: - raise TypeError, 'Must have at least 2 files' - - self._composition = gst.element_factory_make("gnlcomposition") - self._composition.connect('pad-added', self._composition_pad_added_cb) - self.add(self._composition) - - self._srcpad = None - - # load our pickle if it exists - if os.path.exists(self._picklepath): - file = open(self._picklepath) - self._levels = pickle.load(file) - file.close() - - # randomize our list if asked for - if self._random: - self._files = rand.sample(self._files, len(self._files)) - - - ## public API - - def preroll(self): - # scan the first few files and start playing - gst.debug("starting jukebox prerolling") - self._scan() - - def start(self): - ## - ## FIXME : THIS SHOULD'T BE NEEDED ! - ## USE STATE CHANGES INSTEAD - ## - if not self._prerolled: - raise Exception, "baby" - self.set_state(gst.STATE_PAUSED) - - - ## Scanning private methods - - def _scan(self): - # start a leveller for a new _toscan file - if self._scani >= len(self._files): - gst.debug("We're done scanning !") - return - - file = self._files[self._scani] - self._scani += 1 - - if file in self._levels.keys(): - gst.debug("already did file %s" % file) - self._check_prerolled() - gobject.timeout_add(0, self._scan) - return - - gst.debug("creating leveller for %s" % file) - leveller = Leveller(file) - leveller.connect('done', self._leveller_done_cb, file) - gobject.timeout_add(0, leveller.start) - ##gobject.idle_add(leveller.iterate) - - def _leveller_done_cb(self, l, reason, file): - if reason != sources.EOS: - gst.debug("Error: %s" % reason) - return - - gst.debug("in: %s, out: %s" % (gst.TIME_ARGS(l.mixin), - gst.TIME_ARGS(l.mixout))) - gst.debug("rms: %f, %f dB" % (l.rms, l.rmsdB)) - - # store infos - self._levels[file] = (l.rms, l.mixin, l.mixout, l.length) - - gst.debug("writing level pickle") - file = open(self._picklepath, "w") - pickle.dump(self._levels, file) - file.close() - - self._check_prerolled() - self._scan() - - # clean up leveller after this handler - gobject.timeout_add(0, l.clean) - - - ## GnlSource-related methods - - def _new_gnl_source(self, location, start): - """ - Creates a new GnlSource containing an AudioSource with the following - properties correctly set: - _ volume level - _ priority - _ duration - The start position MUST be given - """ - if not self._levels[location]: - return None - self.debug("Creating new GnlSource at %s for %s" % (gst.TIME_ARGS(start), location)) - idx = self._files.index(location) + self._loopsdone * len(self._files) - rms, mixin, mixout, duration = self._levels[location] - gnls = gst.element_factory_make("gnlsource", "source-%d-%s" % (idx, location)) - src = sources.AudioSource(location) - gnls.add(src) - - # set volume - level = 1.0 - if rms > self._target_rms: - level = self._target_rms / rms - gst.debug('setting volume of %f' % level) - else: - gst.debug('not going to go above 1.0 level') - src.set_volume(level) - - # set proper position/duration/priority in composition - gnls.props.priority = (2 * self._loopsdone) + 1 + (idx % 2) - gnls.props.start = long(start) - gnls.props.duration = long(duration) - gnls.props.media_duration = long(duration) - gnls.props.media_start = long(0) - - return gnls - - def _new_mixer(self, start, duration): - gnlo = gst.element_factory_make("gnloperation") - ad = gst.element_factory_make("adder") - gnlo.add(ad) - gnlo.props.sinks = 2 - gnlo.props.start = start - gnlo.props.duration = duration - gnlo.props.priority = 0 - - return gnlo - - def _append_file(self, location): - """ - Appends the given file to the composition, along with the proper mixer effect - """ - self.debug("location:%s" % location) - start = self._lastposition - if self._lastadded: - start += self._levels[self._lastadded][2] - start -= self._levels[location][1] - - gnls = self._new_gnl_source(location, start) - self._composition.add(gnls) - - if self._lastadded: - # create the mixer - duration = self._levels[self._lastadded][3] - self._levels[self._lastadded][2] + self._levels[location][1] - mixer = self._new_mixer(start, duration) - self._composition.add(mixer) - - self._lastposition = start - self._lastadded = location - - self.debug("lastposition:%s , lastadded:%s" % (gst.TIME_ARGS(self._lastposition), - self._lastadded)) - - def _check_prerolled(self): - gst.debug("_check_prerolled: index: scan %d, play %d" % ( - self._scani, self._playi)) - if not self._prerolled and self._scani > self._playi + 1: - self._prerolled = True - # add initial sources here - self._append_file(self._files[0]) - self._append_file(self._files[1]) - self.debug("now prerolled and ready to play") - self.emit('prerolled') - - - def _emit_changed(self, file, when): - print "emitting changed for %s at %r" % (file, when) - self.emit('changed', file, when) - - def _source_clean(self, source): - source.set_state(gst.STATE_NULL) - self.remove(source) - source.clean() - - ## composition callbacks - - def _composition_pad_added_cb(self, comp, pad): - if self._srcpad: - return - self.debug("Ghosting source pad %s" % pad) - self._srcpad = gst.GhostPad("src", pad) - self._srcpad.set_active(True) - self.add_pad(self._srcpad) - - ## gst.Bin/Element virtual methods - - def do_handle_message(self, message): - self.debug("got message %s / %s / %r" % (message.src.get_name(), message.type.first_value_name, message)) - - # chaining up - gst.Bin.do_handle_message(self, message) - - def do_state_change(self, transition): - if not self._prerolled: - gst.error("Call Jukebox.preroll() before!") - return gst.STATE_CHANGE_FAILURE - # chaining up - return gst.Bin.do_state_change(self, message) - -gobject.type_register(Jukebox) - -# helper functions -def _find_elements_recurse(element): - if not isinstance(element, gst.Bin): - return [element, ] - l = [] - for e in element.elements(): - l.extend(_find_elements_recurse(e)) - return l - -def _find_unconnected_pad(bin, direction): - for e in _find_elements_recurse(bin): - for p in e.pads(): - if p.get_direction() == direction and not p.get_peer(): - return p - - return None - -# run us to test -if __name__ == "__main__": - main = gobject.MainLoop() - pipeline = gst.Pipeline('jukebox') - list = open(sys.argv[1]).read().rstrip().split('\n') - print list - #source = Jukebox(list, random=True, loops=-1) - source = Jukebox(list, random=True, loops=1) - - def _jukebox_prerolled_cb(jukebox): - print "prerolled" - _start() - - def _jukebox_changed_cb(jukebox, filename, when): - print "changed file to %s at %s" % (filename, float(when) / gst.TIME_ARGS(gst.SECOND)) - - def _jukebox_looped_cb(jukebox): - print "jukebox looped" - - def _start(): - source.start() - print "setting pipeline to PLAYING" - pipeline.set_state(gst.STATE_PLAYING) - print "set pipeline to PLAYING" - - def jukebox_pad_added(comp, pad, sinkpad): - pad.link(sinkpad) - - def jukebox_message(bus, message): - if message.type == gst.MESSAGE_ERROR: - print "Error: %s" % message.parse_error() - main.quit() - elif message.type == gst.MESSAGE_EOS: - print "done" - main.quit() - - source.connect('prerolled', _jukebox_prerolled_cb) - source.connect('changed', _jukebox_changed_cb) - source.connect('looped', _jukebox_looped_cb) - source.preroll() - pipeline.add(source) - - bus = pipeline.get_bus() - bus.add_signal_watch() - bus.connect("message", jukebox_message) - - p = "alsasink" - if len(sys.argv) > 2: - p = " ".join(sys.argv[2:]) - - print "parsing output pipeline %s" % p - sinkbin = gst.parse_launch("bin.( %s )" % p) - pipeline.add(sinkbin) - apad = _find_unconnected_pad(sinkbin, gst.PAD_SINK) - if not apad: - raise TypeError, "No unconnected sink pad found in bin %r" % sinkbin - sinkpad = gst.GhostPad("sink", apad) - sinkbin.add_pad(sinkpad) - source.connect('pad-added', jukebox_pad_added, sinkpad) - - print "Going into main loop" - sys.stdout.flush() - main.run() - print "Left main loop" - sys.stdout.flush() - - pipeline.set_state(gst.STATE_NULL) diff --git a/gst/extend/leveller.py b/gst/extend/leveller.py deleted file mode 100644 index 5fd759715a..0000000000 --- a/gst/extend/leveller.py +++ /dev/null @@ -1,285 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# GStreamer python bindings -# Copyright (C) 2005 Thomas Vander Stichele - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os -import sys -import math - -import gobject -import pygst -pygst.require('0.10') -import gst - -import utils -from pygobject import gsignal - -import sources -from sources import EOS, ERROR, UNKNOWN_TYPE, WRONG_TYPE - -class Leveller(gst.Pipeline): - """ - I am a pipeline that calculates RMS values and mix-in/out points. - I will signal 'done' when I'm done scanning the file, with return value - EOS, ERROR, UNKNOWN_TYPE, or WRONG_TYPE from gst.extend.sources - """ - - gsignal('done', str) - - def __init__(self, filename, threshold=-9.0): - gst.Pipeline.__init__(self) - - self._filename = filename - - self._thresholddB = threshold - self._threshold = math.pow(10, self._thresholddB / 10.0) - - self._source = sources.AudioSource(filename) - self._source.connect('done', self._done_cb) - - self._level = gst.element_factory_make("level") - - self._fakesink = gst.element_factory_make("fakesink") - - self.add(self._source, self._level, self._fakesink) - self._source.connect("pad-added", self._sourcePadAddedCb) - self._level.link(self._fakesink) - - # temporary values for each timepoint - self._rmsdB = {} # hash of channel, rmsdB value - self._peakdB = 0.0 # highest value over all channels for this time - - # results over the whole file - self._meansquaresums = [] # list of time -> mean square sum value - self._peaksdB = [] # list of time -> peak value - - self._lasttime = 0 - - # will be set when done - self.mixin = 0 - self.mixout = 0 - self.length = 0 - self.rms = 0.0 - self.rmsdB = 0.0 - - def _sourcePadAddedCb(self, source, pad): - self._source.link(self._level) - - def do_handle_message(self, message): - self.debug("got message %r" % message) - if (message.type == gst.MESSAGE_ELEMENT) and (message.src == self._level): - struc = message.structure - endtime = struc["endtime"] - rmss = struc["rms"] - peaks = struc["peak"] - decays = struc["decay"] - infos = zip(rmss, peaks, decays) - channid = 0 - for rms,peak,decay in infos: - self._level_cb(message.src, endtime, channid, rms, peak, decay) - channid += 1 - elif message.type == gst.MESSAGE_EOS: - self._eos_cb(message.src) - # chaining up - gst.Pipeline.do_handle_message(self, message) - - def _level_cb(self, element, time, channel, rmsdB, peakdB, decaydB): - # rms is being signalled in dB - # FIXME: maybe level should have a way of signalling actual values - # signals are received in order, so I should get each channel one - # by one - if time > self._lasttime and self._lasttime > 0: - # we have a new time point, so calculate stuff for the old block - meansquaresum = 0.0 - for i in self._rmsdB.keys(): - meansquaresum += math.pow(10, self._rmsdB[i] / 10.0) - # average over channels - meansquaresum /= len(self._rmsdB.keys()) - try: - rmsdBstr = str(10 * math.log10(meansquaresum)) - except OverflowError: - rmsdBstr = "(-inf)" - gst.log("meansquaresum %f (%s dB)" % (meansquaresum, rmsdBstr)) - - # update values - self._peaksdB.append((self._lasttime, peakdB)) - self._meansquaresums.append((self._lasttime, meansquaresum)) - self._rmsdB = {} - self._peakdB = 0.0 - - # store the current values for later processing - gst.log("time %s, channel %d, rmsdB %f" % (gst.TIME_ARGS(time), channel, rmsdB)) - self._lasttime = time - self._rmsdB[channel] = rmsdB - if peakdB > self._peakdB: - self._peakdB = peakdB - - def _done_cb(self, source, reason): - gst.debug("done, reason %s" % reason) - # we ignore eos because we want the whole pipeline to eos - if reason == EOS: - return - self.emit('done', reason) - - def _eos_cb(self, source): - gst.debug("eos, start calcing") - - # get the highest peak RMS for this track - highestdB = self._peaksdB[0][1] - - for (time, peakdB) in self._peaksdB: - if peakdB > highestdB: - highestdB = peakdB - gst.debug("highest peak(dB): %f" % highestdB) - - # get the length - (self.length, peakdB) = self._peaksdB[-1] - - # find the mix in point - for (time, peakdB) in self._peaksdB: - gst.log("time %s, peakdB %f" % (gst.TIME_ARGS(time), peakdB)) - if peakdB > self._thresholddB + highestdB: - gst.debug("found mix-in point of %f dB at %s" % ( - peakdB, gst.TIME_ARGS(time))) - self.mixin = time - break - - # reverse and find out point - self._peaksdB.reverse() - found = None - for (time, peakdB) in self._peaksdB: - if found: - self.mixout = time - gst.debug("found mix-out point of %f dB right before %s" % ( - found, gst.TIME_ARGS(time))) - break - - if peakdB > self._thresholddB + highestdB: - found = peakdB - - # now calculate RMS between these two points - weightedsquaresums = 0.0 - lasttime = self.mixin - for (time, meansquaresum) in self._meansquaresums: - if time <= self.mixin: - continue - - delta = time - lasttime - weightedsquaresums += meansquaresum * delta - gst.log("added MSS %f over time %s at time %s, now %f" % ( - meansquaresum, gst.TIME_ARGS(delta), - gst.TIME_ARGS(time), weightedsquaresums)) - - lasttime = time - - if time > self.mixout: - break - - # calculate - try: - ms = weightedsquaresums / (self.mixout - self.mixin) - except ZeroDivisionError: - # this is possible when, for example, the whole sound file is - # empty - gst.warning('ZeroDivisionError on %s, mixin %s, mixout %s' % ( - self._filename, gst.TIME_ARGS(self.mixin), - gst.TIME_ARGS(self.mixout))) - self.emit('done', WRONG_TYPE) - return - - self.rms = math.sqrt(ms) - self.rmsdB = 10 * math.log10(ms) - - self.emit('done', EOS) - - def start(self): - gst.debug("Setting to PLAYING") - self.set_state(gst.STATE_PLAYING) - gst.debug("Set to PLAYING") - - # FIXME: we might want to do this ourselves automatically ? - def stop(self): - """ - Stop the leveller, freeing all resources. - Call after the leveller emitted 'done' to clean up. - """ - gst.debug("Setting to NULL") - self.set_state(gst.STATE_NULL) - gst.debug("Set to NULL") - utils.gc_collect('Leveller.stop()') - - def clean(self): - # clean ourselves up completely - self.stop() - # let's be ghetto and clean out our bin manually - self.remove(self._source) - self.remove(self._level) - self.remove(self._fakesink) - gst.debug("Emptied myself") - self._source.clean() - utils.gc_collect('Leveller.clean() cleaned up source') - self._source = None - self._fakesink = None - self._level = None - utils.gc_collect('Leveller.clean() done') - -gobject.type_register(Leveller) - -if __name__ == "__main__": - main = gobject.MainLoop() - - try: - leveller = Leveller(sys.argv[1]) - except IndexError: - sys.stderr.write("Please give a file to calculate level of\n") - sys.exit(1) - - print "Starting" - bus = leveller.get_bus() - bus.add_signal_watch() - dontstop = True - - leveller.set_state(gst.STATE_PLAYING) - - while dontstop: - message = bus.poll(gst.MESSAGE_ANY, gst.SECOND) - if message: - gst.debug("got message from poll:%s/%r" % (message.type, message)) - else: - gst.debug("got NOTHING from poll") - if message: - if message.type == gst.MESSAGE_EOS: - print "in: %s, out: %s, length: %s" % (gst.TIME_ARGS(leveller.mixin), - gst.TIME_ARGS(leveller.mixout), - gst.TIME_ARGS(leveller.length)) - print "rms: %f, %f dB" % (leveller.rms, leveller.rmsdB) - dontstop = False - elif message.type == gst.MESSAGE_ERROR: - error,debug = message.parse_error() - print "ERROR[%s] %s" % (error.domain, error.message) - dontstop = False - - leveller.stop() - leveller.clean() - - gst.debug('deleting leveller, verify objects are freed') - utils.gc_collect('quit main loop') - del leveller - utils.gc_collect('deleted leveller') - gst.debug('stopping forever') diff --git a/gst/extend/pygobject.py b/gst/extend/pygobject.py deleted file mode 100644 index 04d378ffb7..0000000000 --- a/gst/extend/pygobject.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# GStreamer python bindings -# Copyright (C) 2004 Johan Dahlin - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -""" -PyGTK helper functions -""" - -import sys - -import gobject - -def gobject_set_property(object, property, value): - """ - Set the given property to the given value on the given object. - - @type object: L{gobject.GObject} - @type property: string - @param value: value to set property to - """ - for pspec in gobject.list_properties(object): - if pspec.name == property: - break - else: - raise errors.PropertyError( - "Property '%s' in element '%s' does not exist" % ( - property, object.get_property('name'))) - - if pspec.value_type in (gobject.TYPE_INT, gobject.TYPE_UINT, - gobject.TYPE_INT64, gobject.TYPE_UINT64): - try: - value = int(value) - except ValueError: - msg = "Invalid value given for property '%s' in element '%s'" % ( - property, object.get_property('name')) - raise errors.PropertyError(msg) - - elif pspec.value_type == gobject.TYPE_BOOLEAN: - if value == 'False': - value = False - elif value == 'True': - value = True - else: - value = bool(value) - elif pspec.value_type in (gobject.TYPE_DOUBLE, gobject.TYPE_FLOAT): - value = float(value) - elif pspec.value_type == gobject.TYPE_STRING: - value = str(value) - # FIXME: this is superevil ! we really need to find a better way - # of checking if this property is a param enum - # also, we only allow int for now - elif repr(pspec.__gtype__).startswith(" - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os -import sys - -import gobject -import pygst -pygst.require('0.10') -import gst - -from pygobject import gsignal - -EOS = 'EOS' -ERROR = 'ERROR' -WRONG_TYPE = 'WRONG_TYPE' -UNKNOWN_TYPE = 'UNKNOWN_TYPE' - -class AudioSource(gst.Bin): - """A bin for audio sources with proper audio converters""" - - gsignal('done', str) - gsignal('prerolled') - - def __init__(self, filename, caps="audio/x-raw-int,channels=2,rate=44100"): - # with pygtk 2.4 this call is needed for the gsignal to work - gst.Bin.__init__(self) - - self.filename = filename - self.outcaps = caps - - self.filesrc = gst.element_factory_make("filesrc") - self.filesrc.set_property("location", self.filename) - self.dbin = gst.element_factory_make("decodebin") - self.audioconvert = gst.element_factory_make("audioconvert") - self.audioresample = gst.element_factory_make("audioresample") - self.volume = gst.element_factory_make("volume") - - self.add(self.filesrc, self.dbin, - self.audioconvert, self.audioresample, self.volume) - self.filesrc.link(self.dbin) - self.audioconvert.link(self.audioresample) - self.audioresample.link(self.volume, caps) - - self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb) - self.dbin.connect("unknown-type", self._unknown_type_cb) - - self._srcpad = None - - def __repr__(self): - return "" % self.filename - - def set_volume(self, volume): - gst.debug("setting volume to %f" % volume) - self.volume.set_property("volume", volume) - - def _new_decoded_pad_cb(self, dbin, pad, is_last): - gst.debug("new decoded pad: pad %r [%s]" % (pad, pad.get_caps().to_string())) - if not "audio" in pad.get_caps().to_string() or self._srcpad: - return - - gst.debug("linking pad %r to audioconvert" % pad) - pad.link(self.audioconvert.get_pad("sink")) - - self._srcpad = gst.GhostPad("src", self.volume.get_pad("src")) - self._srcpad.set_active(True) - self.add_pad(self._srcpad) - - def _unknown_type_cb(self, pad, caps): - self.emit('done', UNKNOWN_TYPE) - - def stop(self): - self.set_state(gst.STATE_NULL) - - def clean(self): - self.stop() - self.remove(self.filesrc) - self.remove(self.dbin) - self.remove(self.audioconvert) - self.remove(self.audioresample) - self.remove(self.volume) - self.filesrc = None - self.dbin = None - self.audioconvert = None - self.volume = None - -gobject.type_register(AudioSource) - - -# run us to test -if __name__ == "__main__": - main = gobject.MainLoop() - - def _done_cb(source, reason): - print "Done" - sys.stdout.flush() - if reason != EOS: - print "Some error happened: %s" % reason - main.quit() - - def _error_cb(source, element, gerror, message): - print "Error: %s" % gerror - main.quit() - - try: - source = AudioSource(sys.argv[1]) - except IndexError: - sys.stderr.write("Please give a filename to play\n") - sys.exit(1) - - pipeline = gst.Pipeline("playing") - # connecting on the source also catches eos emit when - # no audio pad - source.connect('done', _done_cb) - pipeline.connect('error', _error_cb) - - p = "osssink" - if len(sys.argv) > 2: - p = " ".join(sys.argv[2:]) - - pipeline.add(source) - sink = gst.parse_launch(p) - pipeline.add(sink) - source.link(sink) - - # we schedule this as a timeout so that we are definately in the main - # loop when it goes to PLAYING, and errors make main.quit() work correctly - def _start(pipeline): - print "setting pipeline to PLAYING" - pipeline.set_state(gst.STATE_PLAYING) - print "set pipeline to PLAYING" - - gobject.timeout_add(0, _start, pipeline) - gobject.idle_add(pipeline.iterate) - - print "Going into main loop" - main.run() - print "Left main loop" - - pipeline.set_state(gst.STATE_NULL) - pipeline.remove(source) - pipeline.remove(sink) - utils.gc_collect('cleaned out pipeline') - source.clean() - utils.gc_collect('cleaned up source') - source = None - utils.gc_collect('set source to None') diff --git a/gst/extend/utils.py b/gst/extend/utils.py deleted file mode 100644 index 784dab91a1..0000000000 --- a/gst/extend/utils.py +++ /dev/null @@ -1,77 +0,0 @@ -import os - -import gobject -import gst - -def gst_dump(bin): - dump_element(bin, 0) - -def dump_bin(bin, indent): - # Iterate the children - for child in bin.get_list(): - dump_element(child, indent + 2) - -def dump_element(element, indent): - states = { 1: 'NULL', 2: 'READY', - 4: 'PAUSED', 8: 'PLAYING' } - - state = 'UNKNOWN' - try: - state = states[element.get_state()] - except KeyError: - state = 'UNKNOWN (%d)' % element.get_state() - - c = element.get_clock() - if c is None: - clock_str = "clock - None" - else: - clock_str = "clock - %s" % (c.get_name()) - - out = "%s (%s): state %s, %s" % (element.get_name(), - gobject.type_name(element.__gtype__), state, clock_str) - - print out.rjust(len(out) + indent) - - tmp = { True: 'active', False: 'inactive' } - - for curpad in element.get_pad_list(): - if curpad.get_direction() == gst.PAD_SRC: - if curpad.is_linked(): - peer = curpad.get_peer() - out = " - %s:%s (%s) => %s:%s (%s)" % ( - curpad.get_parent().get_name(), curpad.get_name(), - tmp[curpad.is_active()], - peer.get_parent().get_name(), peer.get_name(), - tmp[peer.is_active()]) - - print out.rjust(len(out) + indent) - - if isinstance(element, gst.Bin): - dump_bin(element, indent + 2) - elif isinstance(element, gst.Queue): - out = " - time_level: %ld" % ( - element.get_property('current-level-time')) - print out.rjust(len(out) + indent) - out = " - bytes_level: %ld" % ( - element.get_property('current-level-bytes')) - print out.rjust(len(out) + indent) - -def gc_collect(reason=None): - """ - Garbage-collect if GST_GC env var is set. - This helps in debugging object refcounting. - Sprinkle liberally around checkpoints. - """ - env = os.environ.get('GST_GC', None) - if not env: - return - import gc - if env == 'DEBUG_LEAK': - gc.set_debug(gc.DEBUG_LEAK) - - gst.debug('collecting garbage') - if reason: - gst.debug('because of %s' % reason) - count = gc.collect() - gst.debug('collected garbage, %d objects collected, %d left' % ( - count, len(gc.get_objects()))) diff --git a/gst/gst-0.10.21.ignore b/gst/gst-0.10.21.ignore deleted file mode 100644 index b9b54b2bf8..0000000000 --- a/gst/gst-0.10.21.ignore +++ /dev/null @@ -1,11 +0,0 @@ -%% -ignore - gst_pad_set_iterate_internal_links_function - gst_pad_iterate_internal_links - gst_pad_iterate_internal_links_default - gst_base_transform_suggest - gst_base_transform_reconfigure -%% -ignore-type - -%% diff --git a/gst/gst-0.10.22.ignore b/gst/gst-0.10.22.ignore deleted file mode 100644 index 724750f941..0000000000 --- a/gst/gst-0.10.22.ignore +++ /dev/null @@ -1,18 +0,0 @@ -%% -ignore - gst_bin_recalculate_latency - gst_event_get_seqnum - gst_event_set_seqnum - gst_message_set_seqnum - gst_message_new_structure_change - gst_message_parse_structure_change - gst_query_new_uri - gst_query_parse_uri - gst_query_set_uri - gst_tag_setter_reset_tags - gst_util_seqnum_next - gst_util_seqnum_compare -%% -ignore-type - GstStructureChangeType -%% diff --git a/gst/gst-0.10.23.ignore b/gst/gst-0.10.23.ignore deleted file mode 100644 index 3e065f3a6b..0000000000 --- a/gst/gst-0.10.23.ignore +++ /dev/null @@ -1,23 +0,0 @@ -%% -ignore - gst_debug_construct_win_color - gst_message_new_request_state - gst_message_parse_request_state - gst_util_array_binary_search - gst_poll_new_timer - gst_poll_write_control - gst_poll_read_control - gst_tag_list_get_buffer - gst_tag_list_get_buffer_index - gst_fixme - gst_memdump - gst_object_fixme - gst_object_memdump - gst_type_find_helper_for_extension - GST_PARAM_MUTABLE_READY - GST_PARAM_MUTABLE_PAUSED - GST_PARAM_MUTABLE_PLAYING -%% -ignore-type - GstSearchMode -%% diff --git a/gst/gst-0.10.24.ignore b/gst/gst-0.10.24.ignore deleted file mode 100644 index 41d9b4f9f2..0000000000 --- a/gst/gst-0.10.24.ignore +++ /dev/null @@ -1,46 +0,0 @@ -%% -ignore - gst_element_set_start_time - gst_element_get_start_time - gst_element_lost_state_full - gst_event_new_step - gst_event_parse_step - gst_message_new_tag_full - gst_message_parse_tag_full - gst_message_new_step_done - gst_message_parse_step_done - gst_message_new_stream_status - gst_message_parse_stream_status - gst_message_set_stream_status_object - gst_message_get_stream_status_object - gst_message_new_step_start - gst_message_parse_step_start - gst_pad_set_chain_list_function - gst_pad_push_list - gst_pad_chain_list - gst_plugin_get_cache_data - gst_plugin_set_cache_data - gst_segment_to_position - gst_segment_set_running_time - gst_structure_get_valist - gst_structure_get - gst_structure_id_get_valist - gst_structure_id_get - gst_tag_list_add_value - gst_tag_setter_add_tag_value - gst_task_set_priority - gst_task_get_pool - gst_task_set_pool - gst_task_set_thread_callbacks - gst_task_set_state - gst_adapter_prev_timestamp - gst_adapter_masked_scan_uint32 -%% -ignore-type - GstBufferList - GstTaskPool - GstBufferListItem - GstStreamStatusType - GstBufferList - GstBufferListIterator -%% diff --git a/gst/gst-0.10.25.ignore b/gst/gst-0.10.25.ignore deleted file mode 100644 index c8a6d4f74f..0000000000 --- a/gst/gst-0.10.25.ignore +++ /dev/null @@ -1,4 +0,0 @@ -%% -ignore - gst_caps_can_intersect -%% \ No newline at end of file diff --git a/gst/gst-0.10.26.ignore b/gst/gst-0.10.26.ignore deleted file mode 100644 index 5a07bb9582..0000000000 --- a/gst/gst-0.10.26.ignore +++ /dev/null @@ -1,20 +0,0 @@ -%% -ignore - gst_caps_set_value - gst_pad_get_caps_reffed - gst_pad_peer_get_caps_reffed - gst_util_greatest_common_divisor - gst_util_fraction_to_double - gst_util_double_to_fraction - gst_util_fraction_multiply - gst_util_fraction_add - gst_event_new_sink_message - gst_event_parse_sink_message - gst_plugin_feature_list_copy - gst_registry_get_feature_list_cookie - gst_structure_id_has_field - gst_structure_id_has_field_type - gst_base_src_new_seamless_segment - gst_collect_pads_set_clip_function - gst_type_find_helper_get_range_ext -%% \ No newline at end of file diff --git a/gst/gst-0.10.29.ignore b/gst/gst-0.10.29.ignore deleted file mode 100644 index 106c41c693..0000000000 --- a/gst/gst-0.10.29.ignore +++ /dev/null @@ -1,9 +0,0 @@ -%% -ignore - gst_message_new_qos - gst_message_set_qos_values - gst_message_set_qos_stats - gst_message_parse_qos - gst_message_parse_qos_values - gst_message_parse_qos_stats -%% \ No newline at end of file diff --git a/gst/gst-0.10.30.ignore b/gst/gst-0.10.30.ignore deleted file mode 100644 index bb3baf0327..0000000000 --- a/gst/gst-0.10.30.ignore +++ /dev/null @@ -1,14 +0,0 @@ -%% -ignore - gst_caps_steal_structure - gst_structure_fixate_field_boolean - gst_tag_list_peek_string_index - gst_pad_link_full - gst_element_link_pads_full - gst_adapter_masked_scan_uint32_peek - gst_base_sink_set_last_buffer_enabled - gst_base_sink_is_last_buffer_enabled -%% -ignore-type - GstPadLinkCheck -%% \ No newline at end of file diff --git a/gst/gst-0.10.31.ignore b/gst/gst-0.10.31.ignore deleted file mode 100644 index b324ae433d..0000000000 --- a/gst/gst-0.10.31.ignore +++ /dev/null @@ -1,26 +0,0 @@ -%% -ignore - gst_is_initialized - gst_buffer_list_iterator_add_list - gst_element_class_set_documentation_uri - gst_element_class_set_icon_name - gst_element_class_get_documentation_uri - gst_element_class_get_icon_name - gst_element_factory_list_is_type - gst_element_factory_list_get_elements - gst_element_factory_list_filter - gst_element_factory_get_documentation_uri - gst_element_factory_get_icon_name - gst_plugin_Feature_rank_compare_func - gst_query_add_buffering_range - gst_query_get_n_buffering_ranges - gst_query_parse_nth_buffering_range - gst_util_fraction_compare - gst_value_set_int64_range - gst_value_get_int64_range_min - gst_value_get_int64_range_max - gst_adapter_take_list -%% -ignore-type - GstDateTime -%% diff --git a/gst/gst-0.10.32.ignore b/gst/gst-0.10.32.ignore deleted file mode 100644 index 0875abe812..0000000000 --- a/gst/gst-0.10.32.ignore +++ /dev/null @@ -1,8 +0,0 @@ -%% -ignore - gst_clock_single_shot_id_reinit - gst_read_gpollfd - gst_value_list_merge - gst_element_request_pad -%% - diff --git a/gst/gst-0.10.36.ignore b/gst/gst-0.10.36.ignore deleted file mode 100644 index 84a6c25067..0000000000 --- a/gst/gst-0.10.36.ignore +++ /dev/null @@ -1,5 +0,0 @@ -%% -ignore - gst_preset_set_app_dir - gst_preset_get_app_dir -%% diff --git a/gst/gst-argtypes.c b/gst/gst-argtypes.c deleted file mode 100644 index 3b67a6b45a..0000000000 --- a/gst/gst-argtypes.c +++ /dev/null @@ -1,65 +0,0 @@ -/* gst-python - * Copyright (C) 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: Johan Dahlin - */ - -/* define this for all source files that don't run init_pygobject() - * before including pygobject.h */ -#define NO_IMPORT_PYGOBJECT - -#include "common.h" -#include - -/* This function will return a copy, unless the following is all TRUE: - * - The given PyObject contains a GstCaps already - * - The copy parameter is non-NULL - * - New years is the first of January - * If copy is non-NULL, it is set to TRUE if a copy was made. - * If the PyObject could not be converted to a caps, a TypeError is raised - * and NULL is returned. - */ -GstCaps * -pygst_caps_from_pyobject (PyObject * object, gboolean * copy) -{ - if (pyg_boxed_check (object, GST_TYPE_CAPS)) { - GstCaps *caps = pyg_boxed_get (object, GstCaps); - if (copy) { - *copy = FALSE; - return caps; - } else { - return gst_caps_copy (caps); - } - } else if (pyg_boxed_check (object, GST_TYPE_STRUCTURE)) { - GstStructure *structure = pyg_boxed_get (object, GstStructure); - if (copy) - *copy = TRUE; - return gst_caps_new_full (gst_structure_copy (structure), NULL); - } else if (PyString_Check (object)) { - GstCaps *caps = gst_caps_from_string (PyString_AsString (object)); - if (!caps) { - PyErr_SetString (PyExc_TypeError, "could not convert string to GstCaps"); - return NULL; - } - if (copy) - *copy = TRUE; - return caps; - } - PyErr_SetString (PyExc_TypeError, "could not convert to GstCaps"); - return NULL; -} diff --git a/gst/gst-disable-loadsave.ignore b/gst/gst-disable-loadsave.ignore deleted file mode 100644 index 4a4389748f..0000000000 --- a/gst/gst-disable-loadsave.ignore +++ /dev/null @@ -1,14 +0,0 @@ -%% -ignore - gst_element_save_thyself - gst_element_restore_thyself - gst_xml_get_topelements - gst_xml_make_element - gst_xml_new - gst_xml_parse_memory - gst_xml_write - gst_xml_write_file -%% -ignore-type - GstXML -%% \ No newline at end of file diff --git a/gst/gst-extrafuncs.defs b/gst/gst-extrafuncs.defs deleted file mode 100644 index 6826627a31..0000000000 --- a/gst/gst-extrafuncs.defs +++ /dev/null @@ -1,150 +0,0 @@ -; -*- scheme -*- - -(define-method flags - (of-object "GstElement") - (c-name "GST_OBJECT_FLAGS") - (return-type "GstElementFlags") -) - -(define-method set_flag - (of-object "GstObject") - (c-name "GST_OBJECT_FLAG_SET") - (return-type "none") - (parameters - '("GstObjectFlags" "flags") - ) -) - -(define-method unset_flag - (of-object "GstObject") - (c-name "GST_OBJECT_FLAG_UNSET") - (return-type "none") - (parameters - '("GstObjectFlags" "flag") - ) -) - -;; DEBUGGING FUNCTIONS FROM PYTHON -;; The c functions don't actually exist - -(define-function log - (c-name "gst_log") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function debug - (c-name "gst_debug") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function info - (c-name "gst_info") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function warning - (c-name "gst_warning") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function error - (c-name "gst_error") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function fixme - (c-name "gst_fixme") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-function memdump - (c-name "gst_memdump") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -;; OBJECT DEBUGGING FUNCTIONS FROM PYTHON -;; The c functions don't actually exist - -(define-method log - (of-object "GstObject") - (c-name "gst_object_log") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method debug - (of-object "GstObject") - (c-name "gst_object_debug") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method info - (of-object "GstObject") - (c-name "gst_object_info") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method warning - (of-object "GstObject") - (c-name "gst_object_warning") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method error - (of-object "GstObject") - (c-name "gst_object_error") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method fixme - (of-object "GstObject") - (c-name "gst_object_fixme") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) - -(define-method memdump - (of-object "GstObject") - (c-name "gst_object_memdump") - (return-type "none") - (parameters - '("gchar *" "msg") - ) -) diff --git a/gst/gst-pb-0.10.23.ignore b/gst/gst-pb-0.10.23.ignore deleted file mode 100644 index 92a18b6676..0000000000 --- a/gst/gst-pb-0.10.23.ignore +++ /dev/null @@ -1,19 +0,0 @@ -%% -ignore - gst_audio_clock_get_time - gst_audio_clock_adjust - gst_navigation_send_command - gst_video_format_parse_caps_interlaced - gst_video_format_new_caps_interlaced -%% -ignore-glob - gst_navigation_query_* - gst_navigation_message_* - gst_navigation_event_* -%% -ignore-type - GstNavigationCommand - GstNavigationQueryType - GstNavigationMessageType - GstNavigationEventType -%% diff --git a/gst/gst-pb-0.10.25.ignore b/gst/gst-pb-0.10.25.ignore deleted file mode 100644 index 95e26f8817..0000000000 --- a/gst/gst-pb-0.10.25.ignore +++ /dev/null @@ -1,9 +0,0 @@ -%% -ignore -%% -ignore-glob - gst_stream_volume_* -%% -ignore-type - GstStreamVolumeFormat -%% diff --git a/gst/gst-pb-0.10.26.ignore b/gst/gst-pb-0.10.26.ignore deleted file mode 100644 index 9991ceacff..0000000000 --- a/gst/gst-pb-0.10.26.ignore +++ /dev/null @@ -1,10 +0,0 @@ -%% -ignore - gst_tag_get_language_code - gst_tag_get_language_name - gst_tag_get_language_code_iso_639_1 - gst_tag_get_language_code_iso_638_2B - gst_tag_get_language_code_iso_638_2T - gst_video_event_new_still_frame - gst_video_event_parse_still_frame -%% \ No newline at end of file diff --git a/gst/gst-pb-0.10.29.ignore b/gst/gst-pb-0.10.29.ignore deleted file mode 100644 index 8e39404a91..0000000000 --- a/gst/gst-pb-0.10.29.ignore +++ /dev/null @@ -1,9 +0,0 @@ -%% -ignore - gst_x_overlay_set_render_rectangle - gst_tag_list_from_xmp_buffer - gst_tag_list_to_xmp_buffer - gst_video_format_is_gray - gst_video_parse_caps_chroma_site - gst_video_parse_caps_color_matrix -%% \ No newline at end of file diff --git a/gst/gst-pb-0.10.30.ignore b/gst/gst-pb-0.10.30.ignore deleted file mode 100644 index ea1e659aac..0000000000 --- a/gst/gst-pb-0.10.30.ignore +++ /dev/null @@ -1,7 +0,0 @@ -%% -ignore - gst_tag_list_to_exif_buffer - gst_tag_list_to_exif_buffer_with_tiff_header - gst_tag_list_from_exif_buffer - gst_tag_list_from_exif_buffer_with_tiff_header -%% diff --git a/gst/gst-pb-0.10.31.ignore b/gst/gst-pb-0.10.31.ignore deleted file mode 100644 index 2b28116851..0000000000 --- a/gst/gst-pb-0.10.31.ignore +++ /dev/null @@ -1,31 +0,0 @@ -%% -ignore - gst_codec_utils_aac_get_sample_rate_from_index - gst_codec_utils_aac_get_profile - gst_codec_utils_aac_get_level - gst_codec_utils_aac_caps_set_level_and_profile - gst_codec_utils_h264_get_profile - gst_codec_utils_h264_get_level - gst_codec_utils_h264_caps_set_level_and_profile - gst_codec_utils_mpeg4video_get_profile - gst_codec_utils_mpeg4video_get_level - gst_codec_utils_mpeg4video_caps_set_level_and_profile - gst_plugins_base_version - gst_plugins_base_version_string - gst_audio_clock_invalidate - gst_base_audio_sink_set_drift_tolerance - gst_base_audio_sink_get_drift_tolerance - gst_x_overlay_set_window_handle - gst_x_overlay_got_window_handle - gst_video_convert_frame - gst_video_convert_frame_async -%% -ignore-type - GstDiscoverer - GstDiscovererResult - GstDiscovererInfo - GstDiscovererStreamInfo - GstDiscovererContainerInfo - GstDiscovererAudioInfo - GstDiscovererVideoInfo -%% \ No newline at end of file diff --git a/gst/gst-pb-0.10.32.ignore b/gst/gst-pb-0.10.32.ignore deleted file mode 100644 index 5e334fc395..0000000000 --- a/gst/gst-pb-0.10.32.ignore +++ /dev/null @@ -1,50 +0,0 @@ -%% -ignore - gst_encoding_profile_get_name - gst_encoding_profile_get_description - gst_encoding_profile_get_format - gst_encoding_profile_get_preset - gst_encoding_profile_get_presence - gst_encoding_profile_get_restriction - gst_encoding_profile_set_name - gst_encoding_profile_set_description - gst_encoding_profile_set_format - gst_encoding_profile_set_preset - gst_encoding_profile_set_presence - gst_encoding_profile_set_restriction - gst_encoding_profile_is_equal - gst_encoding_profile_get_output_caps - gst_encoding_profile_get_type_nick - gst_encoding_profile_find - gst_encoding_container_profile_add_profile - gst_encoding_container_profile_contains_profile - gst_encoding_container_profile_get_profiles - gst_encoding_container_profile_new - gst_encoding_audio_profile_new - gst_encoding_video_profile_new - gst_encoding_video_profile_get_pass - gst_encoding_video_profile_set_pass - gst_encoding_video_profile_get_variableframerate - gst_encoding_video_profile_set_variableframerate - gst_encoding_target_new - gst_encoding_target_get_name - gst_encoding_target_get_category - gst_encoding_target_get_description - gst_encoding_target_get_profiles - gst_encoding_target_add_profile - gst_encoding_target_save - gst_encoding_target_save_to_file - gst_encoding_target_load - gst_encoding_target_load_from_file - gst_encoding_list_available_categories - gst_encoding_list_all_targets - gst_discoverer_info_get_seekable - gst_video_parse_caps_palette -%% -ignore-type - GstEncodingProfile - GstEncodingContainerProfile - GstEncodingAudioProfile - GstEncodingVideoProfile - GstEncodingTarget -%% \ No newline at end of file diff --git a/gst/gst-pb-0.10.36.ignore b/gst/gst-pb-0.10.36.ignore deleted file mode 100644 index f3bb00100c..0000000000 --- a/gst/gst-pb-0.10.36.ignore +++ /dev/null @@ -1,8 +0,0 @@ -%% -ignore - gst_video_event_new_downstream_force_key_unit - gst_video_event_parse_downstream_force_key_unit - gst_video_event_new_upstream_force_key_unit - gst_video_event_parse_upstream_force_key_unit - gst_video_event_is_force_key_unit -%% diff --git a/gst/gst-types.defs b/gst/gst-types.defs deleted file mode 100644 index e7ce858c02..0000000000 --- a/gst/gst-types.defs +++ /dev/null @@ -1,1240 +0,0 @@ -;; -*- scheme -*- - -; object definitions ... - -(define-object Object - (in-module "Gst") - (parent "GObject") - (c-name "GstObject") - (gtype-id "GST_TYPE_OBJECT") - (fields - '("int" "__gstrefcount__") - ) -) - -(define-object Index - (in-module "Gst") - (parent "GstObject") - (c-name "GstIndex") - (gtype-id "GST_TYPE_INDEX") -) - -(define-object Element - (in-module "Gst") - (parent "GstObject") - (c-name "GstElement") - (gtype-id "GST_TYPE_ELEMENT") -) - -(define-object Bin - (in-module "Gst") - (parent "GstElement") - (c-name "GstBin") - (gtype-id "GST_TYPE_BIN") -) - -(define-object Clock - (in-module "Gst") - (parent "GstObject") - (c-name "GstClock") - (gtype-id "GST_TYPE_CLOCK") -) - -(define-object Bus - (in-module "Gst") - (parent "GstObject") - (c-name "GstBus") - (gtype-id "GST_TYPE_BUS") -) - -(define-object Pad - (in-module "Gst") - (parent "GstObject") - (c-name "GstPad") - (gtype-id "GST_TYPE_PAD") -) - -(define-object GhostPad - (in-module "Gst") - (parent "GstPad") - (c-name "GstGhostPad") - (gtype-id "GST_TYPE_GHOST_PAD") -) - -(define-object PadTemplate - (in-module "Gst") - (parent "GstObject") - (c-name "GstPadTemplate") - (gtype-id "GST_TYPE_PAD_TEMPLATE") - (fields - '("const-gchar*" "name_template") - '("GstPadDirection" "direction") - '("GstPadPresence" "presence") - '("GstCaps*" "caps") - ) -) - -(define-object Pipeline - (in-module "Gst") - (parent "GstBin") - (c-name "GstPipeline") - (gtype-id "GST_TYPE_PIPELINE") -) - -(define-object PluginFeature - (in-module "Gst") - (parent "GstObject") - (c-name "GstPluginFeature") - (gtype-id "GST_TYPE_PLUGIN_FEATURE") -) - -(define-object IndexFactory - (in-module "Gst") - (parent "GstPluginFeature") - (c-name "GstIndexFactory") - (gtype-id "GST_TYPE_INDEX_FACTORY") -) - -(define-object ElementFactory - (in-module "Gst") - (parent "GstPluginFeature") - (c-name "GstElementFactory") - (gtype-id "GST_TYPE_ELEMENT_FACTORY") -) - -(define-object Registry - (in-module "Gst") - (parent "GstObject") - (c-name "GstRegistry") - (gtype-id "GST_TYPE_REGISTRY") -) - -(define-object SystemClock - (in-module "Gst") - (parent "GstClock") - (c-name "GstSystemClock") - (gtype-id "GST_TYPE_SYSTEM_CLOCK") -) - -(define-object Task - (in-module "Gst") - (parent "GstObject") - (c-name "GstTask") - (gtype-id "GST_TYPE_TASK") -) - -(define-object TaskPool - (in-module "Gst") - (parent "GstObject") - (c-name "GstTaskPool") - (gtype-id "GST_TYPE_TASK_POOL") -) - -(define-object TypeFindFactory - (in-module "Gst") - (parent "GstPluginFeature") - (c-name "GstTypeFindFactory") - (gtype-id "GST_TYPE_TYPE_FIND_FACTORY") -) - -(define-object XML - (in-module "Gst") - (parent "GstObject") - (c-name "GstXML") - (gtype-id "GST_TYPE_XML") -) - -(define-object NetClientClock - (in-module "Gst") - (parent "GstSystemClock") - (c-name "GstNetClientClock") - (gtype-id "GST_TYPE_NET_CLIENT_CLOCK") -) - -(define-object NetTimeProvider - (in-module "Gst") - (parent "GstObject") - (c-name "GstNetTimeProvider") - (gtype-id "GST_TYPE_NET_TIME_PROVIDER") -) - -;; -;; MiniObject types -;; - -(define-miniobject Buffer - (in-module "Gst") - (parent "GstMiniObject") - (c-name "GstBuffer") - (gtype-id "GST_TYPE_BUFFER") - (fields - '("guint8" "data") - '("guint" "size") - '("GstClockTime" "timestamp") - '("GstClockTime" "duration") - '("guint64" "offset") - '("guint64" "offset_end") - '("GstCaps*" "caps") - ) -) - -(define-miniobject BufferList - (in-module "Gst") - (parent "GstMiniObject") - (c-name "GstBufferList") - (gtype-id "GST_TYPE_BUFFER_LIST") -) - -(define-miniobject Event - (in-module "Gst") - (parent "GstMiniObject") - (c-name "GstEvent") - (gtype-id "GST_TYPE_EVENT") - (fields - '("GstEventType" "type") - '("guint64" "timestamp") - '("GstObject*" "src") - ) -) - -(define-miniobject Message - (in-module "Gst") - (parent "GstMiniObject") - (c-name "GstMessage") - (gtype-id "GST_TYPE_MESSAGE") - (fields - '("GstMessageType" "type") - '("guint64" "timestamp") - '("GstObject*" "src") - '("GstStructure*" "structure") - ) -) - -(define-miniobject Query - (in-module "Gst") - (parent "GstMiniObject") - (c-name "GstQuery") - (gtype-id "GST_TYPE_QUERY") - (fields - '("GstQueryType" "type") - '("GstStructure*" "structure") - ) -) - - -;; -;; Boxed types -;; - -(define-boxed Caps - (in-module "Gst") - (c-name "GstCaps") - (gtype-id "GST_TYPE_CAPS") - (fields - '("int" "__refcount__") - ) -) - -(define-boxed DateTime - (in-module "Gst") - (c-name "GstDateTime") - (gtype-id "GST_TYPE_DATE_TIME") -) - -(define-object Plugin - (in-module "Gst") - (parent "GstObject") - (c-name "GstPlugin") - (gtype-id "GST_TYPE_PLUGIN") -) - -(define-boxed Structure - (in-module "Gst") - (c-name "GstStructure") - (gtype-id "GST_TYPE_STRUCTURE") - (copy-func "gst_structure_copy") - (release-func "gst_structure_unref") -) - -(define-boxed TagList - (in-module "Gst") - (c-name "GstTagList") - (gtype-id "GST_TYPE_TAG_LIST") -) - -(define-boxed GError - (in-module "Gst") - (c-name "GError") - (gtype-id "GST_TYPE_G_ERROR") - (copy-func "g_error_copy") - (release-func "g_error_free") - (fields - '("GQuark" "domain") - '("gint" "code") - '("gchar*" "message")) -) - -(define-boxed Date - (in-module "Gst") - (c-name "GstDate") - (gtype-id "GST_TYPE_DATE") - (fields - '("gint" "day") - '("gint" "month") - '("gint" "year") - ) -) - -(define-boxed Segment - (in-module "Gst") - (c-name "GstSegment") - (gtype-id "GST_TYPE_SEGMENT") - (fields - '("gdouble" "rate") - '("gdouble" "abs_rate") - '("GstFormat" "format") - '("GstSeekFlags" "flags") - '("gint64" "start") - '("gint64" "stop") - '("gint64" "time") - '("gint64" "accum") - '("gint64" "last_stop") - '("gint64" "duration") - ) -) - -(define-boxed IndexEntry - (in-module "Gst") - (c-name "GstIndexEntry") - (gtype-id "GST_TYPE_INDEX_ENTRY") - (fields - '("GstIndexEntryType" "type") - '("gint" "id") - '("gint" "NASSOCS") - '("GstAssocFlags" "ASSOC_FLAGS") - '("const-gchar*" "ID_DESCRIPTION") - ) -) - - -(define-pointer StaticPadTemplate - (in-module "Gst") - (c-name "GstStaticPadTemplate") - (gtype-id "GST_TYPE_STATIC_PAD_TEMPLATE") - (fields - '("gchar*" "name_template") - '("GstPadDirection" "direction") - '("GstPadPresence" "presence") - '("GstStaticCaps" "static_caps") - ) -) - -(define-pointer StaticCaps - (in-module "Gst") - (c-name "GstStaticCaps") - (gtype-id "GST_TYPE_STATIC_CAPS") - (fields - '("GstCaps" "caps") - '("const-gchar*" "string") - ) -) - -(define-pointer TypeFind - (in-module "Gst") - (c-name "GstTypeFind") - (gtype-id "GST_TYPE_TYPE_FIND") - (fields - ) -) - -;; Enumerations and flags ... - -(define-flags BinFlags - (in-module "Gst") - (c-name "GstBinFlags") - (gtype-id "GST_TYPE_BIN_FLAGS") - (values - '("last" "GST_BIN_FLAG_LAST") - ) -) - -(define-flags BufferFlag - (in-module "Gst") - (c-name "GstBufferFlag") - (gtype-id "GST_TYPE_BUFFER_FLAG") - (values - '("readonly" "GST_BUFFER_FLAG_READONLY") - '("preroll" "GST_BUFFER_FLAG_PREROLL") - '("discont" "GST_BUFFER_FLAG_DISCONT") - '("in-caps" "GST_BUFFER_FLAG_IN_CAPS") - '("gap" "GST_BUFFER_FLAG_GAP") - '("delta-unit" "GST_BUFFER_FLAG_DELTA_UNIT") - '("media1" "GST_BUFFER_FLAG_MEDIA1") - '("media2" "GST_BUFFER_FLAG_MEDIA2") - '("media3" "GST_BUFFER_FLAG_MEDIA3") - '("last" "GST_BUFFER_FLAG_LAST") - ) -) - -(define-flags BufferCopyFlags - (in-module "Gst") - (c-name "GstBufferCopyFlags") - (gtype-id "GST_TYPE_BUFFER_COPY_FLAGS") - (values - '("flags" "GST_BUFFER_COPY_FLAGS") - '("timestamps" "GST_BUFFER_COPY_TIMESTAMPS") - '("caps" "GST_BUFFER_COPY_CAPS") - ) -) - -(define-enum BufferListItem - (in-module "Gst") - (c-name "GstBufferListItem") - (gtype-id "GST_TYPE_BUFFER_LIST_ITEM") - (values - '("continue" "GST_BUFFER_LIST_CONTINUE") - '("skip-group" "GST_BUFFER_LIST_SKIP_GROUP") - '("end" "GST_BUFFER_LIST_END") - ) -) - -(define-flags BusFlags - (in-module "Gst") - (c-name "GstBusFlags") - (gtype-id "GST_TYPE_BUS_FLAGS") - (values - '("flushing" "GST_BUS_FLUSHING") - '("flag-last" "GST_BUS_FLAG_LAST") - ) -) - -(define-enum BusSyncReply - (in-module "Gst") - (c-name "GstBusSyncReply") - (gtype-id "GST_TYPE_BUS_SYNC_REPLY") - (values - '("drop" "GST_BUS_DROP") - '("pass" "GST_BUS_PASS") - '("async" "GST_BUS_ASYNC") - ) -) - -(define-flags CapsFlags - (in-module "Gst") - (c-name "GstCapsFlags") - (gtype-id "GST_TYPE_CAPS_FLAGS") - (values - '("y" "GST_CAPS_FLAGS_ANY") - ) -) - -(define-enum ClockReturn - (in-module "Gst") - (c-name "GstClockReturn") - (gtype-id "GST_TYPE_CLOCK_RETURN") - (values - '("ok" "GST_CLOCK_OK") - '("early" "GST_CLOCK_EARLY") - '("unscheduled" "GST_CLOCK_UNSCHEDULED") - '("busy" "GST_CLOCK_BUSY") - '("badtime" "GST_CLOCK_BADTIME") - '("error" "GST_CLOCK_ERROR") - '("unsupported" "GST_CLOCK_UNSUPPORTED") - '("done" "GST_CLOCK_DONE") - ) -) - -(define-enum ClockEntryType - (in-module "Gst") - (c-name "GstClockEntryType") - (gtype-id "GST_TYPE_CLOCK_ENTRY_TYPE") - (values - '("single" "GST_CLOCK_ENTRY_SINGLE") - '("periodic" "GST_CLOCK_ENTRY_PERIODIC") - ) -) - -(define-flags ClockFlags - (in-module "Gst") - (c-name "GstClockFlags") - (gtype-id "GST_TYPE_CLOCK_FLAGS") - (values - '("can-do-single-sync" "GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC") - '("can-do-single-async" "GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC") - '("can-do-periodic-sync" "GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC") - '("can-do-periodic-async" "GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC") - '("can-set-resolution" "GST_CLOCK_FLAG_CAN_SET_RESOLUTION") - '("can-set-master" "GST_CLOCK_FLAG_CAN_SET_MASTER") - '("last" "GST_CLOCK_FLAG_LAST") - ) -) - -(define-flags DebugGraphDetails - (in-module "Gst") - (c-name "GstDebugGraphDetails") - (gtype-id "GST_TYPE_DEBUG_GRAPH_DETAILS") - (values - '("media-type" "GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE") - '("caps-details" "GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS") - '("non-default-params" "GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS") - '("states" "GST_DEBUG_GRAPH_SHOW_STATES") - '("all" "GST_DEBUG_GRAPH_SHOW_ALL") - ) -) - -(define-flags ElementFlags - (in-module "Gst") - (c-name "GstElementFlags") - (gtype-id "GST_TYPE_ELEMENT_FLAGS") - (values - '("locked-state" "GST_ELEMENT_LOCKED_STATE") - '("is-sink" "GST_ELEMENT_IS_SINK") - '("unparenting" "GST_ELEMENT_UNPARENTING") - '("flag-last" "GST_ELEMENT_FLAG_LAST") - ) -) - -(define-flags ParamFlags - (in-module "Gst") - (c-name "GstParamFlags") - (values - '("controllable" "GST_PARAM_CONTROLLABLE") - '("mutable-ready" "GST_PARAM_MUTABLE_READY") - '("mutable-paused" "GST_PARAM_MUTABLE_PAUSED") - '("mutable-playing" "GST_PARAM_MUTABLE_PLAYING") - '("user-shift" "GST_PARAM_USER_SHIFT") - ) -) - -(define-enum CoreError - (in-module "Gst") - (c-name "GstCoreError") - (gtype-id "GST_TYPE_CORE_ERROR") - (values - '("failed" "GST_CORE_ERROR_FAILED") - '("too-lazy" "GST_CORE_ERROR_TOO_LAZY") - '("not-implemented" "GST_CORE_ERROR_NOT_IMPLEMENTED") - '("state-change" "GST_CORE_ERROR_STATE_CHANGE") - '("pad" "GST_CORE_ERROR_PAD") - '("thread" "GST_CORE_ERROR_THREAD") - '("negotiation" "GST_CORE_ERROR_NEGOTIATION") - '("event" "GST_CORE_ERROR_EVENT") - '("seek" "GST_CORE_ERROR_SEEK") - '("caps" "GST_CORE_ERROR_CAPS") - '("tag" "GST_CORE_ERROR_TAG") - '("missing-plugin" "GST_CORE_ERROR_MISSING_PLUGIN") - '("clock" "GST_CORE_ERROR_CLOCK") - '("disabled" "GST_CORE_ERROR_DISABLED") - '("num-errors" "GST_CORE_ERROR_NUM_ERRORS") - ) -) - -(define-enum LibraryError - (in-module "Gst") - (c-name "GstLibraryError") - (gtype-id "GST_TYPE_LIBRARY_ERROR") - (values - '("failed" "GST_LIBRARY_ERROR_FAILED") - '("too-lazy" "GST_LIBRARY_ERROR_TOO_LAZY") - '("init" "GST_LIBRARY_ERROR_INIT") - '("shutdown" "GST_LIBRARY_ERROR_SHUTDOWN") - '("settings" "GST_LIBRARY_ERROR_SETTINGS") - '("encode" "GST_LIBRARY_ERROR_ENCODE") - '("num-errors" "GST_LIBRARY_ERROR_NUM_ERRORS") - ) -) - -(define-enum ResourceError - (in-module "Gst") - (c-name "GstResourceError") - (gtype-id "GST_TYPE_RESOURCE_ERROR") - (values - '("failed" "GST_RESOURCE_ERROR_FAILED") - '("too-lazy" "GST_RESOURCE_ERROR_TOO_LAZY") - '("not-found" "GST_RESOURCE_ERROR_NOT_FOUND") - '("busy" "GST_RESOURCE_ERROR_BUSY") - '("open-read" "GST_RESOURCE_ERROR_OPEN_READ") - '("open-write" "GST_RESOURCE_ERROR_OPEN_WRITE") - '("open-read-write" "GST_RESOURCE_ERROR_OPEN_READ_WRITE") - '("close" "GST_RESOURCE_ERROR_CLOSE") - '("read" "GST_RESOURCE_ERROR_READ") - '("write" "GST_RESOURCE_ERROR_WRITE") - '("seek" "GST_RESOURCE_ERROR_SEEK") - '("sync" "GST_RESOURCE_ERROR_SYNC") - '("settings" "GST_RESOURCE_ERROR_SETTINGS") - '("no-space-left" "GST_RESOURCE_ERROR_NO_SPACE_LEFT") - '("num-errors" "GST_RESOURCE_ERROR_NUM_ERRORS") - ) -) - -(define-enum StreamError - (in-module "Gst") - (c-name "GstStreamError") - (gtype-id "GST_TYPE_STREAM_ERROR") - (values - '("failed" "GST_STREAM_ERROR_FAILED") - '("too-lazy" "GST_STREAM_ERROR_TOO_LAZY") - '("not-implemented" "GST_STREAM_ERROR_NOT_IMPLEMENTED") - '("type-not-found" "GST_STREAM_ERROR_TYPE_NOT_FOUND") - '("wrong-type" "GST_STREAM_ERROR_WRONG_TYPE") - '("codec-not-found" "GST_STREAM_ERROR_CODEC_NOT_FOUND") - '("decode" "GST_STREAM_ERROR_DECODE") - '("encode" "GST_STREAM_ERROR_ENCODE") - '("demux" "GST_STREAM_ERROR_DEMUX") - '("mux" "GST_STREAM_ERROR_MUX") - '("format" "GST_STREAM_ERROR_FORMAT") - '("decrypt" "GST_STREAM_ERROR_DECRYPT") - '("decrypt-nokey" "GST_STREAM_ERROR_DECRYPT_NOKEY") - '("num-errors" "GST_STREAM_ERROR_NUM_ERRORS") - ) -) - -(define-flags EventTypeFlags - (in-module "Gst") - (c-name "GstEventTypeFlags") - (gtype-id "GST_TYPE_EVENT_TYPE_FLAGS") - (values - '("upstream" "GST_EVENT_TYPE_UPSTREAM") - '("downstream" "GST_EVENT_TYPE_DOWNSTREAM") - '("serialized" "GST_EVENT_TYPE_SERIALIZED") - ) -) - -(define-enum EventType - (in-module "Gst") - (c-name "GstEventType") - (gtype-id "GST_TYPE_EVENT_TYPE") - (values - '("unknown" "GST_EVENT_UNKNOWN") - '("flush-start" "GST_EVENT_FLUSH_START") - '("flush-stop" "GST_EVENT_FLUSH_STOP") - '("eos" "GST_EVENT_EOS") - '("newsegment" "GST_EVENT_NEWSEGMENT") - '("tag" "GST_EVENT_TAG") - '("filler" "GST_EVENT_FILLER") - '("buffersize" "GST_EVENT_BUFFERSIZE") - '("sink-message" "GST_EVENT_SINK_MESSAGE") - '("qos" "GST_EVENT_QOS") - '("seek" "GST_EVENT_SEEK") - '("navigation" "GST_EVENT_NAVIGATION") - '("latency" "GST_EVENT_LATENCY") - '("step" "GST_EVENT_STEP") - '("custom-upstream" "GST_EVENT_CUSTOM_UPSTREAM") - '("custom-downstream" "GST_EVENT_CUSTOM_DOWNSTREAM") - '("custom-downstream-oob" "GST_EVENT_CUSTOM_DOWNSTREAM_OOB") - '("custom-both" "GST_EVENT_CUSTOM_BOTH") - '("custom-both-oob" "GST_EVENT_CUSTOM_BOTH_OOB") - ) -) - -(define-enum SeekType - (in-module "Gst") - (c-name "GstSeekType") - (gtype-id "GST_TYPE_SEEK_TYPE") - (values - '("none" "GST_SEEK_TYPE_NONE") - '("cur" "GST_SEEK_TYPE_CUR") - '("set" "GST_SEEK_TYPE_SET") - '("end" "GST_SEEK_TYPE_END") - ) -) - -(define-flags SeekFlags - (in-module "Gst") - (c-name "GstSeekFlags") - (gtype-id "GST_TYPE_SEEK_FLAGS") - (values - '("none" "GST_SEEK_FLAG_NONE") - '("flush" "GST_SEEK_FLAG_FLUSH") - '("accurate" "GST_SEEK_FLAG_ACCURATE") - '("key-unit" "GST_SEEK_FLAG_KEY_UNIT") - '("segment" "GST_SEEK_FLAG_SEGMENT") - '("skip" "GST_SEEK_FLAG_SKIP") - ) -) - -(define-enum Format - (in-module "Gst") - (c-name "GstFormat") - (gtype-id "GST_TYPE_FORMAT") - (values - '("undefined" "GST_FORMAT_UNDEFINED") - '("default" "GST_FORMAT_DEFAULT") - '("bytes" "GST_FORMAT_BYTES") - '("time" "GST_FORMAT_TIME") - '("buffers" "GST_FORMAT_BUFFERS") - '("percent" "GST_FORMAT_PERCENT") - ) -) - -(define-enum IndexCertainty - (in-module "Gst") - (c-name "GstIndexCertainty") - (gtype-id "GST_TYPE_INDEX_CERTAINTY") - (values - '("unknown" "GST_INDEX_UNKNOWN") - '("certain" "GST_INDEX_CERTAIN") - '("fuzzy" "GST_INDEX_FUZZY") - ) -) - -(define-enum IndexEntryType - (in-module "Gst") - (c-name "GstIndexEntryType") - (gtype-id "GST_TYPE_INDEX_ENTRY_TYPE") - (values - '("id" "GST_INDEX_ENTRY_ID") - '("association" "GST_INDEX_ENTRY_ASSOCIATION") - '("object" "GST_INDEX_ENTRY_OBJECT") - '("format" "GST_INDEX_ENTRY_FORMAT") - ) -) - -(define-enum IndexLookupMethod - (in-module "Gst") - (c-name "GstIndexLookupMethod") - (gtype-id "GST_TYPE_INDEX_LOOKUP_METHOD") - (values - '("exact" "GST_INDEX_LOOKUP_EXACT") - '("before" "GST_INDEX_LOOKUP_BEFORE") - '("after" "GST_INDEX_LOOKUP_AFTER") - ) -) - -(define-flags AssocFlags - (in-module "Gst") - (c-name "GstAssocFlags") - (gtype-id "GST_TYPE_ASSOC_FLAGS") - (values - '("none" "GST_ASSOCIATION_FLAG_NONE") - '("key-unit" "GST_ASSOCIATION_FLAG_KEY_UNIT") - '("delta-unit" "GST_ASSOCIATION_FLAG_DELTA_UNIT") - '("last" "GST_ASSOCIATION_FLAG_LAST") - ) -) - -(define-enum IndexResolverMethod - (in-module "Gst") - (c-name "GstIndexResolverMethod") - (gtype-id "GST_TYPE_INDEX_RESOLVER_METHOD") - (values - '("custom" "GST_INDEX_RESOLVER_CUSTOM") - '("gtype" "GST_INDEX_RESOLVER_GTYPE") - '("path" "GST_INDEX_RESOLVER_PATH") - ) -) - -(define-flags IndexFlags - (in-module "Gst") - (c-name "GstIndexFlags") - (gtype-id "GST_TYPE_INDEX_FLAGS") - (values - '("writable" "GST_INDEX_WRITABLE") - '("readable" "GST_INDEX_READABLE") - '("flag-last" "GST_INDEX_FLAG_LAST") - ) -) - -(define-enum DebugLevel - (in-module "Gst") - (c-name "GstDebugLevel") - (gtype-id "GST_TYPE_DEBUG_LEVEL") - (values - '("none" "GST_LEVEL_NONE") - '("error" "GST_LEVEL_ERROR") - '("warning" "GST_LEVEL_WARNING") - '("info" "GST_LEVEL_INFO") - '("debug" "GST_LEVEL_DEBUG") - '("log" "GST_LEVEL_LOG") - '("fixme" "GST_LEVEL_FIXME") - '("trace" "GST_LEVEL_TRACE") - '("memdump" "GST_LEVEL_MEMDUMP") - '("count" "GST_LEVEL_COUNT") - ) -) - -(define-enum DebugColorFlags - (in-module "Gst") - (c-name "GstDebugColorFlags") - (gtype-id "GST_TYPE_DEBUG_COLOR_FLAGS") - (values - '("fg-black" "GST_DEBUG_FG_BLACK") - '("fg-red" "GST_DEBUG_FG_RED") - '("fg-green" "GST_DEBUG_FG_GREEN") - '("fg-yellow" "GST_DEBUG_FG_YELLOW") - '("fg-blue" "GST_DEBUG_FG_BLUE") - '("fg-magenta" "GST_DEBUG_FG_MAGENTA") - '("fg-cyan" "GST_DEBUG_FG_CYAN") - '("fg-white" "GST_DEBUG_FG_WHITE") - '("bg-black" "GST_DEBUG_BG_BLACK") - '("bg-red" "GST_DEBUG_BG_RED") - '("bg-green" "GST_DEBUG_BG_GREEN") - '("bg-yellow" "GST_DEBUG_BG_YELLOW") - '("bg-blue" "GST_DEBUG_BG_BLUE") - '("bg-magenta" "GST_DEBUG_BG_MAGENTA") - '("bg-cyan" "GST_DEBUG_BG_CYAN") - '("bg-white" "GST_DEBUG_BG_WHITE") - '("bold" "GST_DEBUG_BOLD") - '("underline" "GST_DEBUG_UNDERLINE") - ) -) - -(define-enum IteratorResult - (in-module "Gst") - (c-name "GstIteratorResult") - (gtype-id "GST_TYPE_ITERATOR_RESULT") - (values - '("done" "GST_ITERATOR_DONE") - '("ok" "GST_ITERATOR_OK") - '("resync" "GST_ITERATOR_RESYNC") - '("error" "GST_ITERATOR_ERROR") - ) -) - -(define-enum IteratorItem - (in-module "Gst") - (c-name "GstIteratorItem") - (gtype-id "GST_TYPE_ITERATOR_ITEM") - (values - '("skip" "GST_ITERATOR_ITEM_SKIP") - '("pass" "GST_ITERATOR_ITEM_PASS") - '("end" "GST_ITERATOR_ITEM_END") - ) -) - -(define-flags MessageType - (in-module "Gst") - (c-name "GstMessageType") - (gtype-id "GST_TYPE_MESSAGE_TYPE") - (values - '("unknown" "GST_MESSAGE_UNKNOWN") - '("eos" "GST_MESSAGE_EOS") - '("error" "GST_MESSAGE_ERROR") - '("warning" "GST_MESSAGE_WARNING") - '("info" "GST_MESSAGE_INFO") - '("tag" "GST_MESSAGE_TAG") - '("buffering" "GST_MESSAGE_BUFFERING") - '("state-changed" "GST_MESSAGE_STATE_CHANGED") - '("state-dirty" "GST_MESSAGE_STATE_DIRTY") - '("step-done" "GST_MESSAGE_STEP_DONE") - '("clock-provide" "GST_MESSAGE_CLOCK_PROVIDE") - '("clock-lost" "GST_MESSAGE_CLOCK_LOST") - '("new-clock" "GST_MESSAGE_NEW_CLOCK") - '("structure-change" "GST_MESSAGE_STRUCTURE_CHANGE") - '("stream-status" "GST_MESSAGE_STREAM_STATUS") - '("application" "GST_MESSAGE_APPLICATION") - '("element" "GST_MESSAGE_ELEMENT") - '("segment-start" "GST_MESSAGE_SEGMENT_START") - '("segment-done" "GST_MESSAGE_SEGMENT_DONE") - '("duration" "GST_MESSAGE_DURATION") - '("latency" "GST_MESSAGE_LATENCY") - '("async-start" "GST_MESSAGE_ASYNC_START") - '("async-done" "GST_MESSAGE_ASYNC_DONE") - '("request-state" "GST_MESSAGE_REQUEST_STATE") - '("step-start" "GST_MESSAGE_STEP_START") - '("qos" "GST_MESSAGE_QOS") - '("any" "GST_MESSAGE_ANY") - ) -) - -(define-enum StructureChangeType - (in-module "Gst") - (c-name "GstStructureChangeType") - (gtype-id "GST_TYPE_STRUCTURE_CHANGE_TYPE") - (values - '("link" "GST_STRUCTURE_CHANGE_TYPE_PAD_LINK") - '("unlink" "GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK") - ) -) - -(define-enum StreamStatusType - (in-module "Gst") - (c-name "GstStreamStatusType") - (gtype-id "GST_TYPE_STREAM_STATUS_TYPE") - (values - '("create" "GST_STREAM_STATUS_TYPE_CREATE") - '("enter" "GST_STREAM_STATUS_TYPE_ENTER") - '("leave" "GST_STREAM_STATUS_TYPE_LEAVE") - '("destroy" "GST_STREAM_STATUS_TYPE_DESTROY") - '("start" "GST_STREAM_STATUS_TYPE_START") - '("pause" "GST_STREAM_STATUS_TYPE_PAUSE") - '("stop" "GST_STREAM_STATUS_TYPE_STOP") - ) -) - -(define-flags MiniObjectFlags - (in-module "Gst") - (c-name "GstMiniObjectFlags") - (gtype-id "GST_TYPE_MINI_OBJECT_FLAGS") - (values - '("readonly" "GST_MINI_OBJECT_FLAG_READONLY") - '("last" "GST_MINI_OBJECT_FLAG_LAST") - ) -) - -(define-flags ObjectFlags - (in-module "Gst") - (c-name "GstObjectFlags") - (gtype-id "GST_TYPE_OBJECT_FLAGS") - (values - '("disposing" "GST_OBJECT_DISPOSING") - '("floating" "GST_OBJECT_FLOATING") - '("flag-last" "GST_OBJECT_FLAG_LAST") - ) -) - -(define-enum PadLinkReturn - (in-module "Gst") - (c-name "GstPadLinkReturn") - (gtype-id "GST_TYPE_PAD_LINK_RETURN") - (values - '("ok" "GST_PAD_LINK_OK") - '("wrong-hierarchy" "GST_PAD_LINK_WRONG_HIERARCHY") - '("was-linked" "GST_PAD_LINK_WAS_LINKED") - '("wrong-direction" "GST_PAD_LINK_WRONG_DIRECTION") - '("noformat" "GST_PAD_LINK_NOFORMAT") - '("nosched" "GST_PAD_LINK_NOSCHED") - '("refused" "GST_PAD_LINK_REFUSED") - ) -) - -(define-enum FlowReturn - (in-module "Gst") - (c-name "GstFlowReturn") - (gtype-id "GST_TYPE_FLOW_RETURN") - (values - '("custom-success-2" "GST_FLOW_CUSTOM_SUCCESS_2") - '("custom-success-1" "GST_FLOW_CUSTOM_SUCCESS_1") - '("custom-success" "GST_FLOW_CUSTOM_SUCCESS") - '("resend" "GST_FLOW_RESEND") - '("ok" "GST_FLOW_OK") - '("not-linked" "GST_FLOW_NOT_LINKED") - '("wrong-state" "GST_FLOW_WRONG_STATE") - '("unexpected" "GST_FLOW_UNEXPECTED") - '("not-negotiated" "GST_FLOW_NOT_NEGOTIATED") - '("error" "GST_FLOW_ERROR") - '("not-supported" "GST_FLOW_NOT_SUPPORTED") - '("custom-error" "GST_FLOW_CUSTOM_ERROR") - '("custom-error-1" "GST_FLOW_CUSTOM_ERROR_1") - '("custom-error-2" "GST_FLOW_CUSTOM_ERROR_2") - ) -) - -(define-flags PadLinkCheck - (in-module "Gst") - (c-name "GstPadLinkCheck") - (gtype-id "GST_TYPE_PAD_LINK_CHECK") - (values - '("nothing" "GST_PAD_LINK_CHECK_NOTHING") - '("hierarchy" "GST_PAD_LINK_CHECK_HIERARCHY") - '("template-caps" "GST_PAD_LINK_CHECK_TEMPLATE_CAPS") - '("caps" "GST_PAD_LINK_CHECK_CAPS") - ) -) - -(define-enum ActivateMode - (in-module "Gst") - (c-name "GstActivateMode") - (gtype-id "GST_TYPE_ACTIVATE_MODE") - (values - '("none" "GST_ACTIVATE_NONE") - '("push" "GST_ACTIVATE_PUSH") - '("pull" "GST_ACTIVATE_PULL") - ) -) - -(define-enum PadDirection - (in-module "Gst") - (c-name "GstPadDirection") - (gtype-id "GST_TYPE_PAD_DIRECTION") - (values - '("unknown" "GST_PAD_UNKNOWN") - '("src" "GST_PAD_SRC") - '("sink" "GST_PAD_SINK") - ) -) - -(define-flags PadFlags - (in-module "Gst") - (c-name "GstPadFlags") - (gtype-id "GST_TYPE_PAD_FLAGS") - (values - '("blocked" "GST_PAD_BLOCKED") - '("flushing" "GST_PAD_FLUSHING") - '("in-getcaps" "GST_PAD_IN_GETCAPS") - '("in-setcaps" "GST_PAD_IN_SETCAPS") - '("flag-last" "GST_PAD_FLAG_LAST") - ) -) - -(define-enum PadPresence - (in-module "Gst") - (c-name "GstPadPresence") - (gtype-id "GST_TYPE_PAD_PRESENCE") - (values - '("always" "GST_PAD_ALWAYS") - '("sometimes" "GST_PAD_SOMETIMES") - '("request" "GST_PAD_REQUEST") - ) -) - -(define-flags PadTemplateFlags - (in-module "Gst") - (c-name "GstPadTemplateFlags") - (gtype-id "GST_TYPE_PAD_TEMPLATE_FLAGS") - (values - '("fixed" "GST_PAD_TEMPLATE_FIXED") - '("flag-last" "GST_PAD_TEMPLATE_FLAG_LAST") - ) -) - -(define-enum ParseError - (in-module "Gst") - (c-name "GstParseError") - (gtype-id "GST_TYPE_PARSE_ERROR") - (values - '("syntax" "GST_PARSE_ERROR_SYNTAX") - '("no-such-element" "GST_PARSE_ERROR_NO_SUCH_ELEMENT") - '("no-such-property" "GST_PARSE_ERROR_NO_SUCH_PROPERTY") - '("link" "GST_PARSE_ERROR_LINK") - '("could-not-set-property" "GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY") - '("empty-bin" "GST_PARSE_ERROR_EMPTY_BIN") - '("empty" "GST_PARSE_ERROR_EMPTY") - ) -) - -(define-flags ParseFlags - (in-module "Gst") - (c-name "GstParseFlags") - (gtype-id "GST_TYPE_PARSE_FLAGS") - (values - '("none" "GST_PARSE_FLAG_NONE") - '("fatal-errors" "GST_PARSE_FLAG_FATAL_ERRORS") - ) -) - -(define-flags PipelineFlags - (in-module "Gst") - (c-name "GstPipelineFlags") - (gtype-id "GST_TYPE_PIPELINE_FLAGS") - (values - '("fixed-clock" "GST_PIPELINE_FLAG_FIXED_CLOCK") - '("last" "GST_PIPELINE_FLAG_LAST") - ) -) - -(define-enum PluginError - (in-module "Gst") - (c-name "GstPluginError") - (gtype-id "GST_TYPE_PLUGIN_ERROR") - (values - '("module" "GST_PLUGIN_ERROR_MODULE") - '("dependencies" "GST_PLUGIN_ERROR_DEPENDENCIES") - '("name-mismatch" "GST_PLUGIN_ERROR_NAME_MISMATCH") - ) -) - -(define-flags PluginFlags - (in-module "Gst") - (c-name "GstPluginFlags") - (gtype-id "GST_TYPE_PLUGIN_FLAGS") - (values - '("cached" "GST_PLUGIN_FLAG_CACHED") - '("blacklisted" "GST_PLUGIN_FLAG_BLACKLISTED") - ) -) - -(define-enum QueryType - (in-module "Gst") - (c-name "GstQueryType") - (gtype-id "GST_TYPE_QUERY_TYPE") - (values - '("none" "GST_QUERY_NONE") - '("position" "GST_QUERY_POSITION") - '("duration" "GST_QUERY_DURATION") - '("latency" "GST_QUERY_LATENCY") - '("jitter" "GST_QUERY_JITTER") - '("rate" "GST_QUERY_RATE") - '("seeking" "GST_QUERY_SEEKING") - '("segment" "GST_QUERY_SEGMENT") - '("convert" "GST_QUERY_CONVERT") - '("formats" "GST_QUERY_FORMATS") - '("buffering" "GST_QUERY_BUFFERING") - '("custom" "GST_QUERY_CUSTOM") - '("uri" "GST_QUERY_URI") - ) -) - -(define-enum BufferingMode - (in-module "Gst") - (c-name "GstBufferingMode") - (gtype-id "GST_TYPE_BUFFERING_MODE") - (values - '("stream" "GST_BUFFERING_STREAM") - '("download" "GST_BUFFERING_DOWNLOAD") - '("timeshift" "GST_BUFFERING_TIMESHIFT") - '("live" "GST_BUFFERING_LIVE") - ) -) - -(define-enum TagMergeMode - (in-module "Gst") - (c-name "GstTagMergeMode") - (gtype-id "GST_TYPE_TAG_MERGE_MODE") - (values - '("undefined" "GST_TAG_MERGE_UNDEFINED") - '("replace-all" "GST_TAG_MERGE_REPLACE_ALL") - '("replace" "GST_TAG_MERGE_REPLACE") - '("append" "GST_TAG_MERGE_APPEND") - '("prepend" "GST_TAG_MERGE_PREPEND") - '("keep" "GST_TAG_MERGE_KEEP") - '("keep-all" "GST_TAG_MERGE_KEEP_ALL") - '("count" "GST_TAG_MERGE_COUNT") - ) -) - -(define-enum TagFlag - (in-module "Gst") - (c-name "GstTagFlag") - (gtype-id "GST_TYPE_TAG_FLAG") - (values - '("undefined" "GST_TAG_FLAG_UNDEFINED") - '("meta" "GST_TAG_FLAG_META") - '("encoded" "GST_TAG_FLAG_ENCODED") - '("decoded" "GST_TAG_FLAG_DECODED") - '("count" "GST_TAG_FLAG_COUNT") - ) -) - -(define-enum TaskState - (in-module "Gst") - (c-name "GstTaskState") - (gtype-id "GST_TYPE_TASK_STATE") - (values - '("started" "GST_TASK_STARTED") - '("stopped" "GST_TASK_STOPPED") - '("paused" "GST_TASK_PAUSED") - ) -) - -(define-flags AllocTraceFlags - (in-module "Gst") - (c-name "GstAllocTraceFlags") - (gtype-id "GST_TYPE_ALLOC_TRACE_FLAGS") - (values - '("live" "GST_ALLOC_TRACE_LIVE") - '("mem-live" "GST_ALLOC_TRACE_MEM_LIVE") - ) -) - -(define-enum TypeFindProbability - (in-module "Gst") - (c-name "GstTypeFindProbability") - (gtype-id "GST_TYPE_TYPE_FIND_PROBABILITY") - (values - '("minimum" "GST_TYPE_FIND_MINIMUM") - '("possible" "GST_TYPE_FIND_POSSIBLE") - '("likely" "GST_TYPE_FIND_LIKELY") - '("nearly-certain" "GST_TYPE_FIND_NEARLY_CERTAIN") - '("maximum" "GST_TYPE_FIND_MAXIMUM") - ) -) - -(define-enum State - (in-module "Gst") - (c-name "GstState") - (gtype-id "GST_TYPE_STATE") - (values - '("void-pending" "GST_STATE_VOID_PENDING") - '("null" "GST_STATE_NULL") - '("ready" "GST_STATE_READY") - '("paused" "GST_STATE_PAUSED") - '("playing" "GST_STATE_PLAYING") - ) -) - -(define-enum StateChangeReturn - (in-module "Gst") - (c-name "GstStateChangeReturn") - (gtype-id "GST_TYPE_STATE_CHANGE_RETURN") - (values - '("failure" "GST_STATE_CHANGE_FAILURE") - '("success" "GST_STATE_CHANGE_SUCCESS") - '("async" "GST_STATE_CHANGE_ASYNC") - '("no-preroll" "GST_STATE_CHANGE_NO_PREROLL") - ) -) - -(define-enum StateChange - (in-module "Gst") - (c-name "GstStateChange") - (gtype-id "GST_TYPE_STATE_CHANGE") - (values - '("null-to-ready" "GST_STATE_CHANGE_NULL_TO_READY") - '("ready-to-paused" "GST_STATE_CHANGE_READY_TO_PAUSED") - '("paused-to-playing" "GST_STATE_CHANGE_PAUSED_TO_PLAYING") - '("playing-to-paused" "GST_STATE_CHANGE_PLAYING_TO_PAUSED") - '("paused-to-ready" "GST_STATE_CHANGE_PAUSED_TO_READY") - '("ready-to-null" "GST_STATE_CHANGE_READY_TO_NULL") - ) -) - -(define-enum Rank - (in-module "Gst") - (c-name "GstRank") - (gtype-id "GST_TYPE_RANK") - (values - '("none" "GST_RANK_NONE") - '("marginal" "GST_RANK_MARGINAL") - '("secondary" "GST_RANK_SECONDARY") - '("primary" "GST_RANK_PRIMARY") - ) -) - -(define-enum URIType - (in-module "Gst") - (c-name "GstURIType") - (gtype-id "GST_TYPE_URI_TYPE") - (values - '("unknown" "GST_URI_UNKNOWN") - '("sink" "GST_URI_SINK") - '("src" "GST_URI_SRC") - ) -) - -(define-enum SearchMode - (in-module "Gst") - (c-name "GstSearchMode") - (gtype-id "GST_TYPE_SEARCH_MODE") - (values - '("exact" "GST_SEARCH_MODE_EXACT") - '("before" "GST_SEARCH_MODE_BEFORE") - '("after" "GST_SEARCH_MODE_AFTER") - ) -) - -(define-interface URIHandler - (in-module "Gst") - (c-name "GstURIHandler") - (gtype-id "GST_TYPE_URI_HANDLER") - (vtable "GstURIHandlerInterface") -) - -(define-interface TagSetter - (in-module "Gst") - (c-name "GstTagSetter") - (gtype-id "GST_TYPE_TAG_SETTER") -) - -(define-interface ImplementsInterface - (in-module "Gst") - (c-name "GstImplementsInterface") - (gtype-id "GST_TYPE_IMPLEMENTS_INTERFACE") - (vtable "GstImplementsInterfaceClass") -) - -(define-interface Preset - (in-module "Gst") - (c-name "GstPreset") - (gtype-id "GST_TYPE_PRESET") -) diff --git a/gst/gst.defs b/gst/gst.defs deleted file mode 100644 index 5942596de8..0000000000 --- a/gst/gst.defs +++ /dev/null @@ -1,9504 +0,0 @@ -;; -*- scheme -*- - -(include "gst-extrafuncs.defs") -(include "gst-types.defs") -(include "libs.defs") -(include "base.defs") - -;; From ../gstreamer/gst/gst.h - -(define-function init - (c-name "gst_init") - (return-type "none") - (parameters - '("int*" "argc") - '("char**[]" "argv") - ) -) - -(define-function init_check - (c-name "gst_init_check") - (return-type "gboolean") - (parameters - '("int*" "argc") - '("char**[]" "argv") - '("GError**" "err") - ) -) - -(define-function is_initialized - (c-name "gst_is_initialized") - (return-type "gboolean") -) - - -(define-function init_get_option_group - (c-name "gst_init_get_option_group") - (return-type "GOptionGroup*") -) - -(define-function deinit - (c-name "gst_deinit") - (return-type "none") -) - -(define-function version - (c-name "gst_version") - (return-type "none") - (parameters - '("guint*" "major") - '("guint*" "minor") - '("guint*" "micro") - '("guint*" "nano") - ) -) - -(define-function version_string - (c-name "gst_version_string") - (return-type "gchar*") -) - -(define-function segtrap_is_enabled - (c-name "gst_segtrap_is_enabled") - (return-type "gboolean") -) - -(define-function segtrap_set_enabled - (c-name "gst_segtrap_set_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-function registry_fork_is_enabled - (c-name "gst_registry_fork_is_enabled") - (return-type "gboolean") -) - -(define-function registry_fork_set_enabled - (c-name "gst_registry_fork_set_enabled") - (return-type "none") - (parameters - '("gboolean" "enabled") - ) -) - -(define-function update_registry - (c-name "gst_update_registry") - (return-type "gboolean") -) - -(define-function get_gst_version - (c-name "gst_get_gst_version") - (return-type "none") -) - -(define-function get_pygst_version - (c-name "gst_get_pygst_version") - (return-type "none") -) - - -;; From ../gstreamer/gst/gstbin.h - -(define-function bin_get_type - (c-name "gst_bin_get_type") - (return-type "GType") -) - -(define-function bin_new - (c-name "gst_bin_new") - (is-constructor-of "GstBin") - (return-type "GstElement*") - (properties - '("name" (argname "name") (optional)) - ) -) - -(define-method add - (of-object "GstBin") - (c-name "gst_bin_add") - (return-type "none") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - -(define-method add_many - (of-object "GstBin") - (c-name "gst_bin_add_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - -(define-method remove - (of-object "GstBin") - (c-name "gst_bin_remove") - (return-type "gboolean") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - -(define-method remove_many - (of-object "GstBin") - (c-name "gst_bin_remove_many") - (return-type "gboolean") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - -(define-method get_by_name - (of-object "GstBin") - (c-name "gst_bin_get_by_name") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_by_name_recurse_up - (of-object "GstBin") - (c-name "gst_bin_get_by_name_recurse_up") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_by_interface - (of-object "GstBin") - (c-name "gst_bin_get_by_interface") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("GType" "iface_gtype") - ) -) - -(define-method elements - (of-object "GstBin") - (c-name "gst_bin_iterate_elements") - (return-type "GstIterator*") -) - -(define-method sorted - (of-object "GstBin") - (c-name "gst_bin_iterate_sorted") - (return-type "GstIterator*") -) - -(define-method recurse - (of-object "GstBin") - (c-name "gst_bin_iterate_recurse") - (return-type "GstIterator*") -) - -(define-method sinks - (of-object "GstBin") - (c-name "gst_bin_iterate_sinks") - (return-type "GstIterator*") -) - -(define-method iterate_sources - (of-object "GstBin") - (c-name "gst_bin_iterate_sources") - (return-type "GstIterator*") -) - -(define-method iterate_all_by_interface - (of-object "GstBin") - (c-name "gst_bin_iterate_all_by_interface") - (return-type "GstIterator*") - (parameters - '("GType" "iface_gtype") - ) -) - -(define-method recalculate_latency - (of-object "GstBin") - (c-name "gst_bin_recalculate_latency") - (return-type "gboolean") -) - -(define-virtual add_element - (of-object "GstBin") - (return-type "gboolean") - (parameters - '("GstElement*" "element") - ) -) - -(define-virtual remove_element - (of-object "GstBin") - (return-type "gboolean") - (parameters - '("GstElement*" "element") - ) -) - -(define-virtual handle_message - (of-object "GstBin") - (return-type "none") - (parameters - '("GstMessage*" "message") - ) -) - -;; From ../gstreamer/gst/gstbuffer.h - -(define-function buffer_get_type - (c-name "gst_buffer_get_type") - (return-type "GType") -) - -(define-function buffer_new - (c-name "gst_buffer_new") - (is-constructor-of "GstBuffer") - (return-type "GstBuffer*") -) - -(define-function buffer_new_and_alloc - (c-name "gst_buffer_new_and_alloc") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("guint" "size") - ) -) - -(define-function buffer_try_new_and_alloc - (c-name "gst_buffer_try_new_and_alloc") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("guint" "size") - ) -) - -(define-method is_metadata_writable - (of-object "GstBuffer") - (c-name "gst_buffer_is_metadata_writable") - (return-type "gboolean") -) - -(define-method make_metadata_writable - (of-object "GstBuffer") - (c-name "gst_buffer_make_metadata_writable") - (return-type "GstBuffer*") -) - -(define-method get_caps - (of-object "GstBuffer") - (c-name "gst_buffer_get_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method set_caps - (of-object "GstBuffer") - (c-name "gst_buffer_set_caps") - (return-type "none") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method create_sub - (of-object "GstBuffer") - (c-name "gst_buffer_create_sub") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("guint" "offset") - '("guint" "size") - ) -) - -(define-method is_span_fast - (of-object "GstBuffer") - (c-name "gst_buffer_is_span_fast") - (return-type "gboolean") - (parameters - '("GstBuffer*" "buf2") - ) -) - -(define-method span - (of-object "GstBuffer") - (c-name "gst_buffer_span") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("guint32" "offset") - '("GstBuffer*" "buf2") - '("guint32" "len") - ) -) - - - -;; From gstbufferlist.h - -(define-function gst_buffer_list_get_type - (c-name "gst_buffer_list_get_type") - (return-type "GType") -) - -(define-function gst_buffer_list_new - (c-name "gst_buffer_list_new") - (is-constructor-of "GstBufferList") - (return-type "GstBufferList*") -) - -(define-method foreach - (of-object "GstBufferList") - (c-name "gst_buffer_list_foreach") - (return-type "none") - (parameters - '("GstBufferListFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method get - (of-object "GstBufferList") - (c-name "gst_buffer_list_get") - (return-type "GstBuffer*") - (parameters - '("guint" "group") - '("guint" "idx") - ) -) - -(define-method iterate - (of-object "GstBufferList") - (c-name "gst_buffer_list_iterate") - (return-type "GstBufferListIterator*") -) - -(define-method free - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_free") - (return-type "none") -) - -(define-method n_buffers - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_n_buffers") - (return-type "guint") -) - -(define-method next - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_next") - (return-type "GstBuffer*") -) - -(define-method next_group - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_next_group") - (return-type "gboolean") -) - -(define-method add - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_add") - (return-type "none") - (parameters - '("GstBuffer*" "buffer") - ) -) - -(define-method add_list - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_add_list") - (return-type "none") - (parameters - '("GList*" "list") - ) -) - -(define-method add_group - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_add_group") - (return-type "none") -) - -(define-method remove - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_remove") - (return-type "none") -) - -(define-method steal - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_steal") - (return-type "GstBuffer*") -) - -(define-method take - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_take") - (return-type "none") - (parameters - '("GstBuffer*" "buffer") - ) -) - -(define-method do - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_do") - (return-type "GstBuffer*") - (parameters - '("GstBufferListDoFunction" "do_func") - '("gpointer" "user_data") - ) -) - -(define-method merge_group - (of-object "GstBufferListIterator") - (c-name "gst_buffer_list_iterator_merge_group") - (return-type "GstBuffer*") -) - - - -;; From ../gstreamer/gst/gstbus.h - -(define-function bus_get_type - (c-name "gst_bus_get_type") - (return-type "GType") -) - -(define-function bus_new - (c-name "gst_bus_new") - (is-constructor-of "GstBus") - (return-type "GstBus*") -) - -(define-method post - (of-object "GstBus") - (c-name "gst_bus_post") - (return-type "gboolean") - (parameters - '("GstMessage*" "message" (keep-refcount)) - ) -) - -(define-method have_pending - (of-object "GstBus") - (c-name "gst_bus_have_pending") - (return-type "gboolean") -) - -(define-method peek - (of-object "GstBus") - (c-name "gst_bus_peek") - (return-type "GstMessage*") - (caller-owns-return #t) -) - -(define-method pop - (of-object "GstBus") - (c-name "gst_bus_pop") - (return-type "GstMessage*") - (caller-owns-return #t) -) - -(define-method pop_filtered - (of-object "GstBus") - (c-name "gst_bus_pop_filtered") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstMessageType" "types") - ) -) - -(define-method timed_pop - (of-object "GstBus") - (c-name "gst_bus_timed_pop") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstClockTime" "timeout") - ) -) - -(define-method timed_pop_filtered - (of-object "GstBus") - (c-name "gst_bus_timed_pop_filtered") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstClockTime" "timeout") - '("GstMessageType" "types") - ) -) - -(define-method set_flushing - (of-object "GstBus") - (c-name "gst_bus_set_flushing") - (return-type "none") - (parameters - '("gboolean" "flushing") - ) -) - -(define-method set_sync_handler - (of-object "GstBus") - (c-name "gst_bus_set_sync_handler") - (return-type "none") - (parameters - '("GstBusSyncHandler" "func") - '("gpointer" "data") - ) -) - -(define-method create_watch - (of-object "GstBus") - (c-name "gst_bus_create_watch") - (return-type "GSource*") -) - -(define-method add_watch_full - (of-object "GstBus") - (c-name "gst_bus_add_watch_full") - (return-type "guint") - (parameters - '("gint" "priority") - '("GstBusFunc" "func") - '("gpointer" "user_data") - '("GDestroyNotify" "notify") - ) -) - -(define-method add_watch - (of-object "GstBus") - (c-name "gst_bus_add_watch") - (return-type "guint") - (parameters - '("GstBusFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method poll - (of-object "GstBus") - (c-name "gst_bus_poll") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstMessageType" "events") - '("GstClockTimeDiff" "timeout") - ) -) - -(define-method async_signal_func - (of-object "GstBus") - (c-name "gst_bus_async_signal_func") - (return-type "gboolean") - (parameters - '("GstMessage*" "message") - '("gpointer" "data") - ) -) - -(define-method sync_signal_handler - (of-object "GstBus") - (c-name "gst_bus_sync_signal_handler") - (return-type "GstBusSyncReply") - (parameters - '("GstMessage*" "message") - '("gpointer" "data") - ) -) - -(define-method add_signal_watch - (of-object "GstBus") - (c-name "gst_bus_add_signal_watch") - (return-type "none") -) - -(define-method add_signal_watch_full - (of-object "GstBus") - (c-name "gst_bus_add_signal_watch_full") - (return-type "none") - (parameters - '("gint" "priority") - ) -) - -(define-method remove_signal_watch - (of-object "GstBus") - (c-name "gst_bus_remove_signal_watch") - (return-type "none") -) - - -(define-method enable_sync_message_emission - (of-object "GstBus") - (c-name "gst_bus_enable_sync_message_emission") - (return-type "none") -) - -(define-method disable_sync_message_emission - (of-object "GstBus") - (c-name "gst_bus_disable_sync_message_emission") - (return-type "none") -) - - -;; From ../gstreamer/gst/gstcaps.h - -(define-function caps_get_type - (c-name "gst_caps_get_type") - (return-type "GType") -) - -(define-function caps_new_empty - (is-constructor-of "GstCaps") - (c-name "gst_caps_new_empty") - (return-type "GstCaps*") -) - -(define-function caps_new_any - (c-name "gst_caps_new_any") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-function caps_new_simple - (c-name "gst_caps_new_simple") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("const-char*" "media_type") - '("const-char*" "fieldname") - ) - (varargs #t) -) - -(define-function caps_new_full - (c-name "gst_caps_new_full") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("GstStructure*" "struct1") - ) - (varargs #t) -) - -(define-function caps_new_full_valist - (c-name "gst_caps_new_full_valist") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("GstStructure*" "structure") - '("va_list" "var_args") - ) -) - -(define-method ref - (of-object "GstCaps") - (c-name "gst_caps_ref") - (return-type "GstCaps*") -) - -(define-method copy - (of-object "GstCaps") - (c-name "gst_caps_copy") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method make_writable - (of-object "GstCaps") - (c-name "gst_caps_make_writable") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method unref - (of-object "GstCaps") - (c-name "gst_caps_unref") - (return-type "none") -) - -(define-method get - (of-object "GstStaticCaps") - (c-name "gst_static_caps_get") - (return-type "GstCaps*") -) - -(define-method append - (of-object "GstCaps") - (c-name "gst_caps_append") - (return-type "none") - (parameters - '("GstCaps*" "caps2") - ) -) - -(define-method append_structure - (of-object "GstCaps") - (c-name "gst_caps_append_structure") - (return-type "none") - (parameters - '("GstStructure*" "structure") - ) -) - -(define-method get_size - (of-object "GstCaps") - (c-name "gst_caps_get_size") - (return-type "guint") -) - -(define-method get_structure - (of-object "GstCaps") - (c-name "gst_caps_get_structure") - (return-type "GstStructure*") - (parameters - '("guint" "index") - ) -) - -(define-method steal_structure - (of-object "GstCaps") - (c-name "gst_caps_steal_structure") - (return-type "GstStructure*") - (caller-owns-return #t) - (parameters - '("guint" "index") - ) -) - -(define-method copy_nth - (of-object "GstCaps") - (c-name "gst_caps_copy_nth") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("guint" "nth") - ) -) - -(define-method truncate - (of-object "GstCaps") - (c-name "gst_caps_truncate") - (return-type "none") -) - -(define-method set_value - (of-object "GstCaps") - (c-name "gst_caps_set_value") - (return-type "none") - (parameters - '("const-char*" "field") - '("const-GValue*" "value") - ) -) - -(define-method set_simple - (of-object "GstCaps") - (c-name "gst_caps_set_simple") - (return-type "none") - (parameters - '("const-char*" "field") - ) - (varargs #t) -) - -(define-method set_simple_valist - (of-object "GstCaps") - (c-name "gst_caps_set_simple_valist") - (return-type "none") - (parameters - '("const-char*" "field") - '("va_list" "varargs") - ) -) - -(define-method is_any - (of-object "GstCaps") - (c-name "gst_caps_is_any") - (return-type "gboolean") -) - -(define-method is_empty - (of-object "GstCaps") - (c-name "gst_caps_is_empty") - (return-type "gboolean") -) - -(define-method is_fixed - (of-object "GstCaps") - (c-name "gst_caps_is_fixed") - (return-type "gboolean") -) - -(define-method is_always_compatible - (of-object "GstCaps") - (c-name "gst_caps_is_always_compatible") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps2") - ) -) - -(define-method is_subset - (of-object "GstCaps") - (c-name "gst_caps_is_subset") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "superset") - ) -) - -(define-method is_equal - (of-object "GstCaps") - (c-name "gst_caps_is_equal") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps2") - ) -) - -(define-method can_intersect - (of-object "GstCaps") - (c-name "gst_caps_can_intersect") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps2") - ) -) - -(define-method intersect - (of-object "GstCaps") - (c-name "gst_caps_intersect") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("const-GstCaps*" "caps2") - ) -) - -(define-method subtract - (of-object "GstCaps") - (c-name "gst_caps_subtract") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("const-GstCaps*" "subtrahend") - ) -) - -(define-method union - (of-object "GstCaps") - (c-name "gst_caps_union") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("const-GstCaps*" "caps2") - ) -) - -(define-method normalize - (of-object "GstCaps") - (c-name "gst_caps_normalize") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method do_simplify - (of-object "GstCaps") - (c-name "gst_caps_do_simplify") - (return-type "gboolean") -) - -(define-method save_thyself - (of-object "GstCaps") - (c-name "gst_caps_save_thyself") - (return-type "xmlNodePtr") - (parameters - '("xmlNodePtr" "parent") - ) -) - -(define-method merge - (of-object "GstCaps") - (c-name "gst_caps_merge") - (return-type "none") - (parameters - '("GstCaps*" "caps2") - ) -) - -(define-method merge_structure - (of-object "GstCaps") - (c-name "gst_caps_merge_structure") - (return-type "none") - (parameters - '("GstStructure*" "structure") - ) -) - -(define-function caps_load_thyself - (c-name "gst_caps_load_thyself") - (return-type "GstCaps*") - (parameters - '("xmlNodePtr" "parent") - ) -) - -(define-function caps_replace - (c-name "gst_caps_replace") - (return-type "none") - (parameters - '("GstCaps**" "caps") - '("GstCaps*" "newcaps") - ) -) - -(define-method to_string - (of-object "GstCaps") - (c-name "gst_caps_to_string") - (return-type "gchar*") -) - -(define-function caps_from_string - (c-name "gst_caps_from_string") - (return-type "GstCaps*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "string") - ) -) - - - -;; From ../gstreamer/gst/gstclock.h - -(define-function clock_get_type - (c-name "gst_clock_get_type") - (return-type "GType") -) - -(define-method set_resolution - (of-object "GstClock") - (c-name "gst_clock_set_resolution") - (return-type "GstClockTime") - (parameters - '("GstClockTime" "resolution") - ) -) - -(define-method get_resolution - (of-object "GstClock") - (c-name "gst_clock_get_resolution") - (return-type "GstClockTime") -) - -(define-method get_time - (of-object "GstClock") - (c-name "gst_clock_get_time") - (return-type "GstClockTime") -) - -(define-method set_calibration - (of-object "GstClock") - (c-name "gst_clock_set_calibration") - (return-type "none") - (parameters - '("GstClockTime" "internal") - '("GstClockTime" "external") - '("GstClockTime" "rate_num") - '("GstClockTime" "rate_denom") - ) -) - -(define-method get_calibration - (of-object "GstClock") - (c-name "gst_clock_get_calibration") - (return-type "none") - (parameters - '("GstClockTime*" "internal") - '("GstClockTime*" "external") - '("GstClockTime*" "rate_num") - '("GstClockTime*" "rate_denom") - ) -) - -(define-method set_master - (of-object "GstClock") - (c-name "gst_clock_set_master") - (return-type "gboolean") - (parameters - '("GstClock*" "master") - ) -) - -(define-method get_master - (of-object "GstClock") - (c-name "gst_clock_get_master") - (return-type "GstClock*") -) - -(define-method add_observation - (of-object "GstClock") - (c-name "gst_clock_add_observation") - (return-type "gboolean") - (parameters - '("GstClockTime" "slave") - '("GstClockTime" "master") - '("gdouble*" "r_squared") - ) -) - -(define-method get_internal_time - (of-object "GstClock") - (c-name "gst_clock_get_internal_time") - (return-type "GstClockTime") -) - -(define-method adjust_unlocked - (of-object "GstClock") - (c-name "gst_clock_adjust_unlocked") - (return-type "GstClockTime") - (parameters - '("GstClockTime" "internal") - ) -) - -(define-method unadjust_unlocked - (of-object "GstClock") - (c-name "gst_clock_unadjust_unlocked") - (return-type "GstClockTime") - (parameters - '("GstClockTime" "external") - ) -) - -(define-method new_single_shot_id - (of-object "GstClock") - (c-name "gst_clock_new_single_shot_id") - (return-type "GstClockID") - (parameters - '("GstClockTime" "time") - ) -) - -(define-method new_periodic_id - (of-object "GstClock") - (c-name "gst_clock_new_periodic_id") - (return-type "GstClockID") - (parameters - '("GstClockTime" "start_time") - '("GstClockTime" "interval") - ) -) - -(define-method ref - (of-object "GstClockID") - (c-name "gst_clock_id_ref") - (return-type "GstClockID") -) - -(define-method unref - (of-object "GstClockID") - (c-name "gst_clock_id_unref") - (return-type "none") -) - -(define-function clock_id_compare_func - (c-name "gst_clock_id_compare_func") - (return-type "gint") - (parameters - '("gconstpointer" "id1") - '("gconstpointer" "id2") - ) -) - -(define-method get_time - (of-object "GstClockID") - (c-name "gst_clock_id_get_time") - (return-type "GstClockTime") -) - -(define-method wait - (of-object "GstClockID") - (c-name "gst_clock_id_wait") - (return-type "GstClockReturn") - (parameters - '("GstClockTimeDiff*" "jitter") - ) -) - -(define-method wait_async - (of-object "GstClockID") - (c-name "gst_clock_id_wait_async") - (return-type "GstClockReturn") - (parameters - '("GstClockCallback" "func") - '("gpointer" "user_data") - ) -) - -(define-method unschedule - (of-object "GstClockID") - (c-name "gst_clock_id_unschedule") - (return-type "none") -) - -(define-method single_shot_id_reinit - (of-object "GstClock") - (c-name "gst_clock_single_shot_id_reinit") - (return-type "gboolean") - (parameters - '("GstClockID" "id") - '("GstClockTime" "time") - ) -) - -(define-virtual change_resolution - (of-object "GstClock") - (return-type "GstClockTime") - (parameters - '("GstClockTime" "old_resolution") - '("GstClockTime" "new_resolution") - ) -) - -(define-virtual get_resolution - (of-object "GstClock") - (return-type "GstClockTime") -) - -(define-virtual get_internal_time - (of-object "GstClock") - (return-type "GstClockTime") -) - -(define-virtual wait - (of-object "GstClock") - (return-type "GstClockReturn") - (parameters - '("GstClockEntry*" "entry") - ) -) - -(define-virtual wait_jitter - (of-object "GstClock") - (return-type "GstClockReturn") - (parameters - '("GstClockEntry*" "entry") - '("GstClockTimeDiff*" "jitter") - ) -) - -(define-virtual wait_async - (of-object "GstClock") - (return-type "GstClockReturn") - (parameters - '("GstClockEntry*" "entry") - ) -) - -(define-virtual unschedule - (of-object "GstClock") - (return-type "none") - (parameters - '("GstClockEntry" "entry") - ) -) - -;; From gstdatetime.h - -(define-method get_year - (of-object "GstDateTime") - (c-name "gst_date_time_get_year") - (return-type "gint") -) - -(define-method get_month - (of-object "GstDateTime") - (c-name "gst_date_time_get_month") - (return-type "gint") -) - -(define-method get_day - (of-object "GstDateTime") - (c-name "gst_date_time_get_day") - (return-type "gint") -) - -(define-method get_hour - (of-object "GstDateTime") - (c-name "gst_date_time_get_hour") - (return-type "gint") -) - -(define-method get_minute - (of-object "GstDateTime") - (c-name "gst_date_time_get_minute") - (return-type "gint") -) - -(define-method get_second - (of-object "GstDateTime") - (c-name "gst_date_time_get_second") - (return-type "gint") -) - -(define-method get_microsecond - (of-object "GstDateTime") - (c-name "gst_date_time_get_microsecond") - (return-type "gint") -) - -(define-method get_time_zone_offset - (of-object "GstDateTime") - (c-name "gst_date_time_get_time_zone_offset") - (return-type "gfloat") -) - -(define-function date_time_new_from_unix_epoch_local_time - (c-name "gst_date_time_new_from_unix_epoch_local_time") - (return-type "GstDateTime*") - (caller-owns-return #t) - (parameters - '("gint64" "secs") - ) -) - -(define-function date_time_new_from_unix_epoch_utc - (c-name "gst_date_time_new_from_unix_epoch_utc") - (return-type "GstDateTime*") - (caller-owns-return #t) - (parameters - '("gint64" "secs") - ) -) - -(define-function date_time_new_local_time - (c-name "gst_date_time_new_local_time") - (return-type "GstDateTime*") - (caller-owns-return #t) - (parameters - '("gint" "year") - '("gint" "month") - '("gint" "day") - '("gint" "hour") - '("gint" "minute") - '("gdouble" "seconds") - ) -) - -(define-function date_time_new - (c-name "gst_date_time_new") - (is-constructor-of "GstDateTime") - (return-type "GstDateTime*") - (caller-owns-return #t) - (parameters - '("gfloat" "tzoffset") - '("gint" "year") - '("gint" "month") - '("gint" "day") - '("gint" "hour") - '("gint" "minute") - '("gdouble" "seconds") - ) -) - -(define-function date_time_new_now_local_time - (c-name "gst_date_time_new_now_local_time") - (return-type "GstDateTime*") - (caller-owns-return #t) -) - -(define-function date_time_new_now_utc - (c-name "gst_date_time_new_now_utc") - (return-type "GstDateTime*") - (caller-owns-return #t) -) - -(define-method ref - (of-object "GstDateTime") - (c-name "gst_date_time_ref") - (return-type "GstDateTime*") -) - -(define-method unref - (of-object "GstDateTime") - (c-name "gst_date_time_unref") - (return-type "none") -) - - - - -;; From ../gstreamer/gst/gstdebugutils.h - -(define-function DEBUG_BIN_TO_DOT_FILE - (c-name "GST_DEBUG_BIN_TO_DOT_FILE") - (return-type "none") - (parameters - '("GstBin*" "bin") - '("GstDebugGraphDetails" "details") - '("const-gchar*" "filename") - ) -) - -(define-function DEBUG_BIN_TO_DOT_FILE_WITH_TS - (c-name "GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS") - (return-type "none") - (parameters - '("GstBin*" "bin") - '("GstDebugGraphDetails" "details") - '("const-gchar*" "filename") - ) -) - -;; From ../gstreamer/gst/gstelement.h - -(define-method add_pad_template - (of-object "GstElementClass") - (c-name "gst_element_class_add_pad_template") - (return-type "none") - (parameters - '("GstPadTemplate*" "templ") - ) -) - -; 9 August 05 - changed to be a method on elements and not classes - wingo -(define-method get_pad_template - (of-object "GstElement") - (c-name "gst_element_get_pad_template") - (return-type "GstPadTemplate*") - (parameters - '("const-gchar*" "name") - ) -) - -; 14 Jun 06 - Changed to be a method on elements and not classes - bilboed -(define-method get_pad_template_list - (of-object "GstElement") - (c-name "gst_element_get_pad_template_list") - (return-type "GList*") -) - -(define-method set_documentation_uri - (of-object "GstElementClass") - (c-name "gst_element_class_set_documentation_uri") - (return-type "none") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-method set_icon_name - (of-object "GstElementClass") - (c-name "gst_element_class_set_icon_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method set_details - (of-object "GstElementClass") - (c-name "gst_element_class_set_details") - (return-type "none") - (parameters - '("const-GstElementDetails*" "details") - ) -) - -(define-method set_details_simple - (of-object "GstElementClass") - (c-name "gst_element_class_set_details_simple") - (return-type "none") - (parameters - '("const-gchar*" "longname") - '("const-gchar*" "classification") - '("const-gchar*" "description") - '("const-gchar*" "author") - ) -) - -(define-function element_get_type - (c-name "gst_element_get_type") - (return-type "GType") -) - -(define-method requires_clock - (of-object "GstElement") - (c-name "gst_element_requires_clock") - (return-type "gboolean") -) - -(define-method provides_clock - (of-object "GstElement") - (c-name "gst_element_provides_clock") - (return-type "gboolean") -) - -(define-method provide_clock - (of-object "GstElement") - (c-name "gst_element_provide_clock") - (return-type "GstClock*") - (caller-owns-return #t) -) - -(define-method set_clock - (of-object "GstElement") - (c-name "gst_element_set_clock") - (return-type "gboolean") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method set_base_time - (of-object "GstElement") - (c-name "gst_element_set_base_time") - (return-type "none") - (parameters - '("GstClockTime" "time") - ) -) - -(define-method get_base_time - (of-object "GstElement") - (c-name "gst_element_get_base_time") - (return-type "GstClockTime") -) - -(define-method set_start_time - (of-object "GstElement") - (c-name "gst_element_set_start_time") - (return-type "none") - (parameters - '("GstClockTime" "time") - ) -) - -(define-method get_start_time - (of-object "GstElement") - (c-name "gst_element_get_start_time") - (return-type "GstClockTime") -) - -(define-method is_indexable - (of-object "GstElement") - (c-name "gst_element_is_indexable") - (return-type "gboolean") -) - -(define-method set_index - (of-object "GstElement") - (c-name "gst_element_set_index") - (return-type "none") - (parameters - '("GstIndex*" "index") - ) -) - -(define-method get_index - (of-object "GstElement") - (c-name "gst_element_get_index") - (return-type "GstIndex*") - (caller-owns-return #t) -) - -(define-method set_bus - (of-object "GstElement") - (c-name "gst_element_set_bus") - (return-type "none") - (parameters - '("GstBus*" "bus") - ) -) - -(define-method get_bus - (of-object "GstElement") - (c-name "gst_element_get_bus") - (return-type "GstBus*") - (caller-owns-return #t) -) - -(define-method get_clock - (of-object "GstElement") - (c-name "gst_element_get_clock") - (return-type "GstClock*") - (caller-owns-return #t) -) - -(define-method add_pad - (of-object "GstElement") - (c-name "gst_element_add_pad") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - ) -) - -(define-method remove_pad - (of-object "GstElement") - (c-name "gst_element_remove_pad") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - ) -) - -(define-method no_more_pads - (of-object "GstElement") - (c-name "gst_element_no_more_pads") - (return-type "none") -) - -(define-method get_pad - (of-object "GstElement") - (c-name "gst_element_get_pad") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_static_pad - (of-object "GstElement") - (c-name "gst_element_get_static_pad") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_request_pad - (of-object "GstElement") - (c-name "gst_element_get_request_pad") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method request_pad - (of-object "GstElement") - (c-name "gst_element_request_pad") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("GstPadTemplate*" "templ") - '("const-gchar*" "name") - '("const-GstCaps*" "caps") - ) -) - -(define-method release_request_pad - (of-object "GstElement") - (c-name "gst_element_release_request_pad") - (return-type "none") - (parameters - '("GstPad*" "pad") - ) -) - -(define-method pads - (of-object "GstElement") - (c-name "gst_element_iterate_pads") - (return-type "GstIterator*") -) - -(define-method src_pads - (of-object "GstElement") - (c-name "gst_element_iterate_src_pads") - (return-type "GstIterator*") -) - -(define-method sink_pads - (of-object "GstElement") - (c-name "gst_element_iterate_sink_pads") - (return-type "GstIterator*") -) - -(define-method send_event - (of-object "GstElement") - (c-name "gst_element_send_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event" (keep-refcount)) - ) -) - -(define-method seek - (of-object "GstElement") - (c-name "gst_element_seek") - (return-type "gboolean") - (parameters - '("gdouble" "rate") - '("GstFormat" "format") - '("GstSeekFlags" "flags") - '("GstSeekType" "cur_type") - '("gint64" "cur") - '("GstSeekType" "stop_type") - '("gint64" "stop") - ) -) - -(define-method get_query_types - (of-object "GstElement") - (c-name "gst_element_get_query_types") - (return-type "const-GstQueryType*") -) - -(define-method query - (of-object "GstElement") - (c-name "gst_element_query") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-method post_message - (of-object "GstElement") - (c-name "gst_element_post_message") - (return-type "gboolean") - (parameters - '("GstMessage*" "message" (keep-refcount)) - ) -) - -(define-method message_full - (of-object "GstElement") - (c-name "gst_element_message_full") - (return-type "none") - (parameters - '("GstMessageType" "type") - '("GQuark" "domain") - '("gint" "code") - '("gchar*" "text") - '("gchar*" "debug") - '("const-gchar*" "file") - '("const-gchar*" "function") - '("gint" "line") - ) -) - -(define-method is_locked_state - (of-object "GstElement") - (c-name "gst_element_is_locked_state") - (return-type "gboolean") -) - -(define-method set_locked_state - (of-object "GstElement") - (c-name "gst_element_set_locked_state") - (return-type "gboolean") - (parameters - '("gboolean" "locked_state") - ) -) - -(define-method sync_state_with_parent - (of-object "GstElement") - (c-name "gst_element_sync_state_with_parent") - (return-type "gboolean") -) - -(define-method get_state - (of-object "GstElement") - (c-name "gst_element_get_state") - (return-type "GstStateChangeReturn") - (parameters - '("GstState*" "state") - '("GstState*" "pending") - '("GstClockTime" "timeout") - ) -) - -(define-method set_state - (of-object "GstElement") - (c-name "gst_element_set_state") - (return-type "GstStateChangeReturn") - (parameters - '("GstState" "state") - ) -) - -(define-method abort_state - (of-object "GstElement") - (c-name "gst_element_abort_state") - (return-type "none") -) - -(define-method change_state - (of-object "GstElement") - (c-name "gst_element_change_state") - (return-type "GstStateChangeReturn") - (parameters - '("GstStateChange" "transition") - ) -) - -(define-method continue_state - (of-object "GstElement") - (c-name "gst_element_continue_state") - (return-type "GstStateChangeReturn") - (parameters - '("GstStateChangeReturn" "retstate") - ) -) - -(define-method lost_state - (of-object "GstElement") - (c-name "gst_element_lost_state") - (return-type "none") -) - -(define-method lost_state_full - (of-object "GstElement") - (c-name "gst_element_lost_state_full") - (return-type "none") - (parameters - '("gboolean" "new_base_time") - ) -) - -(define-method get_factory - (of-object "GstElement") - (c-name "gst_element_get_factory") - (return-type "GstElementFactory*") -) - -(define-virtual send_event - (of-object "GstElement") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -(define-virtual get_query_types - (of-object "GstElement") - (return-type "const-GstQueryType*") -) - -(define-virtual query - (of-object "GstElement") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-virtual get_state - (of-object "GstElement") - (return-type "GstStateChangeReturn") - (parameters - '("GstState*" "state") - '("GstState*" "pending") - '("GTimeVal*" "timeout") - ) -) - -(define-virtual change_state - (of-object "GstElement") - (return-type "GstStateChangeReturn") - (parameters - '("GstStateChange" "transition") - ) -) - -(define-virtual request_new_pad - (of-object "GstElement") - (return-type "GstPad*") - (parameters - '("GstPadTemplate*" "templ") - '("const-gchar*" "name") - ) -) - -(define-virtual release_pad - (of-object "GstElement") - (return-type "none") - (parameters - '("GstPad*" "pad") - ) -) - -(define-virtual provide_clock - (of-object "GstElement") - (return-type "GstClock*") -) - -(define-virtual set_clock - (of-object "GstElement") - (return-type "gboolean") - (parameters - '("GstClock*" "clock") - ) -) - -(define-virtual get_index - (of-object "GstElement") - (return-type "GstIndex*") -) - -(define-virtual set_index - (of-object "GstElement") - (return-type "none") - (parameters - '("GstIndex*" "index") - ) -) - -(define-virtual set_bus - (of-object "GstElement") - (return-type "none") - (parameters - '("GstBus*" "bus") - ) -) - -;; From ../gstreamer/gst/gstelementfactory.h - -(define-function element_factory_get_type - (c-name "gst_element_factory_get_type") - (return-type "GType") -) - -(define-function element_factory_find - (c-name "gst_element_factory_find") - (return-type "GstElementFactory*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_element_type - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_element_type") - (return-type "GType") -) - -(define-method get_longname - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_longname") - (return-type "const-gchar*") -) - -(define-method get_klass - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_klass") - (return-type "const-gchar*") -) - -(define-method get_description - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_description") - (return-type "const-gchar*") -) - -(define-method get_author - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_author") - (return-type "const-gchar*") -) - -(define-method get_documentation_uri - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_documentation_uri") - (return-type "const-gchar*") -) - -(define-method get_icon_name - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_icon_name") - (return-type "const-gchar*") -) - -(define-method get_num_pad_templates - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_num_pad_templates") - (return-type "guint") -) - -(define-method get_static_pad_templates - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_static_pad_templates") - (return-type "const-GList*") -) - -(define-method get_uri_type - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_uri_type") - (return-type "GstURIType") -) - -(define-method get_uri_protocols - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_uri_protocols") - (return-type "GStrv") -) - -(define-method has_interface - (of-object "GstElementFactory") - (c-name "gst_element_factory_has_interface") - (return-type "gboolean") - (parameters - '("const-gchar*" "interfacename") - ) -) - -(define-method create - (of-object "GstElementFactory") - (c-name "gst_element_factory_create") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) - ) -) - -(define-function element_factory_make - (c-name "gst_element_factory_make") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "factoryname") - '("const-gchar*" "name" (null-ok) (default "NULL")) - ) -) - -(define-function element_register - (c-name "gst_element_register") - (return-type "gboolean") - (parameters - '("GstPlugin*" "plugin") - '("const-gchar*" "name") - '("guint" "rank") - '("GType" "type") - ) -) -(define-method list_is_type - (of-object "GstElementFactory") - (c-name "gst_element_factory_list_is_type") - (return-type "gboolean") - (parameters - '("GstElementFactoryListType" "type") - ) -) - -(define-function element_factory_list_get_elements - (c-name "gst_element_factory_list_get_elements") - (return-type "GList*") - (parameters - '("GstElementFactoryListType" "type") - '("GstRank" "minrank") - ) -) - -(define-function element_factory_list_filter - (c-name "gst_element_factory_list_filter") - (return-type "GList*") - (parameters - '("GList*" "list") - '("const-GstCaps*" "caps") - '("GstPadDirection" "direction") - '("gboolean" "subsetonly") - ) -) - -;; From ../gstreamer/gst/gstenumtypes.h - -(define-function object_flags_get_type - (c-name "gst_object_flags_get_type") - (return-type "GType") -) - -(define-function bin_flags_get_type - (c-name "gst_bin_flags_get_type") - (return-type "GType") -) - -(define-function buffer_flag_get_type - (c-name "gst_buffer_flag_get_type") - (return-type "GType") -) - -(define-function gst_buffer_copy_flags_get_type - (c-name "gst_buffer_copy_flags_get_type") - (return-type "GType") -) - -(define-function bus_flags_get_type - (c-name "gst_bus_flags_get_type") - (return-type "GType") -) - -(define-function bus_sync_reply_get_type - (c-name "gst_bus_sync_reply_get_type") - (return-type "GType") -) - -(define-function clock_return_get_type - (c-name "gst_clock_return_get_type") - (return-type "GType") -) - -(define-function clock_entry_type_get_type - (c-name "gst_clock_entry_type_get_type") - (return-type "GType") -) - -(define-function clock_flags_get_type - (c-name "gst_clock_flags_get_type") - (return-type "GType") -) - -(define-function element_flags_get_type - (c-name "gst_element_flags_get_type") - (return-type "GType") -) - -(define-function core_error_get_type - (c-name "gst_core_error_get_type") - (return-type "GType") -) - -(define-function library_error_get_type - (c-name "gst_library_error_get_type") - (return-type "GType") -) - -(define-function resource_error_get_type - (c-name "gst_resource_error_get_type") - (return-type "GType") -) - -(define-function stream_error_get_type - (c-name "gst_stream_error_get_type") - (return-type "GType") -) - -(define-function gst_event_type_flags_get_type - (c-name "gst_event_type_flags_get_type") - (return-type "GType") -) - -(define-function event_type_get_type - (c-name "gst_event_type_get_type") - (return-type "GType") -) - -(define-function seek_type_get_type - (c-name "gst_seek_type_get_type") - (return-type "GType") -) - -(define-function seek_flags_get_type - (c-name "gst_seek_flags_get_type") - (return-type "GType") -) - -(define-function format_get_type - (c-name "gst_format_get_type") - (return-type "GType") -) - -(define-function index_certainty_get_type - (c-name "gst_index_certainty_get_type") - (return-type "GType") -) - -(define-function index_entry_type_get_type - (c-name "gst_index_entry_type_get_type") - (return-type "GType") -) - -(define-function index_lookup_method_get_type - (c-name "gst_index_lookup_method_get_type") - (return-type "GType") -) - -(define-function assoc_flags_get_type - (c-name "gst_assoc_flags_get_type") - (return-type "GType") -) - -(define-function index_resolver_method_get_type - (c-name "gst_index_resolver_method_get_type") - (return-type "GType") -) - -(define-function index_flags_get_type - (c-name "gst_index_flags_get_type") - (return-type "GType") -) - -(define-function debug_level_get_type - (c-name "gst_debug_level_get_type") - (return-type "GType") -) - -(define-function debug_color_flags_get_type - (c-name "gst_debug_color_flags_get_type") - (return-type "GType") -) - -(define-function iterator_result_get_type - (c-name "gst_iterator_result_get_type") - (return-type "GType") -) - -(define-function iterator_item_get_type - (c-name "gst_iterator_item_get_type") - (return-type "GType") -) - -(define-function message_type_get_type - (c-name "gst_message_type_get_type") - (return-type "GType") -) - -(define-function mini_object_flags_get_type - (c-name "gst_mini_object_flags_get_type") - (return-type "GType") -) - -(define-function pad_link_return_get_type - (c-name "gst_pad_link_return_get_type") - (return-type "GType") -) - -(define-function flow_return_get_type - (c-name "gst_flow_return_get_type") - (return-type "GType") -) - -(define-function activate_mode_get_type - (c-name "gst_activate_mode_get_type") - (return-type "GType") -) - -(define-function pad_direction_get_type - (c-name "gst_pad_direction_get_type") - (return-type "GType") -) - -(define-function pad_flags_get_type - (c-name "gst_pad_flags_get_type") - (return-type "GType") -) - -(define-function pad_presence_get_type - (c-name "gst_pad_presence_get_type") - (return-type "GType") -) - -(define-function pad_template_flags_get_type - (c-name "gst_pad_template_flags_get_type") - (return-type "GType") -) - -(define-function pipeline_flags_get_type - (c-name "gst_pipeline_flags_get_type") - (return-type "GType") -) - -(define-function plugin_error_get_type - (c-name "gst_plugin_error_get_type") - (return-type "GType") -) - -(define-function query_type_get_type - (c-name "gst_query_type_get_type") - (return-type "GType") -) - -(define-function tag_merge_mode_get_type - (c-name "gst_tag_merge_mode_get_type") - (return-type "GType") -) - -(define-function tag_flag_get_type - (c-name "gst_tag_flag_get_type") - (return-type "GType") -) - -(define-function task_state_get_type - (c-name "gst_task_state_get_type") - (return-type "GType") -) - -(define-function alloc_trace_flags_get_type - (c-name "gst_alloc_trace_flags_get_type") - (return-type "GType") -) - -(define-function type_find_probability_get_type - (c-name "gst_type_find_probability_get_type") - (return-type "GType") -) - -(define-function element_state_get_type - (c-name "gst_element_state_get_type") - (return-type "GType") -) - -(define-function element_state_return_get_type - (c-name "gst_element_state_return_get_type") - (return-type "GType") -) - -(define-function rank_get_type - (c-name "gst_rank_get_type") - (return-type "GType") -) - -(define-function uri_type_get_type - (c-name "gst_uri_type_get_type") - (return-type "GType") -) - -(define-function parse_error_get_type - (c-name "gst_parse_error_get_type") - (return-type "GType") -) - - - -;; From ../gstreamer/gst/gsterror.h - -(define-function g_error_get_type - (c-name "gst_g_error_get_type") - (return-type "GType") -) - -(define-function error_get_message - (c-name "gst_error_get_message") - (return-type "gchar*") - (parameters - '("GQuark" "domain") - '("gint" "code") - ) -) - -(define-function stream_error_quark - (c-name "gst_stream_error_quark") - (return-type "GQuark") -) - -(define-function core_error_quark - (c-name "gst_core_error_quark") - (return-type "GQuark") -) - -(define-function resource_error_quark - (c-name "gst_resource_error_quark") - (return-type "GQuark") -) - -(define-function library_error_quark - (c-name "gst_library_error_quark") - (return-type "GQuark") -) - -(define-function new - (c-name "g_error_new") - (is-constructor-of "GError") - (return-type "GError*") - (parameters - '("gchar*" "domain") - '("gint" "code") - '("gchar*" "message") - ) -) - -;; From ../gstreamer/gst/gstevent.h - -(define-method get_name - (of-object "GstEventType") - (c-name "gst_event_type_get_name") - (return-type "const-gchar*") -) - -(define-method to_quark - (of-object "GstEventType") - (c-name "gst_event_type_to_quark") - (return-type "GQuark") -) - -(define-method get_flags - (of-object "GstEventType") - (c-name "gst_event_type_get_flags") - (return-type "GstEventTypeFlags") -) - -(define-function event_get_type - (c-name "gst_event_get_type") - (return-type "GType") -) - -(define-function event_new_custom - (c-name "gst_event_new_custom") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstEventType" "type") - '("GstStructure*" "structure") - ) -) - -(define-method get_structure - (of-object "GstEvent") - (c-name "gst_event_get_structure") - (return-type "const-GstStructure*") -) - -(define-method has_name - (of-object "GstEvent") - (c-name "gst_event_has_name") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_seqnum - (of-object "GstEvent") - (c-name "gst_event_get_seqnum") - (return-type "guint32") -) - -(define-method set_seqnum - (of-object "GstEvent") - (c-name "gst_event_set_seqnum") - (return-type "none") - (parameters - '("guint32" "seqnum") - ) -) - -(define-function event_new_flush_start - (c-name "gst_event_new_flush_start") - (return-type "GstEvent*") - (caller-owns-return #t) -) - -(define-function event_new_flush_stop - (c-name "gst_event_new_flush_stop") - (return-type "GstEvent*") - (caller-owns-return #t) -) - -(define-function event_new_eos - (c-name "gst_event_new_eos") - (return-type "GstEvent*") - (caller-owns-return #t) -) - -(define-function event_new_new_segment - (c-name "gst_event_new_new_segment") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("gboolean" "update") - '("gdouble" "rate") - '("GstFormat" "format") - '("gint64" "start_value") - '("gint64" "stop_value") - '("gint64" "stream_time") - ) -) - -(define-function event_new_new_segment_full - (c-name "gst_event_new_new_segment_full") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("gboolean" "update") - '("gdouble" "rate") - '("gdouble" "applied_rate") - '("GstFormat" "format") - '("gint64" "start") - '("gint64" "stop") - '("gint64" "position") - ) -) - -(define-method parse_new_segment - (of-object "GstEvent") - (c-name "gst_event_parse_new_segment") - (return-type "none") - (parameters - '("gboolean*" "update") - '("gdouble*" "rate") - '("GstFormat*" "format") - '("gint64*" "start_value") - '("gint64*" "end_value") - '("gint64*" "stream_time") - ) -) - -(define-function event_new_tag - (c-name "gst_event_new_tag") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstTagList*" "taglist") - ) -) - -(define-method parse_new_segment_full - (of-object "GstEvent") - (c-name "gst_event_parse_new_segment_full") - (return-type "none") - (parameters - '("gboolean*" "update") - '("gdouble*" "rate") - '("gdouble*" "applied_rate") - '("GstFormat*" "format") - '("gint64*" "start") - '("gint64*" "stop") - '("gint64*" "position") - ) -) - -(define-method parse_tag - (of-object "GstEvent") - (c-name "gst_event_parse_tag") - (return-type "none") - (parameters - '("GstTagList**" "taglist") - ) -) - -(define-function event_new_buffer_size - (c-name "gst_event_new_buffer_size") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - '("gint64" "minsize") - '("gint64" "maxsize") - '("gboolean" "async") - ) -) - -(define-method parse_buffer_size - (of-object "GstEvent") - (c-name "gst_event_parse_buffer_size") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "minsize") - '("gint64*" "maxsize") - '("gboolean*" "async") - ) -) - -(define-function event_new_qos - (c-name "gst_event_new_qos") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("gdouble" "proportion") - '("GstClockTimeDiff" "diff") - '("GstClockTime" "timestamp") - ) -) - -(define-method parse_qos - (of-object "GstEvent") - (c-name "gst_event_parse_qos") - (return-type "none") - (parameters - '("gdouble*" "proportion") - '("GstClockTimeDiff*" "diff") - '("GstClockTime*" "timestamp") - ) -) - -(define-function event_new_seek - (c-name "gst_event_new_seek") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("gdouble" "rate") - '("GstFormat" "format") - '("GstSeekFlags" "flags") - '("GstSeekType" "start_type") - '("gint64" "start") - '("GstSeekType" "stop_type") - '("gint64" "stop") - ) -) - -(define-method parse_seek - (of-object "GstEvent") - (c-name "gst_event_parse_seek") - (return-type "none") - (parameters - '("gdouble*" "rate") - '("GstFormat*" "format") - '("GstSeekFlags*" "flags") - '("GstSeekType*" "start_type") - '("gint64*" "start") - '("GstSeekType*" "stop_type") - '("gint64*" "stop") - ) -) - -(define-function event_new_navigation - (c-name "gst_event_new_navigation") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstStructure*" "structure") - ) -) - - -(define-function event_new_latency - (c-name "gst_event_new_latency") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstClockTime" "latency") - ) -) - -(define-method parse_latency - (of-object "GstEvent") - (c-name "gst_event_parse_latency") - (return-type "none") - (parameters - '("GstClockTime*" "latency") - ) -) - -(define-function event_new_step - (c-name "gst_event_new_step") - (return-type "GstEvent*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - '("guint64" "amount") - '("gdouble" "rate") - '("gboolean" "flush") - '("gboolean" "intermediate") - ) -) - -(define-method parse_step - (of-object "GstEvent") - (c-name "gst_event_parse_step") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("guint64*" "amount") - '("gdouble*" "rate") - '("gboolean*" "flush") - '("gboolean*" "intermediate") - ) -) - -;; From ../gstreamer/gst/gstfilter.h - -(define-function filter_run - (c-name "gst_filter_run") - (return-type "GList*") - (parameters - '("const-GList*" "list") - '("GstFilterFunc" "func") - '("gboolean" "first") - '("gpointer" "user_data") - ) -) - - - -;; From ../gstreamer/gst/gstformat.h - -(define-method get_name - (of-object "GstFormat") - (c-name "gst_format_get_name") - (return-type "const-gchar*") -) - -(define-method to_quark - (of-object "GstFormat") - (c-name "gst_format_to_quark") - (return-type "GQuark") -) - -(define-function format_register - (c-name "gst_format_register") - (return-type "GstFormat") - (parameters - '("const-gchar*" "nick") - '("const-gchar*" "description") - ) -) - -(define-function format_get_by_nick - (c-name "gst_format_get_by_nick") - (return-type "GstFormat") - (parameters - '("const-gchar*" "nick") - ) -) - -(define-method s_contains - (of-object "GstFormat") - (c-name "gst_formats_contains") - (return-type "gboolean") - (parameters - '("GstFormat" "format") - ) -) - -(define-method get_details - (of-object "GstFormat") - (c-name "gst_format_get_details") - (return-type "const-GstFormatDefinition*") -) - -(define-function format_iterate_definitions - (c-name "gst_format_iterate_definitions") - (return-type "GstIterator*") -) - - - -;; From ../gstreamer/gst/gstghostpad.h - -(define-function ghost_pad_get_type - (c-name "gst_ghost_pad_get_type") - (return-type "GType") -) - -(define-function ghost_pad_new - (c-name "gst_ghost_pad_new") - (is-constructor-of "GstGhostPad") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - '("GstPad*" "target") - ) -) - -(define-function ghost_pad_new_notarget - (c-name "gst_ghost_pad_new_no_target") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - '("GstPadDirection" "dir") - ) -) - -(define-function ghost_pad_new_from_template - (c-name "gst_ghost_pad_new_from_template") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - '("GstPad*" "target") - '("GstPadTemplate*" "templ") - ) -) - -(define-function ghost_pad_new_no_target_from_template - (c-name "gst_ghost_pad_new_no_target_from_template") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - '("GstPadTemplate*" "templ") - ) -) - -(define-method get_target - (of-object "GstGhostPad") - (c-name "gst_ghost_pad_get_target") - (caller-owns-return #t) - (return-type "GstPad*") -) - -(define-method set_target - (of-object "GstGhostPad") - (c-name "gst_ghost_pad_set_target") - (return-type "gboolean") - (parameters - '("GstPad*" "newtarget" (null-ok)) - ) -) - - - -;; From ../gstreamer/gst/gstindex.h - -(define-function index_get_type - (c-name "gst_index_get_type") - (return-type "GType") -) - -(define-function index_new - (c-name "gst_index_new") - (is-constructor-of "GstIndex") - (return-type "GstIndex*") -) - -(define-method commit - (of-object "GstIndex") - (c-name "gst_index_commit") - (return-type "none") - (parameters - '("gint" "id") - ) -) - -(define-method get_group - (of-object "GstIndex") - (c-name "gst_index_get_group") - (return-type "gint") -) - -(define-method new_group - (of-object "GstIndex") - (c-name "gst_index_new_group") - (return-type "gint") -) - -(define-method set_group - (of-object "GstIndex") - (c-name "gst_index_set_group") - (return-type "gboolean") - (parameters - '("gint" "groupnum") - ) -) - -(define-method set_certainty - (of-object "GstIndex") - (c-name "gst_index_set_certainty") - (return-type "none") - (parameters - '("GstIndexCertainty" "certainty") - ) -) - -(define-method get_certainty - (of-object "GstIndex") - (c-name "gst_index_get_certainty") - (return-type "GstIndexCertainty") -) - -(define-method set_filter - (of-object "GstIndex") - (c-name "gst_index_set_filter") - (return-type "none") - (parameters - '("GstIndexFilter" "filter") - '("gpointer" "user_data") - ) -) - -(define-method set_filter_full - (of-object "GstIndex") - (c-name "gst_index_set_filter_full") - (return-type "none") - (parameters - '("GstIndexFilter" "filter") - '("gpointer" "user_data") - '("GDestroyNotify" "user_data_destroy") - ) -) - -(define-method set_resolver - (of-object "GstIndex") - (c-name "gst_index_set_resolver") - (return-type "none") - (parameters - '("GstIndexResolver" "resolver") - '("gpointer" "user_data") - ) -) - -(define-method set_resolver_full - (of-object "GstIndex") - (c-name "gst_index_set_resolver_full") - (return-type "none") - (parameters - '("GstIndexResolver" "resolver") - '("gpointer" "user_data") - '("GDestroyNotify" "user_data_destroy") - ) -) - -(define-method get_writer_id - (of-object "GstIndex") - (c-name "gst_index_get_writer_id") - (return-type "gboolean") - (parameters - '("GstObject*" "writer") - '("gint*" "id") - ) -) - -(define-method add_format - (of-object "GstIndex") - (c-name "gst_index_add_format") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstFormat" "format") - ) -) - -(define-method add_associationv - (of-object "GstIndex") - (c-name "gst_index_add_associationv") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstAssocFlags" "flags") - '("gint" "n") - '("const-GstIndexAssociation*" "list") - ) -) - -(define-method add_association - (of-object "GstIndex") - (c-name "gst_index_add_association") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstAssocFlags" "flags") - '("GstFormat" "format") - '("gint64" "value") - ) - (varargs #t) -) - -(define-method add_object - (of-object "GstIndex") - (c-name "gst_index_add_object") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("gchar*" "key") - '("GType" "type") - '("gpointer" "object") - ) -) - -(define-method add_id - (of-object "GstIndex") - (c-name "gst_index_add_id") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("gchar*" "description") - ) -) - -(define-method get_assoc_entry - (of-object "GstIndex") - (c-name "gst_index_get_assoc_entry") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstIndexLookupMethod" "method") - '("GstAssocFlags" "flags") - '("GstFormat" "format") - '("gint64" "value") - ) -) - -(define-method get_assoc_entry_full - (of-object "GstIndex") - (c-name "gst_index_get_assoc_entry_full") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstIndexLookupMethod" "method") - '("GstAssocFlags" "flags") - '("GstFormat" "format") - '("gint64" "value") - '("GCompareDataFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-virtual add_entry - (of-object "GstIndex") - (return-type "none") - (parameters - '("GstIndexEntry*" "entry") - ) -) - -(define-virtual get_assoc_entry - (of-object "GstIndex") - (return-type "GstIndexEntry*") - (parameters - '("gint" "id") - '("GstIndexLookupMethod" "method") - '("GstAssocFlags" "flags") - '("GstFormat" "format") - '("gint64" "value") - '("GCompareDataFunc" "func") - '("gpointer" "user_data") - ) -) - - -(define-function index_entry_get_type - (c-name "gst_index_entry_get_type") - (return-type "GType") -) - -(define-method copy - (of-object "GstIndexEntry") - (c-name "gst_index_entry_copy") - (caller-owns-return #t) - (return-type "GstIndexEntry*") -) - -(define-method free - (of-object "GstIndexEntry") - (c-name "gst_index_entry_free") - (return-type "none") -) - -(define-method assoc_map - (of-object "GstIndexEntry") - (c-name "gst_index_entry_assoc_map") - (return-type "gboolean") - (parameters - '("GstFormat" "format") - '("gint64*" "value") - ) -) - -(define-method ASSOC_FORMAT - (of-object "GstIndexEntry") - (c-name "GST_INDEX_ASSOC_FORMAT") - (return-type "GstFormat") - (parameters - '("guint" "i") - ) -) - -(define-method ASSOC_VALUE - (of-object "GstIndexEntry") - (c-name "GST_INDEX_ASSOC_VALUE") - (return-type "gint64") - (parameters - '("guint" "i") - ) -) - -(define-function index_factory_get_type - (c-name "gst_index_factory_get_type") - (return-type "GType") -) - -(define-function index_factory_new - (c-name "gst_index_factory_new") - (is-constructor-of "GstIndexFactory") - (return-type "GstIndexFactory*") - (properties - '("name" (argname "name")) - '("longdesc" (argname "longdesc")) - '("type" (argname "type")) - ) -) - -(define-method destroy - (of-object "GstIndexFactory") - (c-name "gst_index_factory_destroy") - (return-type "none") -) - -(define-function index_factory_find - (c-name "gst_index_factory_find") - (return-type "GstIndexFactory*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method create - (of-object "GstIndexFactory") - (c-name "gst_index_factory_create") - (return-type "GstIndex*") - (caller-owns-return #t) -) - -(define-function index_factory_make - (c-name "gst_index_factory_make") - (return-type "GstIndex*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - - - -;; From ../gstreamer/gst/gstinfo.h - -(define-function debug_log - (c-name "gst_debug_log") - (return-type "none") - (parameters - '("GstDebugCategory*" "category") - '("GstDebugLevel" "level") - '("const-gchar*" "file") - '("const-gchar*" "function") - '("gint" "line") - '("GObject*" "object") - '("const-gchar*" "format") - ) - (varargs #t) -) - -(define-function debug_log_valist - (c-name "gst_debug_log_valist") - (return-type "none") - (parameters - '("GstDebugCategory*" "category") - '("GstDebugLevel" "level") - '("const-gchar*" "file") - '("const-gchar*" "function") - '("gint" "line") - '("GObject*" "object") - '("const-gchar*" "format") - '("va_list" "args") - ) -) - -(define-method get - (of-object "GstDebugMessage") - (c-name "gst_debug_message_get") - (return-type "const-gchar*") -) - -(define-function debug_log_default - (c-name "gst_debug_log_default") - (return-type "none") - (parameters - '("GstDebugCategory*" "category") - '("GstDebugLevel" "level") - '("const-gchar*" "file") - '("const-gchar*" "function") - '("gint" "line") - '("GObject*" "object") - '("GstDebugMessage*" "message") - '("gpointer" "unused") - ) -) - -(define-method get_name - (of-object "GstDebugLevel") - (c-name "gst_debug_level_get_name") - (return-type "const-gchar*") -) - -(define-function debug_add_log_function - (c-name "gst_debug_add_log_function") - (return-type "none") - (parameters - '("GstLogFunction" "func") - '("gpointer" "data") - ) -) - -(define-function debug_remove_log_function - (c-name "gst_debug_remove_log_function") - (return-type "guint") - (parameters - '("GstLogFunction" "func") - ) -) - -(define-function debug_remove_log_function_by_data - (c-name "gst_debug_remove_log_function_by_data") - (return-type "guint") - (parameters - '("gpointer" "data") - ) -) - -(define-function debug_set_active - (c-name "gst_debug_set_active") - (return-type "none") - (parameters - '("gboolean" "active") - ) -) - -(define-function debug_is_active - (c-name "gst_debug_is_active") - (return-type "gboolean") -) - -(define-function debug_set_colored - (c-name "gst_debug_set_colored") - (return-type "none") - (parameters - '("gboolean" "colored") - ) -) - -(define-function debug_is_colored - (c-name "gst_debug_is_colored") - (return-type "gboolean") -) - -(define-function debug_set_default_threshold - (c-name "gst_debug_set_default_threshold") - (return-type "none") - (parameters - '("GstDebugLevel" "level") - ) -) - -(define-function debug_get_default_threshold - (c-name "gst_debug_get_default_threshold") - (return-type "GstDebugLevel") -) - -(define-function debug_set_threshold_for_name - (c-name "gst_debug_set_threshold_for_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - '("GstDebugLevel" "level") - ) -) - -(define-function debug_unset_threshold_for_name - (c-name "gst_debug_unset_threshold_for_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method free - (of-object "GstDebugCategory") - (c-name "gst_debug_category_free") - (return-type "none") -) - -(define-method set_threshold - (of-object "GstDebugCategory") - (c-name "gst_debug_category_set_threshold") - (return-type "none") - (parameters - '("GstDebugLevel" "level") - ) -) - -(define-method reset_threshold - (of-object "GstDebugCategory") - (c-name "gst_debug_category_reset_threshold") - (return-type "none") -) - -(define-method get_threshold - (of-object "GstDebugCategory") - (c-name "gst_debug_category_get_threshold") - (return-type "GstDebugLevel") -) - -(define-method get_name - (of-object "GstDebugCategory") - (c-name "gst_debug_category_get_name") - (return-type "const-gchar*") -) - -(define-method get_color - (of-object "GstDebugCategory") - (c-name "gst_debug_category_get_color") - (return-type "guint") -) - -(define-method get_description - (of-object "GstDebugCategory") - (c-name "gst_debug_category_get_description") - (return-type "const-gchar*") -) - -(define-function debug_get_all_categories - (c-name "gst_debug_get_all_categories") - (return-type "GSList*") -) - -(define-function debug_construct_term_color - (c-name "gst_debug_construct_term_color") - (return-type "gchar*") - (parameters - '("guint" "colorinfo") - ) -) - -(define-function debug_construct_win_color - (c-name "gst_debug_construct_win_color") - (return-type "gint") - (parameters - '("guint" "colorinfo") - ) -) - -(define-function debug_remove_log_function - (c-name "gst_debug_remove_log_function") - (return-type "guint") - (parameters - '("GstLogFunction" "func") - ) -) - -(define-function debug_remove_log_function_by_data - (c-name "gst_debug_remove_log_function_by_data") - (return-type "guint") - (parameters - '("gpointer" "data") - ) -) - -;; From ../gstreamer/gst/gstinterface.h - -(define-function implements_interface_get_type - (c-name "gst_implements_interface_get_type") - (return-type "GType") -) - -(define-method implements_interface - (of-object "GstElement") - (c-name "gst_element_implements_interface") - (return-type "gboolean") - (parameters - '("GType" "iface_type") - ) -) - -(define-function implements_interface_cast - (c-name "gst_implements_interface_cast") - (return-type "gpointer") - (parameters - '("gpointer" "from") - '("GType" "type") - ) -) - -(define-function implements_interface_check - (c-name "gst_implements_interface_check") - (return-type "gboolean") - (parameters - '("gpointer" "from") - '("GType" "type") - ) -) - -(define-virtual supported - (of-object "GstImplementsInterface") - (return-type "gboolean") - (parameters - '("GType" "iface_type") - ) -) - -;; From ../gstreamer/gst/gstiterator.h - -(define-function iterator_new - (c-name "gst_iterator_new") - (is-constructor-of "GstIterator") - (return-type "GstIterator*") - (parameters - '("guint" "size") - '("GType" "type") - '("GMutex*" "lock") - '("guint32*" "master_cookie") - '("GstIteratorNextFunction" "next") - '("GstIteratorItemFunction" "item") - '("GstIteratorResyncFunction" "resync") - '("GstIteratorFreeFunction" "free") - ) -) - -(define-function iterator_new_list - (c-name "gst_iterator_new_list") - (return-type "GstIterator*") - (parameters - '("GType" "type") - '("GMutex*" "lock") - '("guint32*" "master_cookie") - '("GList**" "list") - '("gpointer" "owner") - '("GstIteratorItemFunction" "item") - '("GstIteratorDisposeFunction" "free") - ) -) - -(define-method next - (of-object "GstIterator") - (c-name "gst_iterator_next") - (return-type "GstIteratorResult") - (parameters - '("gpointer*" "result") - ) -) - -(define-method resync - (of-object "GstIterator") - (c-name "gst_iterator_resync") - (return-type "none") -) - -(define-method free - (of-object "GstIterator") - (c-name "gst_iterator_free") - (return-type "none") -) - -(define-method push - (of-object "GstIterator") - (c-name "gst_iterator_push") - (return-type "none") - (parameters - '("GstIterator*" "other") - ) -) - -(define-method filter - (of-object "GstIterator") - (c-name "gst_iterator_filter") - (return-type "GstIterator*") - (parameters - '("GCompareFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method fold - (of-object "GstIterator") - (c-name "gst_iterator_fold") - (return-type "GstIteratorResult") - (parameters - '("GstIteratorFoldFunction" "func") - '("GValue*" "ret") - '("gpointer" "user_data") - ) -) - -(define-method foreach - (of-object "GstIterator") - (c-name "gst_iterator_foreach") - (return-type "GstIteratorResult") - (parameters - '("GFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method find_custom - (of-object "GstIterator") - (c-name "gst_iterator_find_custom") - (return-type "gpointer") - (parameters - '("GCompareFunc" "func") - '("gpointer" "user_data") - ) -) - -;; From ../gstreamer/gst/gstmessage.h - -(define-function message_get_type - (c-name "gst_message_get_type") - (return-type "GType") -) - -(define-method get_name - (of-object "GstMessageType") - (c-name "gst_message_type_get_name") - (return-type "const-gchar*") -) - -(define-method to_quark - (of-object "GstMessageType") - (c-name "gst_message_type_to_quark") - (return-type "GQuark") -) - -(define-method set_seqnum - (of-object "GstMessage") - (c-name "gst_message_set_seqnum") - (return-type "none") - (parameters - '("guint32" "seqnum") - ) -) - -(define-function message_new_eos - (c-name "gst_message_new_eos") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - ) -) - -(define-function message_new_error - (c-name "gst_message_new_error") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GError*" "error") - '("gchar*" "debug") - ) -) - -(define-function message_new_warning - (c-name "gst_message_new_warning") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GError*" "error") - '("gchar*" "debug") - ) -) - -(define-function message_new_info - (c-name "gst_message_new_info") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GError*" "error") - '("gchar*" "debug") - ) -) - -(define-function message_new_tag - (c-name "gst_message_new_tag") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstTagList*" "tag_list" (keep-refcount)) - ) -) - -(define-function message_new_buffering - (c-name "gst_message_new_buffering") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("gint" "percent") - ) -) - -(define-function message_new_state_changed - (c-name "gst_message_new_state_changed") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstState" "old_state") - '("GstState" "new_state") - '("GstState" "pending_state") - ) -) - -(define-function message_new_state_dirty - (c-name "gst_message_new_state_dirty") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - ) -) - -(define-function message_new_step_done - (c-name "gst_message_new_step_done") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstFormat" "format") - '("guint64" "amount") - '("gdouble" "rate") - '("gboolean" "flush") - '("gboolean" "intermediate") - '("guint64" "duration") - '("gboolean" "eos") - ) -) - -(define-method parse_step_done - (of-object "GstMessage") - (c-name "gst_message_parse_step_done") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("guint64*" "amount") - '("gdouble*" "rate") - '("gboolean*" "flush") - '("gboolean*" "intermediate") - '("guint64*" "duration") - '("gboolean*" "eos") - ) -) - -(define-function message_new_clock_provide - (c-name "gst_message_new_clock_provide") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstClock*" "clock") - '("gboolean" "ready") - ) -) - -(define-function message_new_clock_lost - (c-name "gst_message_new_clock_lost") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstClock*" "clock") - ) -) - -(define-function message_new_new_clock - (c-name "gst_message_new_new_clock") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstClock*" "clock") - ) -) - -(define-function message_new_segment_start - (c-name "gst_message_new_segment_start") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstFormat" "format") - '("gint64" "position") - ) -) - -(define-function message_new_segment_done - (c-name "gst_message_new_segment_done") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstFormat" "format") - '("gint64" "position") - ) -) - -(define-function message_new_application - (c-name "gst_message_new_application") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstStructure*" "structure" (keep-refcount)) - ) -) - -(define-function message_new_element - (c-name "gst_message_new_element") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstStructure*" "structure" (keep-refcount)) - ) -) - -(define-function message_new_duration - (c-name "gst_message_new_duration") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstFormat" "format") - '("gint64" "duration") - ) -) - -(define-function message_new_async_start - (c-name "gst_message_new_async_start") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("gboolean" "new_base_time") - ) -) - -(define-function message_new_async_done - (c-name "gst_message_new_async_done") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - ) -) - -(define-function message_new_latency - (c-name "gst_message_new_latency") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - ) -) - -(define-function message_new_structure_change - (c-name "gst_message_new_structure_change") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstStructureChangeType" "type") - '("GstElement*" "owner") - '("gboolean" "busy") - ) -) - -(define-method parse_structure_change - (of-object "GstMessage") - (c-name "gst_message_parse_structure_change") - (return-type "none") - (parameters - '("GstStructureChangeType*" "type") - '("GstElement**" "owner") - '("gboolean*" "busy") - ) -) - -(define-function message_new_stream_status - (c-name "gst_message_new_stream_status") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstStreamStatusType" "type") - '("GstElement*" "owner") - ) -) - -(define-method parse_stream_status - (of-object "GstMessage") - (c-name "gst_message_parse_stream_status") - (return-type "none") - (parameters - '("GstStreamStatusType*" "type") - '("GstElement**" "owner") - ) -) - -(define-method set_stream_status_object - (of-object "GstMessage") - (c-name "gst_message_set_stream_status_object") - (return-type "none") - (parameters - '("const-GValue*" "object") - ) -) - -(define-method get_stream_status_object - (of-object "GstMessage") - (c-name "gst_message_get_stream_status_object") - (return-type "const-GValue*") -) - -(define-function message_new_request_state - (c-name "gst_message_new_request_state") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstState" "state") - ) -) - -(define-method parse_request_state - (of-object "GstMessage") - (c-name "gst_message_parse_request_state") - (return-type "none") - (parameters - '("GstState*" "state") - ) -) - -(define-function message_new_step_start - (c-name "gst_message_new_step_start") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("gboolean" "active") - '("GstFormat" "format") - '("guint64" "amount") - '("gdouble" "rate") - '("gboolean" "flush") - '("gboolean" "intermediate") - ) -) - -(define-method parse_step_start - (of-object "GstMessage") - (c-name "gst_message_parse_step_start") - (return-type "none") - (parameters - '("gboolean*" "active") - '("GstFormat*" "format") - '("guint64*" "amount") - '("gdouble*" "rate") - '("gboolean*" "flush") - '("gboolean*" "intermediate") - ) -) - -(define-function message_new_qos - (c-name "gst_message_new_qos") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("gboolean" "live") - '("guint64" "running_time") - '("guint64" "stream_time") - '("guint64" "timestamp") - '("guint64" "duration") - ) -) - -(define-method set_qos_values - (of-object "GstMessage") - (c-name "gst_message_set_qos_values") - (return-type "none") - (parameters - '("gint64" "jitter") - '("gdouble" "proportion") - '("gint" "quality") - ) -) - -(define-method set_qos_stats - (of-object "GstMessage") - (c-name "gst_message_set_qos_stats") - (return-type "none") - (parameters - '("GstFormat" "format") - '("guint64" "processed") - '("guint64" "dropped") - ) -) - -(define-method parse_qos - (of-object "GstMessage") - (c-name "gst_message_parse_qos") - (return-type "none") - (parameters - '("gboolean*" "live") - '("guint64*" "running_time") - '("guint64*" "stream_time") - '("guint64*" "timestamp") - '("guint64*" "duration") - ) -) - -(define-method parse_qos_values - (of-object "GstMessage") - (c-name "gst_message_parse_qos_values") - (return-type "none") - (parameters - '("gint64*" "jitter") - '("gdouble*" "proportion") - '("gint*" "quality") - ) -) - -(define-method parse_qos_stats - (of-object "GstMessage") - (c-name "gst_message_parse_qos_stats") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("guint64*" "processed") - '("guint64*" "dropped") - ) -) - -(define-function message_new_custom - (c-name "gst_message_new_custom") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstMessageType" "type") - '("GstObject*" "src") - '("GstStructure*" "structure" (keep-refcount)) - ) -) - -(define-method parse_error - (of-object "GstMessage") - (c-name "gst_message_parse_error") - (return-type "none") - (parameters - '("GError**" "gerror") - '("gchar**" "debug") - ) -) - -(define-method parse_warning - (of-object "GstMessage") - (c-name "gst_message_parse_warning") - (return-type "none") - (parameters - '("GError**" "gerror") - '("gchar**" "debug") - ) -) - -(define-method parse_info - (of-object "GstMessage") - (c-name "gst_message_parse_info") - (return-type "none") - (parameters - '("GError**" "gerror") - '("gchar**" "debug") - ) -) - -(define-function message_new_tag_full - (c-name "gst_message_new_tag_full") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("GstPad*" "pad") - '("GstTagList*" "tag_list" (keep-refcount)) - ) -) - -(define-method parse_tag - (of-object "GstMessage") - (c-name "gst_message_parse_tag") - (return-type "none") - (parameters - '("GstTagList**" "tag_list") - ) -) - -(define-method parse_tag_full - (of-object "GstMessage") - (c-name "gst_message_parse_tag_full") - (return-type "none") - (parameters - '("GstPad**" "pad") - '("GstTagList**" "tag_list") - ) -) - -(define-method parse_buffering - (of-object "GstMessage") - (c-name "gst_message_parse_buffering") - (return-type "none") - (parameters - '("gint*" "percent") - ) -) - -(define-method set_buffering_stats - (of-object "GstMessage") - (c-name "gst_message_set_buffering_stats") - (return-type "none") - (parameters - '("GstBufferingMode" "mode") - '("gint" "avg_in") - '("gint" "avg_out") - '("gint64" "buffering_left") - ) -) - -(define-method parse_buffering_stats - (of-object "GstMessage") - (c-name "gst_message_parse_buffering_stats") - (return-type "none") - (parameters - '("GstBufferingMode*" "mode") - '("gint*" "avg_in") - '("gint*" "avg_out") - '("gint64*" "buffering_left") - ) -) - -(define-method parse_state_changed - (of-object "GstMessage") - (c-name "gst_message_parse_state_changed") - (return-type "none") - (parameters - '("GstState*" "old_state") - '("GstState*" "new_state") - '("GstState*" "pending") - ) -) - -(define-method parse_clock_provide - (of-object "GstMessage") - (c-name "gst_message_parse_clock_provide") - (return-type "none") - (parameters - '("GstClock**" "clock") - '("gboolean*" "ready") - ) -) - -(define-method parse_clock_lost - (of-object "GstMessage") - (c-name "gst_message_parse_clock_lost") - (return-type "none") - (parameters - '("GstClock**" "clock") - ) -) - -(define-method parse_new_clock - (of-object "GstMessage") - (c-name "gst_message_parse_new_clock") - (return-type "none") - (parameters - '("GstClock**" "clock") - ) -) - -(define-method parse_segment_start - (of-object "GstMessage") - (c-name "gst_message_parse_segment_start") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "position") - ) -) - -(define-method parse_segment_done - (of-object "GstMessage") - (c-name "gst_message_parse_segment_done") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "position") - ) -) - -(define-method parse_duration - (of-object "GstMessage") - (c-name "gst_message_parse_duration") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "duration") - ) -) - -(define-method parse_async_start - (of-object "GstMessage") - (c-name "gst_message_parse_async_start") - (return-type "none") - (parameters - '("gboolean*" "new_base_time") - ) -) - -(define-method get_structure - (of-object "GstMessage*") - (c-name "gst_message_get_structure") - (return-type "const-GstStructure*") -) - - - -;; From ../gstreamer/gst/gstminiobject.h - -(define-function mini_object_get_type - (c-name "gst_mini_object_get_type") - (return-type "GType") -) - -(define-function mini_object_new - (c-name "gst_mini_object_new") - (is-constructor-of "GstMiniObject") - (return-type "GstMiniObject*") - (parameters - '("GType" "type") - ) -) - -(define-method copy - (of-object "GstMiniObject") - (c-name "gst_mini_object_copy") - (return-type "GstMiniObject*") - (caller-owns-return #t) -) - -(define-method is_writable - (of-object "GstMiniObject") - (c-name "gst_mini_object_is_writable") - (return-type "gboolean") -) - -(define-method make_writable - (of-object "GstMiniObject") - (c-name "gst_mini_object_make_writable") - (return-type "GstMiniObject*") - (caller-owns-return #t) -) - -(define-method ref - (of-object "GstMiniObject") - (c-name "gst_mini_object_ref") - (return-type "GstMiniObject*") -) - -(define-method unref - (of-object "GstMiniObject") - (c-name "gst_mini_object_unref") - (return-type "none") -) - -(define-function mini_object_replace - (c-name "gst_mini_object_replace") - (return-type "none") - (parameters - '("GstMiniObject**" "olddata") - '("GstMiniObject*" "newdata") - ) -) - -(define-function param_spec_mini_object - (c-name "gst_param_spec_mini_object") - (return-type "GParamSpec*") - (parameters - '("const-char*" "name") - '("const-char*" "nick") - '("const-char*" "blurb") - '("GType" "object_type") - '("GParamFlags" "flags") - ) -) - -(define-function gst_param_spec_fraction - (c-name "gst_param_spec_fraction") - (return-type "GParamSpec*") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "nick") - '("const-gchar*" "blurb") - '("gint" "min_num") - '("gint" "min_denom") - '("gint" "max_num") - '("gint" "max_denom") - '("gint" "default_num") - '("gint" "default_denom") - '("GParamFlags" "flags") - ) -) - - -(define-function value_set_mini_object - (c-name "gst_value_set_mini_object") - (return-type "none") - (parameters - '("GValue*" "value") - '("GstMiniObject*" "mini_object") - ) -) - -(define-function value_take_mini_object - (c-name "gst_value_take_mini_object") - (return-type "none") - (parameters - '("GValue*" "value") - '("GstMiniObject*" "mini_object") - ) -) - -(define-function value_get_mini_object - (c-name "gst_value_get_mini_object") - (return-type "GstMiniObject*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function gst_value_dup_mini_object - (c-name "gst_value_dup_mini_object") - (return-type "GstMiniObject*") - (parameters - '("const-GValue*" "value") - ) -) -;; From ../gstreamer/gst/gstobject.h - -(define-function object_get_type - (c-name "gst_object_get_type") - (return-type "GType") -) - -(define-method set_name - (of-object "GstObject") - (c-name "gst_object_set_name") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_name - (of-object "GstObject") - (c-name "gst_object_get_name") - (return-type "gchar*") -) - -(define-method set_name_prefix - (of-object "GstObject") - (c-name "gst_object_set_name_prefix") - (return-type "none") - (parameters - '("const-gchar*" "name_prefix") - ) -) - -(define-method get_name_prefix - (of-object "GstObject") - (c-name "gst_object_get_name_prefix") - (return-type "gchar*") -) - -(define-method set_parent - (of-object "GstObject") - (c-name "gst_object_set_parent") - (return-type "gboolean") - (parameters - '("GstObject*" "parent") - ) -) - -(define-method get_parent - (of-object "GstObject") - (c-name "gst_object_get_parent") - (return-type "GstObject*") - (caller-owns-return #t) -) - -(define-method unparent - (of-object "GstObject") - (c-name "gst_object_unparent") - (return-type "none") -) - -(define-method has_ancestor - (of-object "GstObject") - (c-name "gst_object_has_ancestor") - (return-type "gboolean") - (parameters - '("GstObject*" "ancestor") - ) -) - -(define-method sink - (of-object "GstObject") - (c-name "gst_object_sink") - (return-type "none") -) - -(define-method set_property - (of-object "GstObject") - (c-name "gst_object_set_property") - (return-type "none") -) - -(define-function object_default_deep_notify - (c-name "gst_object_default_deep_notify") - (return-type "none") - (parameters - '("GObject*" "object") - '("GstObject*" "orig") - '("GParamSpec*" "pspec") - '("gchar**" "excluded_props") - ) -) - -(define-function object_ref - (c-name "gst_object_ref") - (return-type "gpointer") - (parameters - '("gpointer" "object") - ) -) - -(define-function object_unref - (c-name "gst_object_unref") - (return-type "none") - (parameters - '("gpointer" "object") - ) -) - -(define-function object_replace - (c-name "gst_object_replace") - (return-type "none") - (parameters - '("GstObject**" "oldobj") - '("GstObject*" "newobj") - ) -) - -(define-method get_path_string - (of-object "GstObject") - (c-name "gst_object_get_path_string") - (return-type "gchar*") -) - -(define-function object_check_uniqueness - (c-name "gst_object_check_uniqueness") - (return-type "gboolean") - (parameters - '("GList*" "list") - '("const-gchar*" "name") - ) -) - -(define-method save_thyself - (of-object "GstObject") - (c-name "gst_object_save_thyself") - (return-type "GstXmlNodePtr") - (parameters - '("GstXmlNodePtr" "parent") - ) -) - -(define-method restore_thyself - (of-object "GstObject") - (c-name "gst_object_restore_thyself") - (return-type "none") - (parameters - '("GstXmlNodePtr" "self") - ) -) - -(define-function class_signal_connect - (c-name "gst_class_signal_connect") - (return-type "guint") - (parameters - '("GstObjectClass*" "klass") - '("const-gchar*" "name") - '("gpointer" "func") - '("gpointer" "func_data") - ) -) - -(define-function class_signal_emit_by_name - (c-name "gst_class_signal_emit_by_name") - (return-type "none") - (parameters - '("GstObject*" "object") - '("const-gchar*" "name") - '("GstXmlNodePtr" "self") - ) -) - -(define-virtual save_thyself - (of-object "GstObject") - (return-type "GstXmlNodePtr") - (parameters - '("GstXmlNodePtr" "parent") - ) -) - -(define-virtual restore_thyself - (of-object "GstObject") - (return-type "none") - (parameters - '("GstXmlNodePtr" "self") - ) -) - -;; From ../gstreamer/gst/gstpad.h - -(define-function flow_get_name - (c-name "gst_flow_get_name") - (return-type "const-gchar*") - (parameters - '("GstFlowReturn" "ret") - ) -) - -(define-function flow_to_quark - (c-name "gst_flow_to_quark") - (return-type "GQuark") - (parameters - '("GstFlowReturn" "ret") - ) -) - -(define-function pad_get_type - (c-name "gst_pad_get_type") - (return-type "GType") -) - -(define-function pad_new - (c-name "gst_pad_new") - (is-constructor-of "GstPad") - (return-type "GstPad*") - (properties - '("name" (argname "name")) - '("direction" (argname "direction")) - ) -) - -(define-function pad_new_from_template - (c-name "gst_pad_new_from_template") - (return-type "GstPad*") - (caller-owns-return #t) - (parameters - '("GstPadTemplate*" "templ") - '("const-gchar*" "name") - ) -) - -(define-function pad_new_from_static_template - (c-name "gst_pad_new_from_static_template") - (return-type "GstPad*") - (parameters - '("GstStaticPadTemplate*" "templ") - '("const-gchar*" "name") - ) -) - -(define-method get_direction - (of-object "GstPad") - (c-name "gst_pad_get_direction") - (return-type "GstPadDirection") -) - -(define-method set_active - (of-object "GstPad") - (c-name "gst_pad_set_active") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -(define-method is_active - (of-object "GstPad") - (c-name "gst_pad_is_active") - (return-type "gboolean") -) - -(define-method activate_pull - (of-object "GstPad") - (c-name "gst_pad_activate_pull") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -(define-method activate_push - (of-object "GstPad") - (c-name "gst_pad_activate_push") - (return-type "gboolean") - (parameters - '("gboolean" "active") - ) -) - -(define-method set_blocked - (of-object "GstPad") - (c-name "gst_pad_set_blocked") - (return-type "gboolean") - (parameters - '("gboolean" "blocked") - ) -) - -(define-method set_blocked_async - (of-object "GstPad") - (c-name "gst_pad_set_blocked_async") - (return-type "gboolean") - (parameters - '("gboolean" "blocked") - '("GstPadBlockCallback" "callback") - '("gpointer" "user_data") - ) -) - -(define-method is_blocked - (of-object "GstPad") - (c-name "gst_pad_is_blocked") - (return-type "gboolean") -) - -(define-method set_element_private - (of-object "GstPad") - (c-name "gst_pad_set_element_private") - (return-type "none") - (parameters - '("gpointer" "priv") - ) -) - -(define-method get_element_private - (of-object "GstPad") - (c-name "gst_pad_get_element_private") - (return-type "gpointer") -) - -(define-method get_pad_template - (of-object "GstPad") - (c-name "gst_pad_get_pad_template") - (return-type "GstPadTemplate*") -) - -(define-method set_bufferalloc_function - (of-object "GstPad") - (c-name "gst_pad_set_bufferalloc_function") - (return-type "none") - (parameters - '("GstPadBufferAllocFunction" "bufalloc") - ) -) - -(define-method alloc_buffer - (of-object "GstPad") - (c-name "gst_pad_alloc_buffer") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("gint" "size") - '("GstCaps*" "caps") - '("GstBuffer**" "buf") - ) -) - -(define-method alloc_buffer_and_set_caps - (of-object "GstPad") - (c-name "gst_pad_alloc_buffer_and_set_caps") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("gint" "size") - '("GstCaps*" "caps") - '("GstBuffer**" "buf") - ) -) - -(define-method set_activate_function - (of-object "GstPad") - (c-name "gst_pad_set_activate_function") - (return-type "none") - (parameters - '("GstPadActivateFunction" "activate") - ) -) - -(define-method set_activatepull_function - (of-object "GstPad") - (c-name "gst_pad_set_activatepull_function") - (return-type "none") - (parameters - '("GstPadActivateModeFunction" "activatepull") - ) -) - -(define-method set_activatepush_function - (of-object "GstPad") - (c-name "gst_pad_set_activatepush_function") - (return-type "none") - (parameters - '("GstPadActivateModeFunction" "activatepush") - ) -) - -(define-method set_chain_function - (of-object "GstPad") - (c-name "gst_pad_set_chain_function") - (return-type "none") - (parameters - '("GstPadChainFunction" "chain") - ) -) - -(define-method set_chain_list_function - (of-object "GstPad") - (c-name "gst_pad_set_chain_list_function") - (return-type "none") - (parameters - '("GstPadChainListFunction" "chainlist") - ) -) - -(define-method set_getrange_function - (of-object "GstPad") - (c-name "gst_pad_set_getrange_function") - (return-type "none") - (parameters - '("GstPadGetRangeFunction" "get") - ) -) - -(define-method set_checkgetrange_function - (of-object "GstPad") - (c-name "gst_pad_set_checkgetrange_function") - (return-type "none") - (parameters - '("GstPadCheckGetRangeFunction" "check") - ) -) - -(define-method set_event_function - (of-object "GstPad") - (c-name "gst_pad_set_event_function") - (return-type "none") - (parameters - '("GstPadEventFunction" "event") - ) -) - -(define-method set_link_function - (of-object "GstPad") - (c-name "gst_pad_set_link_function") - (return-type "none") - (parameters - '("GstPadLinkFunction" "link") - ) -) - -(define-method set_unlink_function - (of-object "GstPad") - (c-name "gst_pad_set_unlink_function") - (return-type "none") - (parameters - '("GstPadUnlinkFunction" "unlink") - ) -) - -(define-method link - (of-object "GstPad") - (c-name "gst_pad_link") - (return-type "GstPadLinkReturn") - (parameters - '("GstPad*" "sinkpad") - ) -) - -(define-method link_full - (of-object "GstPad") - (c-name "gst_pad_link_full") - (return-type "GstPadLinkReturn") - (parameters - '("GstPad*" "sinkpad") - '("GstPadLinkCheck" "flags") - ) -) - -(define-method unlink - (of-object "GstPad") - (c-name "gst_pad_unlink") - (return-type "gboolean") - (parameters - '("GstPad*" "sinkpad") - ) -) - -(define-method is_linked - (of-object "GstPad") - (c-name "gst_pad_is_linked") - (return-type "gboolean") -) - -(define-method get_peer - (of-object "GstPad") - (c-name "gst_pad_get_peer") - (return-type "GstPad*") - (caller-owns-return #t) -) - -(define-method set_getcaps_function - (of-object "GstPad") - (c-name "gst_pad_set_getcaps_function") - (return-type "none") - (parameters - '("GstPadGetCapsFunction" "getcaps") - ) -) - -(define-method set_acceptcaps_function - (of-object "GstPad") - (c-name "gst_pad_set_acceptcaps_function") - (return-type "none") - (parameters - '("GstPadAcceptCapsFunction" "acceptcaps") - ) -) - -(define-method set_fixatecaps_function - (of-object "GstPad") - (c-name "gst_pad_set_fixatecaps_function") - (return-type "none") - (parameters - '("GstPadFixateCapsFunction" "fixatecaps") - ) -) - -(define-method set_setcaps_function - (of-object "GstPad") - (c-name "gst_pad_set_setcaps_function") - (return-type "none") - (parameters - '("GstPadSetCapsFunction" "setcaps") - ) -) - -(define-method get_pad_template_caps - (of-object "GstPad") - (c-name "gst_pad_get_pad_template_caps") - (return-type "const-GstCaps*") -) - -(define-method get_caps_reffed - (of-object "GstPad") - (c-name "gst_pad_get_caps_reffed") - (return-type "GstCaps*") -) - -(define-method get_caps - (of-object "GstPad") - (c-name "gst_pad_get_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method fixate_caps - (of-object "GstPad") - (c-name "gst_pad_fixate_caps") - (return-type "none") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method accept_caps - (of-object "GstPad") - (c-name "gst_pad_accept_caps") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method set_caps - (of-object "GstPad") - (c-name "gst_pad_set_caps") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method peer_get_caps_reffed - (of-object "GstPad") - (c-name "gst_pad_peer_get_caps_reffed") - (return-type "GstCaps*") -) - -(define-method peer_get_caps - (of-object "GstPad") - (c-name "gst_pad_peer_get_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method peer_accept_caps - (of-object "GstPad") - (c-name "gst_pad_peer_accept_caps") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method get_allowed_caps - (of-object "GstPad") - (c-name "gst_pad_get_allowed_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method get_negotiated_caps - (of-object "GstPad") - (c-name "gst_pad_get_negotiated_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method push - (of-object "GstPad") - (c-name "gst_pad_push") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "buffer" (keep-refcount)) - ) -) - -(define-method push_list - (of-object "GstPad") - (c-name "gst_pad_push_list") - (return-type "GstFlowReturn") - (parameters - '("GstBufferList*" "list" (keep-refcount)) - ) -) - -(define-method check_pull_range - (of-object "GstPad") - (c-name "gst_pad_check_pull_range") - (return-type "gboolean") -) - -(define-method pull_range - (of-object "GstPad") - (c-name "gst_pad_pull_range") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("guint" "size") - '("GstBuffer**" "buffer") - ) -) - -(define-method push_event - (of-object "GstPad") - (c-name "gst_pad_push_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event" (keep-refcount)) - ) -) - -(define-method event_default - (of-object "GstPad") - (c-name "gst_pad_event_default") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) - -(define-method chain - (of-object "GstPad") - (c-name "gst_pad_chain") - (return-type "GstFlowReturn") - (parameters - '("GstBuffer*" "buffer" (keep-refcount)) - ) -) - -(define-method chain_list - (of-object "GstPad") - (c-name "gst_pad_chain_list") - (return-type "GstFlowReturn") - (parameters - '("GstBufferList*" "list" (keep-refcount)) - ) -) - -(define-method get_range - (of-object "GstPad") - (c-name "gst_pad_get_range") - (return-type "GstFlowReturn") - (parameters - '("guint64" "offset") - '("guint" "size") - '("GstBuffer**" "buffer") - ) -) - -(define-method send_event - (of-object "GstPad") - (c-name "gst_pad_send_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event" (keep-refcount)) - ) -) - -(define-method start_task - (of-object "GstPad") - (c-name "gst_pad_start_task") - (return-type "gboolean") - (parameters - '("GstTaskFunction" "func") - '("gpointer" "data") - ) -) - -(define-method pause_task - (of-object "GstPad") - (c-name "gst_pad_pause_task") - (return-type "gboolean") -) - -(define-method stop_task - (of-object "GstPad") - (c-name "gst_pad_stop_task") - (return-type "gboolean") -) - -(define-method set_internal_link_function - (of-object "GstPad") - (c-name "gst_pad_set_internal_link_function") - (return-type "none") - (parameters - '("GstPadIntLinkFunction" "intlink") - ) -) - -(define-method get_internal_links - (of-object "GstPad") - (c-name "gst_pad_get_internal_links") - (return-type "GList*") -) - -(define-method get_internal_links_default - (of-object "GstPad") - (c-name "gst_pad_get_internal_links_default") - (return-type "GList*") -) - -(define-method set_iterate_internal_links_function - (of-object "GstPad") - (c-name "gst_pad_set_iterate_internal_links_function") - (return-type "none") - (parameters - '("GstPadIterIntLinkFunction" "iterintlink") - ) -) - -(define-method iterate_internal_links - (of-object "GstPad") - (c-name "gst_pad_iterate_internal_links") - (return-type "GstIterator*") -) - -(define-method iterate_internal_links_default - (of-object "GstPad") - (c-name "gst_pad_iterate_internal_links_default") - (return-type "GstIterator*") -) - -(define-method set_query_type_function - (of-object "GstPad") - (c-name "gst_pad_set_query_type_function") - (return-type "none") - (parameters - '("GstPadQueryTypeFunction" "type_func") - ) -) - -(define-method get_query_types - (of-object "GstPad") - (c-name "gst_pad_get_query_types") - (return-type "const-GstQueryType*") -) - -(define-method get_query_types_default - (of-object "GstPad") - (c-name "gst_pad_get_query_types_default") - (return-type "const-GstQueryType*") -) - -(define-method query - (of-object "GstPad") - (c-name "gst_pad_query") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-method peer_query - (of-object "GstPad") - (c-name "gst_pad_peer_query") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-method set_query_function - (of-object "GstPad") - (c-name "gst_pad_set_query_function") - (return-type "none") - (parameters - '("GstPadQueryFunction" "query") - ) -) - -(define-method query_default - (of-object "GstPad") - (c-name "gst_pad_query_default") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - ) -) - -(define-method dispatcher - (of-object "GstPad") - (c-name "gst_pad_dispatcher") - (return-type "gboolean") - (parameters - '("GstPadDispatcherFunction" "dispatch") - '("gpointer" "data") - ) -) - -(define-method add_data_probe - (of-object "GstPad") - (c-name "gst_pad_add_data_probe") - (return-type "gulong") - (parameters - '("GCallback" "handler") - '("gpointer" "data") - ) -) - -(define-method remove_data_probe - (of-object "GstPad") - (c-name "gst_pad_remove_data_probe") - (return-type "none") - (parameters - '("guint" "handler_id") - ) -) - -(define-method add_event_probe - (of-object "GstPad") - (c-name "gst_pad_add_event_probe") - (return-type "gulong") - (parameters - '("GCallback" "handler") - '("gpointer" "data") - ) -) - -(define-method remove_event_probe - (of-object "GstPad") - (c-name "gst_pad_remove_event_probe") - (return-type "none") - (parameters - '("guint" "handler_id") - ) -) - -(define-method add_buffer_probe - (of-object "GstPad") - (c-name "gst_pad_add_buffer_probe") - (return-type "gulong") - (parameters - '("GCallback" "handler") - '("gpointer" "data") - ) -) - -(define-method remove_buffer_probe - (of-object "GstPad") - (c-name "gst_pad_remove_buffer_probe") - (return-type "none") - (parameters - '("guint" "handler_id") - ) -) - -(define-method found_tags_for_pad - (of-object "GstElement") - (c-name "gst_element_found_tags_for_pad") - (return-type "none") - (parameters - '("GstPad*" "pad") - '("GstTagList*" "list") - ) -) - -(define-method found_tags - (of-object "GstElement") - (c-name "gst_element_found_tags") - (return-type "none") - (parameters - '("GstTagList*" "list") - ) -) - -(define-function parse_bin_from_description - (c-name "gst_parse_bin_from_description") - (return-type "GstElement*") - (parameters - '("const-gchar*" "bin_description") - '("gboolean" "ghost_unconnected_pads") - '("GError**" "err") - ) -) - -(define-function util_get_timestamp - (c-name "gst_util_get_timestamp") - (return-type "GstClockTime") -) - -(define-function util_array_binary_search - (c-name "gst_util_array_binary_search") - (return-type "gpointer") - (parameters - '("gpointer" "array") - '("guint" "num_elements") - '("gsize" "element_size") - '("GCompareDataFunc" "search_func") - '("GstSearchMode" "mode") - '("gconstpointer" "search_data") - '("gpointer" "user_data") - ) -) -(define-function util_greatest_common_divisor - (c-name "gst_util_greatest_common_divisor") - (return-type "gint") - (parameters - '("gint" "a") - '("gint" "b") - ) -) - -(define-function util_fraction_to_double - (c-name "gst_util_fraction_to_double") - (return-type "none") - (parameters - '("gint" "src_n") - '("gint" "src_d") - '("gdouble*" "dest") - ) -) - -(define-function util_double_to_fraction - (c-name "gst_util_double_to_fraction") - (return-type "none") - (parameters - '("gdouble" "src") - '("gint*" "dest_n") - '("gint*" "dest_d") - ) -) - -(define-function util_fraction_multiply - (c-name "gst_util_fraction_multiply") - (return-type "gboolean") - (parameters - '("gint" "a_n") - '("gint" "a_d") - '("gint" "b_n") - '("gint" "b_d") - '("gint*" "res_n") - '("gint*" "res_d") - ) -) - -(define-function util_fraction_add - (c-name "gst_util_fraction_add") - (return-type "gboolean") - (parameters - '("gint" "a_n") - '("gint" "a_d") - '("gint" "b_n") - '("gint" "b_d") - '("gint*" "res_n") - '("gint*" "res_d") - ) -) - -(define-function util_fraction_compare - (c-name "gst_util_fraction_compare") - (return-type "gint") - (parameters - '("gint" "a_n") - '("gint" "a_d") - '("gint" "b_n") - '("gint" "b_d") - ) -) - -(define-function event_new_sink_message - (c-name "gst_event_new_sink_message") - (return-type "GstEvent*") - (parameters - '("GstMessage*" "msg") - ) -) - -(define-method parse_sink_message - (of-object "GstEvent") - (c-name "gst_event_parse_sink_message") - (return-type "none") - (parameters - '("GstMessage**" "msg") - ) -) - -(define-function pad_load_and_link - (c-name "gst_pad_load_and_link") - (return-type "none") - (parameters - '("GstXmlNodePtr" "self") - '("GstObject*" "parent") - ) -) - -(define-function pad_template_get_type - (c-name "gst_pad_template_get_type") - (return-type "GType") -) - -(define-function pad_template_new - (c-name "gst_pad_template_new") - (is-constructor-of "GstPadTemplate") - (return-type "GstPadTemplate*") - (parameters - '("const-gchar*" "name_template") - '("GstPadDirection" "direction") - '("GstPadPresence" "presence") - '("GstCaps*" "caps" (keep-refcount)) - ) -) - -(define-method get - (of-object "GstStaticPadTemplate") - (c-name "gst_static_pad_template_get") - (return-type "GstPadTemplate*") - (caller-owns-return #t) -) - -(define-method get_caps - (of-object "GstStaticPadTemplate") - (c-name "gst_static_pad_template_get_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method get_caps - (of-object "GstPadTemplate") - (c-name "gst_pad_template_get_caps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method pad_created - (of-object "GstPadTemplate") - (c-name "gst_pad_template_pad_created") - (return-type "none") - (parameters - '("GstPad*" "pad") - ) -) - - -;; From ../gstreamer/gst/gstparse.h - -(define-function parse_error_quark - (c-name "gst_parse_error_quark") - (return-type "GQuark") -) - -(define-function gst_parse_context_new - (c-name "gst_parse_context_new") - (is-constructor-of "GstParseContext") - (return-type "GstParseContext*") -) - -(define-method get_missing_elements - (of-object "GstParseContext") - (c-name "gst_parse_context_get_missing_elements") - (return-type "GStrv") -) - -(define-method free - (of-object "GstParseContext") - (c-name "gst_parse_context_free") - (return-type "none") -) - -(define-function parse_launch - (c-name "gst_parse_launch") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "pipeline_description") - '("GError**" "error") - ) -) - -(define-function parse_launchv - (c-name "gst_parse_launchv") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar**" "argv") - '("GError**" "error") - ) -) - -(define-function parse_launch_full - (c-name "gst_parse_launch_full") - (return-type "GstElement*") - (parameters - '("const-gchar*" "pipeline_description") - '("GstParseContext*" "context") - '("GstParseFlags" "flags") - '("GError**" "error") - ) -) - -(define-function parse_launchv_full - (c-name "gst_parse_launchv_full") - (return-type "GstElement*") - (parameters - '("const-gchar**" "argv") - '("GstParseContext*" "context") - '("GstParseFlags" "flags") - '("GError**" "error") - ) -) - - -;; From ../gstreamer/gst/gstpipeline.h - -(define-function pipeline_get_type - (c-name "gst_pipeline_get_type") - (return-type "GType") -) - -(define-function pipeline_new - (c-name "gst_pipeline_new") - (is-constructor-of "GstPipeline") - (return-type "GstElement*") - (properties - '("name" (argname "name") (optional)) - ) -) - -(define-method get_bus - (of-object "GstPipeline") - (c-name "gst_pipeline_get_bus") - (return-type "GstBus*") - (caller-owns-return #t) -) - -(define-method set_new_stream_time - (of-object "GstPipeline") - (c-name "gst_pipeline_set_new_stream_time") - (return-type "none") - (parameters - '("GstClockTime" "time") - ) -) - -(define-method get_last_stream_time - (of-object "GstPipeline") - (c-name "gst_pipeline_get_last_stream_time") - (return-type "GstClockTime") -) - -(define-method use_clock - (of-object "GstPipeline") - (c-name "gst_pipeline_use_clock") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method set_clock - (of-object "GstPipeline") - (c-name "gst_pipeline_set_clock") - (return-type "gboolean") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method get_clock - (of-object "GstPipeline") - (c-name "gst_pipeline_get_clock") - (return-type "GstClock*") - (caller-owns-return #t) -) - -(define-method auto_clock - (of-object "GstPipeline") - (c-name "gst_pipeline_auto_clock") - (return-type "none") -) - -(define-method set_delay - (of-object "GstPipeline") - (c-name "gst_pipeline_set_delay") - (return-type "none") - (parameters - '("GstClockTime" "delay") - ) -) - -(define-method get_delay - (of-object "GstPipeline") - (c-name "gst_pipeline_get_delay") - (return-type "GstClockTime") -) - -(define-method set_auto_flush_bus - (of-object "GstPipeline") - (c-name "gst_pipeline_set_auto_flush_bus") - (return-type "none") - (parameters - '("gboolean" "auto_flush") - ) -) - -(define-method get_auto_flush_bus - (of-object "GstPipeline") - (c-name "gst_pipeline_get_auto_flush_bus") - (return-type "gboolean") -) - - - -;; From ../gstreamer/gst/gstplugin.h - -(define-function plugin_error_quark - (c-name "gst_plugin_error_quark") - (return-type "GQuark") -) - -(define-function plugin_get_type - (c-name "gst_plugin_get_type") - (return-type "GType") -) - -(define-function plugin_register_static - (c-name "gst_plugin_register_static") - (return-type "gboolean") - (parameters - '("const-GstPluginDesc*" "desc") - ) -) - -(define-method get_name - (of-object "GstPlugin") - (c-name "gst_plugin_get_name") - (return-type "const-gchar*") -) - -(define-method get_description - (of-object "GstPlugin") - (c-name "gst_plugin_get_description") - (return-type "const-gchar*") -) - -(define-method get_filename - (of-object "GstPlugin") - (c-name "gst_plugin_get_filename") - (return-type "const-gchar*") -) - -(define-method get_version - (of-object "GstPlugin") - (c-name "gst_plugin_get_version") - (return-type "const-gchar*") -) - -(define-method get_license - (of-object "GstPlugin") - (c-name "gst_plugin_get_license") - (return-type "const-gchar*") -) - -(define-method get_source - (of-object "GstPlugin") - (c-name "gst_plugin_get_source") - (return-type "const-gchar*") -) - -(define-method get_package - (of-object "GstPlugin") - (c-name "gst_plugin_get_package") - (return-type "const-gchar*") -) - -(define-method get_origin - (of-object "GstPlugin") - (c-name "gst_plugin_get_origin") - (return-type "const-gchar*") -) - -(define-method get_cache_data - (of-object "GstPlugin") - (c-name "gst_plugin_get_cache_data") - (return-type "const-GstStructure*") -) - -(define-method set_cache_data - (of-object "GstPlugin") - (c-name "gst_plugin_set_cache_data") - (return-type "none") - (parameters - '("GstStructure*" "cache_data") - ) -) - -(define-method get_module - (of-object "GstPlugin") - (c-name "gst_plugin_get_module") - (return-type "GModule*") -) - -(define-method is_loaded - (of-object "GstPlugin") - (c-name "gst_plugin_is_loaded") - (return-type "gboolean") -) - -(define-method name_filter - (of-object "GstPlugin") - (c-name "gst_plugin_name_filter") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function plugin_load_file - (c-name "gst_plugin_load_file") - (return-type "GstPlugin*") - (parameters - '("const-gchar*" "filename") - '("GError**" "error") - ) -) - - -(define-method load - (of-object "GstPlugin") - (c-name "gst_plugin_load") - (return-type "GstPlugin*") -) - -(define-function plugin_load_by_name - (c-name "gst_plugin_load_by_name") - (return-type "GstPlugin*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function plugin_list_free - (c-name "gst_plugin_list_free") - (return-type "none") - (parameters - '("GList*" "list") - ) -) - - - -;; From ../gstreamer/gst/gstpluginfeature.h - -(define-function plugin_feature_get_type - (c-name "gst_plugin_feature_get_type") - (return-type "GType") -) - -(define-method load - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_load") - (return-type "GstPluginFeature*") -) - -(define-method type_name_filter - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_type_name_filter") - (return-type "gboolean") - (parameters - '("GstTypeNameData*" "data") - ) -) - -(define-method set_rank - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_set_rank") - (return-type "none") - (parameters - '("guint" "rank") - ) -) - -(define-method set_name - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_set_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_rank - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_get_rank") - (return-type "guint") -) - -(define-method get_name - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_get_name") - (return-type "const-gchar*") -) - -(define-function plugin_feature_list_free - (c-name "gst_plugin_feature_list_free") - (return-type "none") - (parameters - '("GList*" "list") - ) -) - -(define-function plugin_feature_list_copy - (c-name "gst_plugin_feature_list_copy") - (return-type "GList*") - (parameters - '("GList*" "list") - ) -) - -(define-method check_version - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_check_version") - (return-type "gboolean") - (parameters - '("guint" "min_major") - '("guint" "min_minor") - '("guint" "min_micro") - ) -) - -(define-function plugin_feature_rank_compare_func - (c-name "gst_plugin_feature_rank_compare_func") - (return-type "gint") - (parameters - '("gconstpointer" "p1") - '("gconstpointer" "p2") - ) -) - - -;; From gstpoll.h - -(define-function gst_poll_new - (c-name "gst_poll_new") - (is-constructor-of "GstPoll") - (return-type "GstPoll*") - (parameters - '("gboolean" "controllable") - ) -) - -(define-function poll_new_timer - (c-name "gst_poll_new_timer") - (caller-owns-return #t) - (return-type "GstPoll*") -) - -(define-method free - (of-object "GstPoll") - (c-name "gst_poll_free") - (return-type "none") -) - -(define-method get_read_gpollfd - (of-object "GstPoll") - (c-name "gst_poll_get_read_gpollfd") - (return-type "none") - (parameters - '("GPollFD*" "fd") - ) -) - -(define-method init - (of-object "GstPollFD") - (c-name "gst_poll_fd_init") - (return-type "none") -) - -(define-method add_fd - (of-object "GstPoll") - (c-name "gst_poll_add_fd") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method remove_fd - (of-object "GstPoll") - (c-name "gst_poll_remove_fd") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method fd_ctl_write - (of-object "GstPoll") - (c-name "gst_poll_fd_ctl_write") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - '("gboolean" "active") - ) -) - -(define-method fd_ctl_read - (of-object "GstPoll") - (c-name "gst_poll_fd_ctl_read") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - '("gboolean" "active") - ) -) - -(define-method fd_ignored - (of-object "GstPoll") - (c-name "gst_poll_fd_ignored") - (return-type "none") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method fd_has_closed - (of-object "GstPoll") - (c-name "gst_poll_fd_has_closed") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method fd_has_error - (of-object "GstPoll") - (c-name "gst_poll_fd_has_error") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method fd_can_read - (of-object "GstPoll") - (c-name "gst_poll_fd_can_read") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method fd_can_write - (of-object "GstPoll") - (c-name "gst_poll_fd_can_write") - (return-type "gboolean") - (parameters - '("GstPollFD*" "fd") - ) -) - -(define-method wait - (of-object "GstPoll") - (c-name "gst_poll_wait") - (return-type "gint") - (parameters - '("GstClockTime" "timeout") - ) -) - -(define-method set_controllable - (of-object "GstPoll") - (c-name "gst_poll_set_controllable") - (return-type "gboolean") - (parameters - '("gboolean" "controllable") - ) -) - -(define-method restart - (of-object "GstPoll") - (c-name "gst_poll_restart") - (return-type "none") -) - -(define-method set_flushing - (of-object "GstPoll") - (c-name "gst_poll_set_flushing") - (return-type "none") - (parameters - '("gboolean" "flushing") - ) -) - -(define-method write_control - (of-object "GstPoll") - (c-name "gst_poll_write_control") - (return-type "gboolean") -) - -(define-method read_control - (of-object "GstPoll") - (c-name "gst_poll_read_control") - (return-type "gboolean") -) - -;; From gstpreset.h - -(define-function gst_preset_get_type - (c-name "gst_preset_get_type") - (return-type "GType") -) - -(define-method get_preset_names - (of-object "GstPreset") - (c-name "gst_preset_get_preset_names") - (return-type "GStrv") -) - -(define-method get_property_names - (of-object "GstPreset") - (c-name "gst_preset_get_property_names") - (return-type "GStrv") -) - -(define-method load_preset - (of-object "GstPreset") - (c-name "gst_preset_load_preset") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method save_preset - (of-object "GstPreset") - (c-name "gst_preset_save_preset") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method rename_preset - (of-object "GstPreset") - (c-name "gst_preset_rename_preset") - (return-type "gboolean") - (parameters - '("const-gchar*" "old_name") - '("const-gchar*" "new_name") - ) -) - -(define-method delete_preset - (of-object "GstPreset") - (c-name "gst_preset_delete_preset") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method set_meta - (of-object "GstPreset") - (c-name "gst_preset_set_meta") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "tag") - '("const-gchar*" "value") - ) -) - -(define-method get_meta - (of-object "GstPreset") - (c-name "gst_preset_get_meta") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "tag") - '("gchar**" "value") - ) -) - -(define-function preset_set_app_dir - (c-name "gst_preset_set_app_dir") - (return-type "gboolean") - (parameters - '("const-gchar*" "app_dir") - ) -) - -(define-function preset_get_app_dir - (c-name "gst_preset_get_app_dir") - (return-type "const-gchar*") -) - - -;; From ../gstreamer/gst/gstquery.h - -(define-method get_name - (of-object "GstQueryType") - (c-name "gst_query_type_get_name") - (return-type "const-gchar*") -) - -(define-method to_quark - (of-object "GstQueryType") - (c-name "gst_query_type_to_quark") - (return-type "GQuark") -) - -(define-function query_get_type - (c-name "gst_query_get_type") - (return-type "GType") -) - -(define-function query_type_register - (c-name "gst_query_type_register") - (return-type "GstQueryType") - (parameters - '("const-gchar*" "nick") - '("const-gchar*" "description") - ) -) - -(define-function query_type_get_by_nick - (c-name "gst_query_type_get_by_nick") - (return-type "GstQueryType") - (parameters - '("const-gchar*" "nick") - ) -) - -(define-method s_contains - (of-object "GstQueryType") - (c-name "gst_query_types_contains") - (return-type "gboolean") - (parameters - '("GstQueryType" "type") - ) -) - -(define-method get_details - (of-object "GstQueryType") - (c-name "gst_query_type_get_details") - (return-type "const-GstQueryTypeDefinition*") -) - -(define-function query_type_iterate_definitions - (c-name "gst_query_type_iterate_definitions") - (return-type "GstIterator*") -) - -(define-function query_new_position - (c-name "gst_query_new_position") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_position - (of-object "GstQuery") - (c-name "gst_query_set_position") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gint64" "cur") - ) -) - -(define-method parse_position - (of-object "GstQuery") - (c-name "gst_query_parse_position") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "cur") - ) -) - -(define-function query_new_duration - (c-name "gst_query_new_duration") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_duration - (of-object "GstQuery") - (c-name "gst_query_set_duration") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gint64" "duration") - ) -) - -(define-method parse_duration - (of-object "GstQuery") - (c-name "gst_query_parse_duration") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "duration") - ) -) - -(define-function query_new_latency - (c-name "gst_query_new_latency") - (caller-owns-return #t) - (return-type "GstQuery*") -) - -(define-method set_latency - (of-object "GstQuery") - (c-name "gst_query_set_latency") - (return-type "none") - (parameters - '("gboolean" "live") - '("GstClockTime" "min_latency") - '("GstClockTime" "max_latency") - ) -) - -(define-method parse_latency - (of-object "GstQuery") - (c-name "gst_query_parse_latency") - (return-type "none") - (parameters - '("gboolean*" "live") - '("GstClockTime*" "min_latency") - '("GstClockTime*" "max_latency") - ) -) - -(define-function query_new_convert - (c-name "gst_query_new_convert") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "src_fmt") - '("gint64" "value") - '("GstFormat" "dest_fmt") - ) -) - -(define-method set_convert - (of-object "GstQuery") - (c-name "gst_query_set_convert") - (return-type "none") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_value") - '("GstFormat" "dest_format") - '("gint64" "dest_value") - ) -) - -(define-method parse_convert - (of-object "GstQuery") - (c-name "gst_query_parse_convert") - (return-type "none") - (parameters - '("GstFormat*" "src_format") - '("gint64*" "src_value") - '("GstFormat*" "dest_format") - '("gint64*" "dest_value") - ) -) - -(define-function query_new_segment - (c-name "gst_query_new_segment") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_segment - (of-object "GstQuery") - (c-name "gst_query_set_segment") - (return-type "none") - (parameters - '("gdouble" "rate") - '("GstFormat" "format") - '("gint64" "start_value") - '("gint64" "stop_value") - ) -) - -(define-method parse_segment - (of-object "GstQuery") - (c-name "gst_query_parse_segment") - (return-type "none") - (parameters - '("gdouble*" "rate") - '("GstFormat*" "format") - '("gint64*" "start_value") - '("gint64*" "stop_value") - ) -) - -(define-function query_new_application - (c-name "gst_query_new_application") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstQueryType" "type") - '("GstStructure*" "structure") - ) -) - -(define-method get_structure - (of-object "GstQuery") - (c-name "gst_query_get_structure") - (return-type "GstStructure*") -) - - -(define-function query_new_seeking - (c-name "gst_query_new_seeking") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_seeking - (of-object "GstQuery") - (c-name "gst_query_set_seeking") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gboolean" "seekable") - '("gint64" "segment_start") - '("gint64" "segment_end") - ) -) - -(define-method parse_seeking - (of-object "GstQuery") - (c-name "gst_query_parse_seeking") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gboolean*" "seekable") - '("gint64*" "segment_start") - '("gint64*" "segment_end") - ) -) - -(define-function query_new_formats - (c-name "gst_query_new_formats") - (caller-owns-return #t) - (return-type "GstQuery*") -) - -(define-method set_formats - (of-object "GstQuery") - (c-name "gst_query_set_formats") - (return-type "none") - (parameters - '("gint" "n_formats") - ) - (varargs #t) -) - -(define-method set_formatsv - (of-object "GstQuery") - (c-name "gst_query_set_formatsv") - (return-type "none") - (parameters - '("gint" "n_formats") - '("GstFormat*" "formats") - ) -) - -(define-method parse_formats_length - (of-object "GstQuery") - (c-name "gst_query_parse_formats_length") - (return-type "none") - (parameters - '("guint*" "n_formats") - ) -) - -(define-method parse_formats_nth - (of-object "GstQuery") - (c-name "gst_query_parse_formats_nth") - (return-type "none") - (parameters - '("guint" "nth") - '("GstFormat*" "format") - ) -) - -(define-function query_new_buffering - (c-name "gst_query_new_buffering") - (return-type "GstQuery*") - (caller-owns-return #t) - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_buffering_percent - (of-object "GstQuery") - (c-name "gst_query_set_buffering_percent") - (return-type "none") - (parameters - '("gboolean" "busy") - '("gint" "percent") - ) -) - -(define-method parse_buffering_percent - (of-object "GstQuery") - (c-name "gst_query_parse_buffering_percent") - (return-type "none") - (parameters - '("gboolean*" "busy") - '("gint*" "percent") - ) -) - -(define-method set_buffering_stats - (of-object "GstQuery") - (c-name "gst_query_set_buffering_stats") - (return-type "none") - (parameters - '("GstBufferingMode" "mode") - '("gint" "avg_in") - '("gint" "avg_out") - '("gint64" "buffering_left") - ) -) - -(define-method parse_buffering_stats - (of-object "GstQuery") - (c-name "gst_query_parse_buffering_stats") - (return-type "none") - (parameters - '("GstBufferingMode*" "mode") - '("gint*" "avg_in") - '("gint*" "avg_out") - '("gint64*" "buffering_left") - ) -) - -(define-method set_buffering_range - (of-object "GstQuery") - (c-name "gst_query_set_buffering_range") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gint64" "start") - '("gint64" "stop") - '("gint64" "estimated_total") - ) -) - -(define-method parse_buffering_range - (of-object "GstQuery") - (c-name "gst_query_parse_buffering_range") - (return-type "none") - (parameters - '("GstFormat*" "format") - '("gint64*" "start") - '("gint64*" "stop") - '("gint64*" "estimated_total") - ) -) - -(define-method add_buffering_range - (of-object "GstQuery") - (c-name "gst_query_add_buffering_range") - (return-type "gboolean") - (parameters - '("gint64" "start") - '("gint64" "stop") - ) -) - -(define-method get_n_buffering_ranges - (of-object "GstQuery") - (c-name "gst_query_get_n_buffering_ranges") - (return-type "guint") -) - -(define-method parse_nth_buffering_range - (of-object "GstQuery") - (c-name "gst_query_parse_nth_buffering_range") - (return-type "gboolean") - (parameters - '("guint" "index") - '("gint64*" "start") - '("gint64*" "stop") - ) -) - -(define-function query_new_uri - (c-name "gst_query_new_uri") - (caller-owns-return #t) - (return-type "GstQuery*") -) - -(define-method parse_uri - (of-object "GstQuery") - (c-name "gst_query_parse_uri") - (return-type "none") - (parameters - '("gchar**" "uri") - ) -) - -(define-method set_uri - (of-object "GstQuery") - (c-name "gst_query_set_uri") - (return-type "none") - (parameters - '("const-gchar*" "uri") - ) -) - - -;; From ../gstreamer/gst/gstregistry.h - -(define-function registry_get_type - (c-name "gst_registry_get_type") - (return-type "GType") -) - -(define-function registry_get_default - (c-name "gst_registry_get_default") - (return-type "GstRegistry*") -) - -(define-method scan_path - (of-object "GstRegistry") - (c-name "gst_registry_scan_path") - (return-type "none") - (parameters - '("const-gchar*" "path") - ) -) - -(define-method add_path - (of-object "GstRegistry") - (c-name "gst_registry_add_path") - (return-type "none") - (parameters - '("const-gchar*" "path") - ) -) - -(define-method get_path_list - (of-object "GstRegistry") - (c-name "gst_registry_get_path_list") - (return-type "GList*") -) - -(define-method add_plugin - (of-object "GstRegistry") - (c-name "gst_registry_add_plugin") - (return-type "gboolean") - (parameters - '("GstPlugin*" "plugin") - ) -) - -(define-method remove_plugin - (of-object "GstRegistry") - (c-name "gst_registry_remove_plugin") - (return-type "none") - (parameters - '("GstPlugin*" "plugin") - ) -) - -(define-method get_plugin_list - (of-object "GstRegistry") - (c-name "gst_registry_get_plugin_list") - (return-type "GList*") -) - -(define-method plugin_filter - (of-object "GstRegistry") - (c-name "gst_registry_plugin_filter") - (return-type "GList*") - (parameters - '("GstPluginFilter" "filter") - '("gboolean" "first") - '("gpointer" "user_data") - ) -) - -(define-method find_plugin - (of-object "GstRegistry") - (c-name "gst_registry_find_plugin") - (return-type "GstPlugin*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - ) -) - -(define-method feature_filter - (of-object "GstRegistry") - (c-name "gst_registry_feature_filter") - (return-type "GList*") - (parameters - '("GstPluginFeatureFilter" "filter") - '("gboolean" "first") - '("gpointer" "user_data") - ) -) - -(define-method get_feature_list - (of-object "GstRegistry") - (c-name "gst_registry_get_feature_list") - (return-type "GList*") - (parameters - '("GType" "type") - ) -) - -(define-method get_feature_list_by_plugin - (of-object "GstRegistry") - (c-name "gst_registry_get_feature_list_by_plugin") - (return-type "GList*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_feature_list_cookie - (of-object "GstRegistry") - (c-name "gst_registry_get_feature_list_cookie") - (return-type "guint32") -) - -(define-method add_feature - (of-object "GstRegistry") - (c-name "gst_registry_add_feature") - (return-type "gboolean") - (parameters - '("GstPluginFeature*" "feature") - ) -) - -(define-method remove_feature - (of-object "GstRegistry") - (c-name "gst_registry_remove_feature") - (return-type "none") - (parameters - '("GstPluginFeature*" "feature") - ) -) - - -(define-method find_feature - (of-object "GstRegistry") - (c-name "gst_registry_find_feature") - (return-type "GstPluginFeature*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - '("GType" "type") - ) -) - -(define-method lookup_feature - (of-object "GstRegistry") - (c-name "gst_registry_lookup_feature") - (return-type "GstPluginFeature*") - (caller-owns-return #t) - (parameters - '("const-char*" "name") - ) -) - -(define-method lookup - (of-object "GstRegistry") - (c-name "gst_registry_lookup") - (return-type "GstPlugin*") - (caller-owns-return #t) - (parameters - '("const-char*" "filename") - ) -) - -(define-method xml_read_cache - (of-object "GstRegistry") - (c-name "gst_registry_xml_read_cache") - (return-type "gboolean") - (parameters - '("const-char*" "location") - ) -) - -(define-method xml_write_cache - (of-object "GstRegistry") - (c-name "gst_registry_xml_write_cache") - (return-type "gboolean") - (parameters - '("const-char*" "location") - ) -) - -(define-function default_registry_check_feature_version - (c-name "gst_default_registry_check_feature_version") - (return-type "gboolean") - (parameters - '("const-gchar*" "feature_name") - '("guint" "min_major") - '("guint" "min_minor") - '("guint" "min_micro") - ) -) - -;; From ../gstreamer/gst/gstsegment.h - -(define-function gst_segment_get_type - (c-name "gst_segment_get_type") - (return-type "GType") -) - -(define-function gst_segment_new - (c-name "gst_segment_new") - (is-constructor-of "GstSegment") - (return-type "GstSegment*") -) - -(define-method free - (of-object "GstSegment") - (c-name "gst_segment_free") - (return-type "none") -) - -(define-method init - (of-object "GstSegment") - (c-name "gst_segment_init") - (return-type "none") - (parameters - '("GstFormat" "format") - ) -) - -(define-method set_duration - (of-object "GstSegment") - (c-name "gst_segment_set_duration") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gint64" "duration") - ) -) - -(define-method set_last_stop - (of-object "GstSegment") - (c-name "gst_segment_set_last_stop") - (return-type "none") - (parameters - '("GstFormat" "format") - '("gint64" "position") - ) -) - -(define-method set_seek - (of-object "GstSegment") - (c-name "gst_segment_set_seek") - (return-type "none") - (parameters - '("gdouble" "rate") - '("GstFormat" "format") - '("GstSeekFlags" "flags") - '("GstSeekType" "start_type") - '("gint64" "start") - '("GstSeekType" "stop_type") - '("gint64" "stop") - '("gboolean*" "update") - ) -) - -(define-method set_newsegment - (of-object "GstSegment") - (c-name "gst_segment_set_newsegment") - (return-type "none") - (parameters - '("gboolean" "update") - '("gdouble" "rate") - '("GstFormat" "format") - '("gint64" "start") - '("gint64" "stop") - '("gint64" "time") - ) -) - -(define-method set_newsegment_full - (of-object "GstSegment") - (c-name "gst_segment_set_newsegment_full") - (return-type "none") - (parameters - '("gboolean" "update") - '("gdouble" "rate") - '("gdouble" "applied_rate") - '("GstFormat" "format") - '("gint64" "start") - '("gint64" "stop") - '("gint64" "time") - ) -) - -(define-method to_stream_time - (of-object "GstSegment") - (c-name "gst_segment_to_stream_time") - (return-type "gint64") - (parameters - '("GstFormat" "format") - '("gint64" "position") - ) -) - -(define-method to_running_time - (of-object "GstSegment") - (c-name "gst_segment_to_running_time") - (return-type "gint64") - (parameters - '("GstFormat" "format") - '("gint64" "position") - ) -) - -(define-method to_position - (of-object "GstSegment") - (c-name "gst_segment_to_position") - (return-type "gint64") - (parameters - '("GstFormat" "format") - '("gint64" "running_time") - ) -) - -(define-method clip - (of-object "GstSegment") - (c-name "gst_segment_clip") - (return-type "gboolean") - (parameters - '("GstFormat" "format") - '("gint64" "start") - '("gint64" "stop") - '("gint64*" "clip_start") - '("gint64*" "clip_stop") - ) -) - -(define-method set_running_time - (of-object "GstSegment") - (c-name "gst_segment_set_running_time") - (return-type "gboolean") - (parameters - '("GstFormat" "format") - '("gint64" "running_time") - ) -) - - - -;; From ../gstreamer/gst/gststructure.h - -(define-function structure_get_type - (c-name "gst_structure_get_type") - (return-type "GType") -) - -(define-function structure_empty_new - (c-name "gst_structure_empty_new") - (is-constructor-of "GstStructureEmpty") - (return-type "GstStructure*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function structure_id_empty_new - (c-name "gst_structure_id_empty_new") - (is-constructor-of "GstStructureIdEmpty") - (return-type "GstStructure*") - (parameters - '("GQuark" "quark") - ) -) - -(define-function structure_new - (c-name "gst_structure_new") - (is-constructor-of "GstStructure") - (return-type "GstStructure*") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "firstfield") - ) - (varargs #t) -) - -(define-function structure_new_valist - (c-name "gst_structure_new_valist") - (return-type "GstStructure*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "name") - '("const-gchar*" "firstfield") - '("va_list" "varargs") - ) -) - -(define-function gst_structure_id_new - (c-name "gst_structure_id_new") - (is-constructor-of "GstStructureId") - (return-type "GstStructure*") - (parameters - '("GQuark" "name_quark") - '("GQuark" "field_quark") - ) - (varargs #t) -) - -(define-method copy - (of-object "GstStructure") - (c-name "gst_structure_copy") - (return-type "GstStructure*") - (caller-owns-return #t) -) - -(define-method set_parent_refcount - (of-object "GstStructure") - (c-name "gst_structure_set_parent_refcount") - (return-type "none") - (parameters - '("gint*" "refcount") - ) -) - -(define-method free - (of-object "GstStructure") - (c-name "gst_structure_free") - (return-type "none") -) - -(define-method get_name - (of-object "GstStructure") - (c-name "gst_structure_get_name") - (return-type "const-gchar*") -) - -(define-method get_name_id - (of-object "GstStructure") - (c-name "gst_structure_get_name_id") - (return-type "GQuark") -) - -(define-method has_name - (of-object "GstStructure") - (c-name "gst_structure_has_name") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method set_name - (of-object "GstStructure") - (c-name "gst_structure_set_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method id_set_value - (of-object "GstStructure") - (c-name "gst_structure_id_set_value") - (return-type "none") - (parameters - '("GQuark" "field") - '("const-GValue*" "value") - ) -) - -(define-method set_value - (of-object "GstStructure") - (c-name "gst_structure_set_value") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - '("const-GValue*" "value") - ) -) - -(define-method id_take_value - (of-object "GstStructure") - (c-name "gst_structure_id_take_value") - (return-type "none") - (parameters - '("GQuark" "field") - '("GValue*" "value") - ) -) - -(define-method take_value - (of-object "GstStructure") - (c-name "gst_structure_take_value") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - '("GValue*" "value") - ) -) - -(define-method set - (of-object "GstStructure") - (c-name "gst_structure_set") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - ) - (varargs #t) -) - -(define-method set_valist - (of-object "GstStructure") - (c-name "gst_structure_set_valist") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - '("va_list" "varargs") - ) -) - -(define-method id_set - (of-object "GstStructure") - (c-name "gst_structure_id_set") - (return-type "none") - (parameters - '("GQuark" "fieldname") - ) - (varargs #t) -) - -(define-method id_set_valist - (of-object "GstStructure") - (c-name "gst_structure_id_set_valist") - (return-type "none") - (parameters - '("GQuark" "fieldname") - '("va_list" "varargs") - ) -) - -(define-method get_valist - (of-object "GstStructure") - (c-name "gst_structure_get_valist") - (return-type "gboolean") - (parameters - '("const-char*" "first_fieldname") - '("va_list" "args") - ) -) - -(define-method get - (of-object "GstStructure") - (c-name "gst_structure_get") - (return-type "gboolean") - (parameters - '("const-char*" "first_fieldname") - ) - (varargs #t) -) - -(define-method id_get_valist - (of-object "GstStructure") - (c-name "gst_structure_id_get_valist") - (return-type "gboolean") - (parameters - '("GQuark" "first_field_id") - '("va_list" "args") - ) -) - -(define-method id_get - (of-object "GstStructure") - (c-name "gst_structure_id_get") - (return-type "gboolean") - (parameters - '("GQuark" "first_field_id") - ) - (varargs #t) -) - -(define-method id_get_value - (of-object "GstStructure") - (c-name "gst_structure_id_get_value") - (return-type "const-GValue*") - (parameters - '("GQuark" "field") - ) -) - -(define-method get_value - (of-object "GstStructure") - (c-name "gst_structure_get_value") - (return-type "const-GValue*") - (parameters - '("const-gchar*" "fieldname") - ) -) - -(define-method remove_field - (of-object "GstStructure") - (c-name "gst_structure_remove_field") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - ) -) - -(define-method remove_fields - (of-object "GstStructure") - (c-name "gst_structure_remove_fields") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - ) - (varargs #t) -) - -(define-method remove_fields_valist - (of-object "GstStructure") - (c-name "gst_structure_remove_fields_valist") - (return-type "none") - (parameters - '("const-gchar*" "fieldname") - '("va_list" "varargs") - ) -) - -(define-method remove_all_fields - (of-object "GstStructure") - (c-name "gst_structure_remove_all_fields") - (return-type "none") -) - -(define-method get_field_type - (of-object "GstStructure") - (c-name "gst_structure_get_field_type") - (return-type "GType") - (parameters - '("const-gchar*" "fieldname") - ) -) - -(define-method foreach - (of-object "GstStructure") - (c-name "gst_structure_foreach") - (return-type "gboolean") - (parameters - '("GstStructureForeachFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method map_in_place - (of-object "GstStructure") - (c-name "gst_structure_map_in_place") - (return-type "gboolean") - (parameters - '("GstStructureMapFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method n_fields - (of-object "GstStructure") - (c-name "gst_structure_n_fields") - (return-type "gint") -) - -(define-method nth_field_name - (of-object "GstStructure") - (c-name "gst_structure_nth_field_name") - (return-type "const-gchar*") - (parameters - '("guint" "index") - ) -) - -(define-method id_has_field - (of-object "GstStructure") - (c-name "gst_structure_id_has_field") - (return-type "gboolean") - (parameters - '("GQuark" "field") - ) -) - -(define-method id_has_field_typed - (of-object "GstStructure") - (c-name "gst_structure_id_has_field_typed") - (return-type "gboolean") - (parameters - '("GQuark" "field") - '("GType" "type") - ) -) - -(define-method has_field - (of-object "GstStructure") - (c-name "gst_structure_has_field") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - ) -) - -(define-method has_field_typed - (of-object "GstStructure") - (c-name "gst_structure_has_field_typed") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("GType" "type") - ) -) - -(define-method keys - (of-object "GstStructure") - (c-name "gst_structure_keys") - (return-type "GList*") -) - - -(define-method get_boolean - (of-object "GstStructure") - (c-name "gst_structure_get_boolean") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("gboolean*" "value") - ) -) - -(define-method get_int - (of-object "GstStructure") - (c-name "gst_structure_get_int") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("gint*" "value") - ) -) - -(define-method get_uint - (of-object "GstStructure") - (c-name "gst_structure_get_uint") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("guint*" "value") - ) -) - -(define-method get_fourcc - (of-object "GstStructure") - (c-name "gst_structure_get_fourcc") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("guint32*" "value") - ) -) - -(define-method get_double - (of-object "GstStructure") - (c-name "gst_structure_get_double") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("gdouble*" "value") - ) -) - -(define-method get_date - (of-object "GstStructure") - (c-name "gst_structure_get_date") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("GDate**" "value") - ) -) - -(define-method get_clock_time - (of-object "GstStructure") - (c-name "gst_structure_get_clock_time") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("GstClockTime*" "value") - ) -) - -(define-method get_string - (of-object "GstStructure") - (c-name "gst_structure_get_string") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "fieldname") - ) -) - -(define-method get_enum - (of-object "GstStructure") - (c-name "gst_structure_get_enum") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("GType" "enumtype") - '("gint*" "value") - ) -) - -(define-method get_fraction - (of-object "GstStructure") - (c-name "gst_structure_get_fraction") - (return-type "gboolean") - (parameters - '("const-gchar*" "fieldname") - '("gint*" "value_numerator") - '("gint*" "value_denominator") - ) -) - -(define-method to_string - (of-object "GstStructure") - (c-name "gst_structure_to_string") - (return-type "gchar*") -) - -(define-function structure_from_string - (c-name "gst_structure_from_string") - (return-type "GstStructure*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "string") - '("gchar**" "end") - ) -) - -(define-method fixate_field_nearest_int - (of-object "GstStructure") - (c-name "gst_structure_fixate_field_nearest_int") - (return-type "gboolean") - (parameters - '("const-char*" "field_name") - '("int" "target") - ) -) - -(define-method fixate_field_nearest_double - (of-object "GstStructure") - (c-name "gst_structure_fixate_field_nearest_double") - (return-type "gboolean") - (parameters - '("const-char*" "field_name") - '("double" "target") - ) -) - -(define-method fixate_field_boolean - (of-object "GstStructure") - (c-name "gst_structure_fixate_field_boolean") - (return-type "gboolean") - (parameters - '("const-char*" "field_name") - '("gboolean" "target") - ) -) - -(define-method fixate_field_string - (of-object "GstStructure") - (c-name "gst_structure_fixate_field_string") - (return-type "gboolean") - (parameters - '("const-char*" "field_name") - '("const-gchar*" "target") - ) -) - -(define-method fixate_field_nearest_fraction - (of-object "GstStructure") - (c-name "gst_structure_fixate_field_nearest_fraction") - (return-type "gboolean") - (parameters - '("const-char*" "field_name") - '("const-gint" "target_numerator") - '("const-gint" "target_denominator") - ) -) - - -;; From ../gstreamer/gst/gstsystemclock.h - -(define-function system_clock_get_type - (c-name "gst_system_clock_get_type") - (return-type "GType") -) - -(define-function system_clock_obtain - (c-name "gst_system_clock_obtain") - (return-type "GstClock*") - (caller-owns-return #t) -) - - - -;; From ../gstreamer/gst/gsttag.h - -(define-function tag_list_get_type - (c-name "gst_tag_list_get_type") - (return-type "GType") -) - -(define-function tag_register - (c-name "gst_tag_register") - (return-type "none") - (parameters - '("const-gchar*" "name") - '("GstTagFlag" "flag") - '("GType" "type") - '("const-gchar*" "nick") - '("const-gchar*" "blurb") - '("GstTagMergeFunc" "func") - ) -) - -(define-function tag_merge_use_first - (c-name "gst_tag_merge_use_first") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "src") - ) -) - -(define-function tag_merge_strings_with_comma - (c-name "gst_tag_merge_strings_with_comma") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "src") - ) -) - -(define-function tag_exists - (c-name "gst_tag_exists") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_get_tag_type - (c-name "gst_tag_get_tag_type") - (return-type "GType") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_get_nick - (c-name "gst_tag_get_nick") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_get_description - (c-name "gst_tag_get_description") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_get_flag - (c-name "gst_tag_get_flag") - (return-type "GstTagFlag") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_is_fixed - (c-name "gst_tag_is_fixed") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-function tag_list_new - (c-name "gst_tag_list_new") - (is-constructor-of "GstTagList") - (return-type "GstTagList*") -) - -(define-function is_tag_list - (c-name "gst_is_tag_list") - (return-type "gboolean") - (parameters - '("gconstpointer" "p") - ) -) - -(define-method copy - (of-object "GstTagList") - (c-name "gst_tag_list_copy") - (return-type "GstTagList*") - (caller-owns-return #t) -) - -(define-method is_empty - (of-object "GstTagList") - (c-name "gst_tag_list_is_empty") - (return-type "gboolean") -) - -(define-method insert - (of-object "GstTagList") - (c-name "gst_tag_list_insert") - (return-type "none") - (parameters - '("const-GstTagList*" "from") - '("GstTagMergeMode" "mode") - ) -) - -(define-method merge - (of-object "GstTagList") - (c-name "gst_tag_list_merge") - (return-type "GstTagList*") - (caller-owns-return #t) - (parameters - '("const-GstTagList*" "list2") - '("GstTagMergeMode" "mode") - ) -) - -(define-method free - (of-object "GstTagList") - (c-name "gst_tag_list_free") - (return-type "none") -) - -(define-method get_tag_size - (of-object "GstTagList") - (c-name "gst_tag_list_get_tag_size") - (return-type "guint") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-method add - (of-object "GstTagList") - (c-name "gst_tag_list_add") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - ) - (varargs #t) -) - -(define-method add_values - (of-object "GstTagList") - (c-name "gst_tag_list_add_values") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - ) - (varargs #t) -) - -(define-method add_valist - (of-object "GstTagList") - (c-name "gst_tag_list_add_valist") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") - ) -) - -(define-method add_valist_values - (of-object "GstTagList") - (c-name "gst_tag_list_add_valist_values") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") - ) -) - -(define-method add_value - (of-object "GstTagList") - (c-name "gst_tag_list_add_value") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("const-GValue*" "value") - ) -) - -(define-method remove_tag - (of-object "GstTagList") - (c-name "gst_tag_list_remove_tag") - (return-type "none") - (parameters - '("const-gchar*" "tag") - ) -) - -(define-method foreach - (of-object "GstTagList") - (c-name "gst_tag_list_foreach") - (return-type "none") - (parameters - '("GstTagForeachFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-method get_value_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_value_index") - (return-type "const-GValue*") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - ) -) - -(define-function tag_list_copy_value - (c-name "gst_tag_list_copy_value") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-GstTagList*" "list") - '("const-gchar*" "tag") - ) -) - -(define-method get_char - (of-object "GstTagList") - (c-name "gst_tag_list_get_char") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gchar*" "value") - ) -) - -(define-method get_char_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_char_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gchar*" "value") - ) -) - -(define-method get_uchar - (of-object "GstTagList") - (c-name "gst_tag_list_get_uchar") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guchar*" "value") - ) -) - -(define-method get_uchar_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_uchar_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("guchar*" "value") - ) -) - -(define-method get_boolean - (of-object "GstTagList") - (c-name "gst_tag_list_get_boolean") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gboolean*" "value") - ) -) - -(define-method get_boolean_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_boolean_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gboolean*" "value") - ) -) - -(define-method get_int - (of-object "GstTagList") - (c-name "gst_tag_list_get_int") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gint*" "value") - ) -) - -(define-method get_int_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_int_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gint*" "value") - ) -) - -(define-method get_uint - (of-object "GstTagList") - (c-name "gst_tag_list_get_uint") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint*" "value") - ) -) - -(define-method get_uint_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_uint_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("guint*" "value") - ) -) - -(define-method get_long - (of-object "GstTagList") - (c-name "gst_tag_list_get_long") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("glong*" "value") - ) -) - -(define-method get_long_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_long_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("glong*" "value") - ) -) - -(define-method get_ulong - (of-object "GstTagList") - (c-name "gst_tag_list_get_ulong") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gulong*" "value") - ) -) - -(define-method get_ulong_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_ulong_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gulong*" "value") - ) -) - -(define-method get_int64 - (of-object "GstTagList") - (c-name "gst_tag_list_get_int64") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gint64*" "value") - ) -) - -(define-method get_int64_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_int64_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gint64*" "value") - ) -) - -(define-method get_uint64 - (of-object "GstTagList") - (c-name "gst_tag_list_get_uint64") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint64*" "value") - ) -) - -(define-method get_uint64_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_uint64_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("guint64*" "value") - ) -) - -(define-method get_float - (of-object "GstTagList") - (c-name "gst_tag_list_get_float") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gfloat*" "value") - ) -) - -(define-method get_float_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_float_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gfloat*" "value") - ) -) - -(define-method get_double - (of-object "GstTagList") - (c-name "gst_tag_list_get_double") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gdouble*" "value") - ) -) - -(define-method get_double_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_double_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gdouble*" "value") - ) -) - -(define-method get_string - (of-object "GstTagList") - (c-name "gst_tag_list_get_string") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gchar**" "value") - ) -) - -(define-method get_string_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_string_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gchar**" "value") - ) -) - -(define-method peek_string_index - (of-object "GstTagList") - (c-name "gst_tag_list_peek_string_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("const-gchar**" "value") - ) -) - -(define-method get_pointer - (of-object "GstTagList") - (c-name "gst_tag_list_get_pointer") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("gpointer*" "value") - ) -) - -(define-method get_pointer_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_pointer_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("gpointer*" "value") - ) -) - -(define-method get_date - (of-object "GstTagList") - (c-name "gst_tag_list_get_date") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("GDate**" "value") - ) -) - -(define-method get_date_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_date_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("GDate**" "value") - ) -) - -(define-method get_buffer - (of-object "GstTagList") - (c-name "gst_tag_list_get_buffer") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("GstBuffer**" "value") - ) -) - -(define-method get_buffer_index - (of-object "GstTagList") - (c-name "gst_tag_list_get_buffer_index") - (return-type "gboolean") - (parameters - '("const-gchar*" "tag") - '("guint" "index") - '("GstBuffer**" "value") - ) -) - -;; From ../gstreamer/gst/gsttaginterface.h - -(define-function tag_setter_get_type - (c-name "gst_tag_setter_get_type") - (return-type "GType") -) - -(define-method reset_tags - (of-object "GstTagSetter") - (c-name "gst_tag_setter_reset_tags") - (return-type "none") -) - -(define-method merge_tags - (of-object "GstTagSetter") - (c-name "gst_tag_setter_merge_tags") - (return-type "none") - (parameters - '("const-GstTagList*" "list") - '("GstTagMergeMode" "mode") - ) -) - -(define-method add_tags - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_tags") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - ) - (varargs #t) -) - -(define-method add_tag_values - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_tag_values") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - ) - (varargs #t) -) - -(define-method add_tag_valist - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_tag_valist") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") - ) -) - -(define-method add_tag_valist_values - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_tag_valist_values") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") - ) -) - -(define-method add_tag_value - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_tag_value") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("const-GValue*" "value") - ) -) - -(define-method get_tag_list - (of-object "GstTagSetter") - (c-name "gst_tag_setter_get_tag_list") - (return-type "const-GstTagList*") -) - -(define-method set_tag_merge_mode - (of-object "GstTagSetter") - (c-name "gst_tag_setter_set_tag_merge_mode") - (return-type "none") - (parameters - '("GstTagMergeMode" "mode") - ) -) - -(define-method get_tag_merge_mode - (of-object "GstTagSetter") - (c-name "gst_tag_setter_get_tag_merge_mode") - (return-type "GstTagMergeMode") -) - - - -;; From ../gstreamer/gst/gsttask.h - -(define-function task_get_type - (c-name "gst_task_get_type") - (return-type "GType") -) - -(define-function task_create - (c-name "gst_task_create") - (return-type "GstTask*") - (parameters - '("GstTaskFunction" "func") - '("gpointer" "data") - ) -) - -(define-method set_lock - (of-object "GstTask") - (c-name "gst_task_set_lock") - (return-type "none") - (parameters - '("GStaticRecMutex*" "mutex") - ) -) - -(define-method set_priority - (of-object "GstTask") - (c-name "gst_task_set_priority") - (return-type "none") - (parameters - '("GThreadPriority" "priority") - ) -) - -(define-method get_pool - (of-object "GstTask") - (c-name "gst_task_get_pool") - (return-type "GstTaskPool*") -) - -(define-method set_pool - (of-object "GstTask") - (c-name "gst_task_set_pool") - (return-type "none") - (parameters - '("GstTaskPool*" "pool") - ) -) - -(define-method set_thread_callbacks - (of-object "GstTask") - (c-name "gst_task_set_thread_callbacks") - (return-type "none") - (parameters - '("GstTaskThreadCallbacks*" "callbacks") - '("gpointer" "user_data") - '("GDestroyNotify" "notify") - ) -) - -(define-method get_state - (of-object "GstTask") - (c-name "gst_task_get_state") - (return-type "GstTaskState") -) - -(define-method set_state - (of-object "GstTask") - (c-name "gst_task_set_state") - (return-type "gboolean") - (parameters - '("GstTaskState" "state") - ) -) - -(define-method start - (of-object "GstTask") - (c-name "gst_task_start") - (return-type "gboolean") -) - -(define-method stop - (of-object "GstTask") - (c-name "gst_task_stop") - (return-type "gboolean") -) - -(define-method pause - (of-object "GstTask") - (c-name "gst_task_pause") - (return-type "gboolean") -) - -;; From gsttaskpool.h - -(define-function gst_task_pool_get_type - (c-name "gst_task_pool_get_type") - (return-type "GType") -) - -(define-function gst_task_pool_new - (c-name "gst_task_pool_new") - (is-constructor-of "GstTaskPool") - (return-type "GstTaskPool*") -) - -(define-method prepare - (of-object "GstTaskPool") - (c-name "gst_task_pool_prepare") - (return-type "none") - (parameters - '("GError**" "error") - ) -) - -(define-method push - (of-object "GstTaskPool") - (c-name "gst_task_pool_push") - (return-type "gpointer") - (parameters - '("GstTaskPoolFunction" "func") - '("gpointer" "user_data") - '("GError**" "error") - ) -) - -(define-method join - (of-object "GstTaskPool") - (c-name "gst_task_pool_join") - (return-type "none") - (parameters - '("gpointer" "id") - ) -) - -(define-method cleanup - (of-object "GstTaskPool") - (c-name "gst_task_pool_cleanup") - (return-type "none") -) - -;; From ../gstreamer/gst/gsttrace.h - -(define-function trace_new - (c-name "gst_trace_new") - (is-constructor-of "GstTrace") - (return-type "GstTrace*") - (parameters - '("gchar*" "filename") - '("gint" "size") - ) -) - -(define-method destroy - (of-object "GstTrace") - (c-name "gst_trace_destroy") - (return-type "none") -) - -(define-method flush - (of-object "GstTrace") - (c-name "gst_trace_flush") - (return-type "none") -) - -(define-method text_flush - (of-object "GstTrace") - (c-name "gst_trace_text_flush") - (return-type "none") -) - -(define-method set_default - (of-object "GstTrace") - (c-name "gst_trace_set_default") - (return-type "none") -) - -(define-function trace_read_tsc - (c-name "gst_trace_read_tsc") - (return-type "none") - (parameters - '("gint64*" "dst") - ) -) - -(define-function alloc_trace_available - (c-name "gst_alloc_trace_available") - (return-type "gboolean") -) - -(define-function alloc_trace_list - (c-name "gst_alloc_trace_list") - (return-type "const-GList*") -) - -(define-function alloc_trace_live_all - (c-name "gst_alloc_trace_live_all") - (return-type "int") -) - -(define-function alloc_trace_print_all - (c-name "gst_alloc_trace_print_all") - (return-type "none") -) - -(define-function alloc_trace_print_live - (c-name "gst_alloc_trace_print_live") - (return-type "none") -) - -(define-function alloc_trace_set_flags_all - (c-name "gst_alloc_trace_set_flags_all") - (return-type "none") - (parameters - '("GstAllocTraceFlags" "flags") - ) -) - -(define-function alloc_trace_get - (c-name "gst_alloc_trace_get") - (return-type "GstAllocTrace*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method print - (of-object "GstAllocTrace") - (c-name "gst_alloc_trace_print") - (return-type "none") -) - -(define-method set_flags - (of-object "GstAllocTrace") - (c-name "gst_alloc_trace_set_flags") - (return-type "none") - (parameters - '("GstAllocTraceFlags" "flags") - ) -) - - - -;; From ../gstreamer/gst/gsttypefind.h - -(define-function type_find_new - (c-name "gst_type_find_new") - (return-type "GstTypeFind*") -) - -(define-method peek - (of-object "GstTypeFind") - (c-name "gst_type_find_peek") - (return-type "guint8*") - (parameters - '("gint64" "offset") - '("guint" "size") - ) -) - -(define-method suggest - (of-object "GstTypeFind") - (c-name "gst_type_find_suggest") - (return-type "none") - (parameters - '("guint" "probability") - '("const-GstCaps*" "caps") - ) -) - -(define-method suggest_simple - (of-object "GstTypeFind") - (c-name "gst_type_find_suggest_simple") - (return-type "none") - (parameters - '("guint" "probability") - '("const-char*" "media_type") - '("const-char*" "fieldname") - ) - (varargs #t) -) - -(define-method get_length - (of-object "GstTypeFind") - (c-name "gst_type_find_get_length") - (return-type "guint64") -) - -(define-function type_find_register - (c-name "gst_type_find_register") - (return-type "gboolean") - (parameters - '("GstPlugin*" "plugin") - '("const-gchar*" "name") - '("guint" "rank") - '("GstTypeFindFunction" "func") - '("gchar**" "extensions") - '("const-GstCaps*" "possible_caps") - '("gpointer" "data") - '("GDestroyNotify" "data_notify") - ) -) - -(define-function type_find_factory_get_type - (c-name "gst_type_find_factory_get_type") - (return-type "GType") -) - -(define-function type_find_factory_get_list - (c-name "gst_type_find_factory_get_list") - (return-type "GList*") -) - -(define-method get_extensions - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_get_extensions") - (return-type "GStrv") -) - -(define-method get_caps - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_get_caps") - (return-type "GstCaps*") -) - -(define-method call_function - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_call_function") - (return-type "none") - (parameters - '("GstTypeFind*" "find") - ) -) - - -;; From ../gstreamer/gst/gsturi.h - -(define-function uri_protocol_is_valid - (c-name "gst_uri_protocol_is_valid") - (return-type "gboolean") - (parameters - '("const-gchar*" "protocol") - ) -) - -(define-function uri_protocol_is_supported - (c-name "gst_uri_protocol_is_supported") - (return-type "gboolean") - (parameters - '("GstURIType" "type") - '("const-gchar*" "protocol") - ) -) - -(define-function uri_is_valid - (c-name "gst_uri_is_valid") - (return-type "gboolean") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-function uri_get_protocol - (c-name "gst_uri_get_protocol") - (return-type "gchar*") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-function uri_has_protocol - (c-name "gst_uri_has_protocol") - (return-type "gboolean") - (parameters - '("const-gchar*" "uri") - '("const-gchar*" "protocol") - ) -) - -(define-function uri_get_location - (c-name "gst_uri_get_location") - (return-type "gchar*") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-function uri_construct - (c-name "gst_uri_construct") - (return-type "gchar*") - (parameters - '("const-gchar*" "protocol") - '("const-gchar*" "location") - ) -) - -(define-function filename_to_uri - (c-name "gst_filename_to_uri") - (return-type "gchar*") - (parameters - '("const-gchar*" "uri") - '("GError**" "error") - ) -) - -(define-function element_make_from_uri - (c-name "gst_element_make_from_uri") - (return-type "GstElement*") - (parameters - '("GstURIType" "type") - '("const-gchar*" "uri") - '("const-gchar*" "elementname" (null-ok) (default "NULL")) - ) -) - -(define-function uri_handler_get_type - (c-name "gst_uri_handler_get_type") - (return-type "GType") -) - -(define-method get_uri_type - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_uri_type") - (return-type "GstURIType") -) - -(define-method get_protocols - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_protocols") - (return-type "GStrv") -) - -(define-method get_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_uri") - (return-type "const-gchar*") -) - -(define-method set_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_set_uri") - (return-type "gboolean") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-method new_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_new_uri") - (return-type "none") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-virtual get_type_full - (of-object "GstURIHandler") - (parameters - '("GType" "type") - ) - (return-type "guint") -) - -(define-virtual get_protocols_full - (of-object "GstURIHandler") - (parameters - '("GType" "type") - ) - (return-type "GStrv") -) - -(define-virtual get_uri - (of-object "GstURIHandler") - (return-type "const-gchar*") -) - -(define-virtual set_uri - (of-object "GstURIHandler") - (return-type "gboolean") - (parameters - '("const-gchar*" "uri") - ) -) - -;; From ../gstreamer/gst/gstutils.h - -(define-function util_set_value_from_string - (c-name "gst_util_set_value_from_string") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-gchar*" "value_str") - ) -) - -(define-function util_set_object_arg - (c-name "gst_util_set_object_arg") - (return-type "none") - (parameters - '("GObject*" "object") - '("const-gchar*" "name") - '("const-gchar*" "value") - ) -) - -(define-function util_dump_mem - (c-name "gst_util_dump_mem") - (return-type "none") - (parameters - '("const-guchar*" "mem") - '("guint" "size") - ) -) - -(define-function util_gdouble_to_guint64 - (c-name "gst_util_gdouble_to_guint64") - (return-type "guint64") - (parameters - '("gdouble" "value") - ) -) - -(define-function util_guint64_to_gdouble - (c-name "gst_util_guint64_to_gdouble") - (return-type "gdouble") - (parameters - '("guint64" "value") - ) -) - -(define-function util_uint64_scale - (c-name "gst_util_uint64_scale") - (return-type "guint64") - (parameters - '("guint64" "val") - '("guint64" "num") - '("guint64" "denom") - ) -) - -(define-function util_uint64_scale_round - (c-name "gst_util_uint64_scale_round") - (return-type "guint64") - (parameters - '("guint64" "val") - '("guint64" "num") - '("guint64" "denom") - ) -) - -(define-function util_uint64_scale_ceil - (c-name "gst_util_uint64_scale_ceil") - (return-type "guint64") - (parameters - '("guint64" "val") - '("guint64" "num") - '("guint64" "denom") - ) -) - -(define-function util_uint64_scale_int - (c-name "gst_util_uint64_scale_int") - (return-type "guint64") - (parameters - '("guint64" "val") - '("gint" "num") - '("gint" "denom") - ) -) - -(define-function util_uint64_scale_int_round - (c-name "gst_util_uint64_scale_int_round") - (return-type "guint64") - (parameters - '("guint64" "val") - '("gint" "num") - '("gint" "denom") - ) -) - -(define-function util_uint64_scale_int_ceil - (c-name "gst_util_uint64_scale_int_ceil") - (return-type "guint64") - (parameters - '("guint64" "val") - '("gint" "num") - '("gint" "denom") - ) -) - -(define-function util_seqnum_next - (c-name "gst_util_seqnum_next") - (return-type "guint32") -) - -(define-function util_seqnum_compare - (c-name "gst_util_seqnum_compare") - (return-type "gint32") - (parameters - '("guint32" "s1") - '("guint32" "s2") - ) -) - -(define-function print_pad_caps - (c-name "gst_print_pad_caps") - (return-type "none") - (parameters - '("GString*" "buf") - '("gint" "indent") - '("GstPad*" "pad") - ) -) - -(define-function print_element_args - (c-name "gst_print_element_args") - (return-type "none") - (parameters - '("GString*" "buf") - '("gint" "indent") - '("GstElement*" "element") - ) -) - -(define-method default_error - (of-object "GstObject") - (c-name "gst_object_default_error") - (return-type "none") - (parameters - '("GError*" "error") - '("gchar*" "debug") - ) -) - -(define-method create_all_pads - (of-object "GstElement") - (c-name "gst_element_create_all_pads") - (return-type "none") -) - -(define-method get_compatible_pad - (of-object "GstElement") - (c-name "gst_element_get_compatible_pad") - (return-type "GstPad*") - (parameters - '("GstPad*" "pad") - '("const-GstCaps*" "caps" (null-ok) (default "NULL")) - ) -) - -(define-method get_compatible_pad_template - (of-object "GstElement") - (c-name "gst_element_get_compatible_pad_template") - (return-type "GstPadTemplate*") - (parameters - '("GstPadTemplate*" "compattempl") - ) -) - -(define-method get_name - (of-object "GstState") - (c-name "gst_element_state_get_name") - (return-type "const-gchar*") -) - -(define-function element_state_get_name - (c-name "gst_element_state_get_name") - (parameters - '("GstState" "state") - ) - (return-type "const-gchar*") -) - -(define-function state_change_return_get_name - (c-name "gst_element_state_change_return_get_name") - (return-type "const-gchar*") - (parameters - '("GstStateChangeReturn" "state_ret") - ) -) - -(define-method link - (of-object "GstElement") - (c-name "gst_element_link") - (return-type "gboolean") - (parameters - '("GstElement*" "dest") - ) -) - -(define-function element_link_many - (c-name "gst_element_link_many") - (return-type "gboolean") - (parameters - '("GstElement*" "element_1") - '("GstElement*" "element_2") - ) - (varargs #t) -) - -(define-method unlink - (of-object "GstElement") - (c-name "gst_element_unlink") - (return-type "none") - (parameters - '("GstElement*" "dest") - ) -) - -(define-method link_filtered - (of-object "GstElement") - (c-name "gst_element_link_filtered") - (return-type "gboolean") - (parameters - '("GstElement*" "dest") - '("GstCaps*" "filter") - ) -) - -(define-function element_unlink_many - (c-name "gst_element_unlink_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - '("GstElement*" "element_2") - ) - (varargs #t) -) - -(define-method link_pads - (of-object "GstElement") - (c-name "gst_element_link_pads") - (return-type "gboolean") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - ) -) - -(define-method link_pads_full - (of-object "GstElement") - (c-name "gst_element_link_pads_full") - (return-type "gboolean") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - '("GstPadLinkCheck" "flags") - ) -) - -(define-method unlink_pads - (of-object "GstElement") - (c-name "gst_element_unlink_pads") - (return-type "none") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - ) -) - -(define-method link_pads_filtered - (of-object "GstElement") - (c-name "gst_element_link_pads_filtered") - (return-type "gboolean") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - '("GstCaps*" "filter") - ) -) - -(define-method seek_simple - (of-object "GstElement") - (c-name "gst_element_seek_simple") - (return-type "gboolean") - (parameters - '("GstFormat" "format") - '("GstSeekFlags" "seek_flags") - '("gint64" "seek_pos") - ) -) - -(define-method can_src_caps - (of-object "GstElementFactory") - (c-name "gst_element_factory_can_src_caps") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-method can_sink_caps - (of-object "GstElementFactory") - (c-name "gst_element_factory_can_sink_caps") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps") - ) -) - - -(define-method query_position - (of-object "GstElement") - (c-name "gst_element_query_position") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "cur") - ) -) - -(define-method query_duration - (of-object "GstElement") - (c-name "gst_element_query_duration") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "duration") - ) -) - -(define-method query_convert - (of-object "GstElement") - (c-name "gst_element_query_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_val") - '("GstFormat*" "dest_fmt") - '("gint64*" "dest_val") - ) -) - -(define-method install_std_props - (of-object "GstElementClass") - (c-name "gst_element_class_install_std_props") - (return-type "none") - (parameters - '("const-gchar*" "first_name") - ) - (varargs #t) -) - -(define-method can_link - (of-object "GstPad") - (c-name "gst_pad_can_link") - (return-type "gboolean") - (parameters - '("GstPad*" "sinkpad") - ) -) - -(define-method use_fixed_caps - (of-object "GstPad") - (c-name "gst_pad_use_fixed_caps") - (return-type "none") -) - -(define-method get_fixed_caps_func - (of-object "GstPad") - (c-name "gst_pad_get_fixed_caps_func") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method proxy_getcaps - (of-object "GstPad") - (c-name "gst_pad_proxy_getcaps") - (return-type "GstCaps*") - (caller-owns-return #t) -) - -(define-method proxy_setcaps - (of-object "GstPad") - (c-name "gst_pad_proxy_setcaps") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method get_parent_element - (of-object "GstPad") - (c-name "gst_pad_get_parent_element") - (return-type "GstElement*") - (caller-owns-return #t) -) - -(define-method query_position - (of-object "GstPad") - (c-name "gst_pad_query_position") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "cur") - ) -) - -(define-method query_duration - (of-object "GstPad") - (c-name "gst_pad_query_duration") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "duration") - ) -) - -(define-method query_convert - (of-object "GstPad") - (c-name "gst_pad_query_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_val") - '("GstFormat*" "dest_fmt") - '("gint64*" "dest_val") - ) -) - -(define-method query_peer_position - (of-object "GstPad") - (c-name "gst_pad_query_peer_position") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "cur") - ) -) - -(define-method query_peer_duration - (of-object "GstPad") - (c-name "gst_pad_query_peer_duration") - (return-type "gboolean") - (parameters - '("GstFormat*" "format") - '("gint64*" "duration") - ) -) - -(define-method query_peer_convert - (of-object "GstPad") - (c-name "gst_pad_query_peer_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_val") - '("GstFormat*" "dest_format") - '("gint64*" "dest_val") - ) -) - -(define-method remove_many - (of-object "GstBin") - (c-name "gst_bin_remove_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - -(define-method find_unlinked_pad - (of-object "GstBin") - (c-name "gst_bin_find_unlinked_pad") - (return-type "GstPad*") - (parameters - '("GstPadDirection" "direction") - ) -) - -(define-method find_unconnected_pad - (of-object "GstBin") - (c-name "gst_bin_find_unconnected_pad") - (return-type "GstPad*") - (parameters - '("GstPadDirection" "direction") - ) -) - -(define-method merge - (of-object "GstBuffer") - (c-name "gst_buffer_merge") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("GstBuffer*" "buf2") - ) -) - -(define-method join - (of-object "GstBuffer") - (c-name "gst_buffer_join") - (return-type "GstBuffer*") - (caller-owns-return #t) - (parameters - '("GstBuffer*" "buf2") - ) -) - -(define-method stamp - (of-object "GstBuffer") - (c-name "gst_buffer_stamp") - (return-type "none") - (parameters - '("const-GstBuffer*" "src") - ) -) - -(define-function atomic_int_set - (c-name "gst_atomic_int_set") - (return-type "none") - (parameters - '("gint*" "atomic_int") - '("gint" "value") - ) -) - -(define-function TIME_ARGS - (c-name "GST_TIME_ARGS") - (return-type "gchar*") - (parameters - '("GstClockTime" "time") - ) -) - -;; From ../gstreamer/gst/gstvalue.h - -(define-function value_register - (c-name "gst_value_register") - (return-type "none") - (parameters - '("const-GstValueTable*" "table") - ) -) - -(define-function value_init_and_copy - (c-name "gst_value_init_and_copy") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "src") - ) -) - -(define-function value_serialize - (c-name "gst_value_serialize") - (return-type "gchar*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_deserialize - (c-name "gst_value_deserialize") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-gchar*" "src") - ) -) - -(define-function value_list_append_value - (c-name "gst_value_list_append_value") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GValue*" "append_value") - ) -) - -(define-function value_list_prepend_value - (c-name "gst_value_list_prepend_value") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GValue*" "prepend_value") - ) -) - -(define-function value_list_concat - (c-name "gst_value_list_concat") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_list_merge - (c-name "gst_value_list_merge") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_list_get_size - (c-name "gst_value_list_get_size") - (return-type "guint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_list_get_value - (c-name "gst_value_list_get_value") - (return-type "const-GValue*") - (parameters - '("const-GValue*" "value") - '("guint" "index") - ) -) - -(define-function value_array_append_value - (c-name "gst_value_array_append_value") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GValue*" "append_value") - ) -) - -(define-function value_array_prepend_value - (c-name "gst_value_array_prepend_value") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GValue*" "prepend_value") - ) -) - -(define-function value_array_get_size - (c-name "gst_value_array_get_size") - (return-type "guint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_array_get_value - (c-name "gst_value_array_get_value") - (return-type "const-GValue*") - (parameters - '("const-GValue*" "value") - '("guint" "index") - ) -) - -(define-function value_set_fourcc - (c-name "gst_value_set_fourcc") - (return-type "none") - (parameters - '("GValue*" "value") - '("guint32" "fourcc") - ) -) - -(define-function value_get_fourcc - (c-name "gst_value_get_fourcc") - (return-type "guint32") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_set_int_range - (c-name "gst_value_set_int_range") - (return-type "none") - (parameters - '("GValue*" "value") - '("gint" "start") - '("gint" "end") - ) -) - -(define-function value_get_int_range_min - (c-name "gst_value_get_int_range_min") - (return-type "gint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_int_range_max - (c-name "gst_value_get_int_range_max") - (return-type "gint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_set_int64_range - (c-name "gst_value_set_int64_range") - (return-type "none") - (parameters - '("GValue*" "value") - '("gint64" "start") - '("gint64" "end") - ) -) - -(define-function value_get_int64_range_min - (c-name "gst_value_get_int64_range_min") - (return-type "gint64") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_int64_range_max - (c-name "gst_value_get_int64_range_max") - (return-type "gint64") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_set_double_range - (c-name "gst_value_set_double_range") - (return-type "none") - (parameters - '("GValue*" "value") - '("gdouble" "start") - '("gdouble" "end") - ) -) - -(define-function value_get_double_range_min - (c-name "gst_value_get_double_range_min") - (return-type "gdouble") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_double_range_max - (c-name "gst_value_get_double_range_max") - (return-type "gdouble") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_caps - (c-name "gst_value_get_caps") - (return-type "const-GstCaps*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_set_caps - (c-name "gst_value_set_caps") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GstCaps*" "caps") - ) -) - -(define-function value_set_fraction - (c-name "gst_value_set_fraction") - (return-type "none") - (parameters - '("GValue*" "value") - '("gint" "numerator") - '("gint" "denominator") - ) -) - -(define-function value_get_fraction_numerator - (c-name "gst_value_get_fraction_numerator") - (return-type "gint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_fraction_denominator - (c-name "gst_value_get_fraction_denominator") - (return-type "gint") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_fraction_multiply - (c-name "gst_value_fraction_multiply") - (return-type "gboolean") - (parameters - '("GValue*" "product") - '("const-GValue*" "factor1") - '("const-GValue*" "factor2") - ) -) - -(define-function gst_value_fraction_subtract - (c-name "gst_value_fraction_subtract") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-GValue*" "minuend") - '("const-GValue*" "subtrahend") - ) -) - -(define-function gst_value_set_fraction_range - (c-name "gst_value_set_fraction_range") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GValue*" "start") - '("const-GValue*" "end") - ) -) - -(define-function gst_value_set_fraction_range_full - (c-name "gst_value_set_fraction_range_full") - (return-type "none") - (parameters - '("GValue*" "value") - '("gint" "numerator_start") - '("gint" "denominator_start") - '("gint" "numerator_end") - '("gint" "denominator_end") - ) -) - -(define-function gst_value_get_fraction_range_min - (c-name "gst_value_get_fraction_range_min") - (return-type "const-GValue*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function gst_value_get_fraction_range_max - (c-name "gst_value_get_fraction_range_max") - (return-type "const-GValue*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_get_date - (c-name "gst_value_get_date") - (return-type "const-GDate*") - (parameters - '("const-GValue*" "value") - ) -) - -(define-function value_set_date - (c-name "gst_value_set_date") - (return-type "none") - (parameters - '("GValue*" "value") - '("const-GDate*" "date") - ) -) - -(define-function value_compare - (c-name "gst_value_compare") - (return-type "gint") - (parameters - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_can_compare - (c-name "gst_value_can_compare") - (return-type "gboolean") - (parameters - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_union - (c-name "gst_value_union") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_can_union - (c-name "gst_value_can_union") - (return-type "gboolean") - (parameters - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_register_union_func - (c-name "gst_value_register_union_func") - (return-type "none") - (parameters - '("GType" "type1") - '("GType" "type2") - '("GstValueUnionFunc" "func") - ) -) - -(define-function value_intersect - (c-name "gst_value_intersect") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_can_intersect - (c-name "gst_value_can_intersect") - (return-type "gboolean") - (parameters - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_register_intersect_func - (c-name "gst_value_register_intersect_func") - (return-type "none") - (parameters - '("GType" "type1") - '("GType" "type2") - '("GstValueIntersectFunc" "func") - ) -) - -(define-function value_subtract - (c-name "gst_value_subtract") - (return-type "gboolean") - (parameters - '("GValue*" "dest") - '("const-GValue*" "minuend") - '("const-GValue*" "subtrahend") - ) -) - -(define-function value_can_subtract - (c-name "gst_value_can_subtract") - (return-type "gboolean") - (parameters - '("const-GValue*" "minuend") - '("const-GValue*" "subtrahend") - ) -) - -(define-function value_register_subtract_func - (c-name "gst_value_register_subtract_func") - (return-type "none") - (parameters - '("GType" "minuend_type") - '("GType" "subtrahend_type") - '("GstValueSubtractFunc" "func") - ) -) - -(define-function value_is_fixed - (c-name "gst_value_is_fixed") - (return-type "gboolean") - (parameters - '("const-GValue*" "value") - ) -) - - -;; From ../gstreamer/gst/gstxml.h - -(define-function xml_get_type - (c-name "gst_xml_get_type") - (return-type "GType") -) - -(define-function xml_write - (c-name "gst_xml_write") - (return-type "xmlDocPtr") - (parameters - '("GstElement*" "element") - ) -) - -(define-function xml_write_file - (c-name "gst_xml_write_file") - (return-type "gint") - (parameters - '("GstElement*" "element") - '("FILE*" "out") - ) -) - -(define-function xml_new - (c-name "gst_xml_new") - (is-constructor-of "GstXML") - (return-type "GstXML*") -) - -(define-method parse_doc - (of-object "GstXML") - (c-name "gst_xml_parse_doc") - (return-type "gboolean") - (parameters - '("xmlDocPtr" "doc") - '("const-guchar*" "root") - ) -) - -(define-method parse_file - (of-object "GstXML") - (c-name "gst_xml_parse_file") - (return-type "gboolean") - (parameters - '("const-guchar*" "fname") - '("const-guchar*" "root") - ) -) - -(define-method parse_memory - (of-object "GstXML") - (c-name "gst_xml_parse_memory") - (return-type "gboolean") - (parameters - '("guchar*" "buffer") - '("guint" "size") - '("const-gchar*" "root") - ) -) - -(define-method get_element - (of-object "GstXML") - (c-name "gst_xml_get_element") - (return-type "GstElement*") - (parameters - '("const-guchar*" "name") - ) -) - -(define-method get_topelements - (of-object "GstXML") - (c-name "gst_xml_get_topelements") - (return-type "GList*") -) - -(define-function xml_make_element - (c-name "gst_xml_make_element") - (return-type "GstElement*") - (parameters - '("xmlNodePtr" "cur") - '("GstObject*" "parent") - ) -) - - -;; From ../gstreamer/gst/net/gstnetclientclock.h - -(define-function net_client_clock_new - (c-name "gst_net_client_clock_new") - (is-constructor-of "GstNetClientClock") - (return-type "GstClock*") - (parameters - '("gchar*" "name" (null-ok) (default "NULL")) - '("gchar*" "remote_address" (default "127.0.0.1")) - '("gint" "remote_port") - '("GstClockTime" "base_time" (default 0)) - ) -) - - -;; From ../gstreamer/gst/net/gstnettimeprovider.h - -(define-function net_time_provider_new - (c-name "gst_net_time_provider_new") - (is-constructor-of "GstNetTimeProvider") - (return-type "GstNetTimeProvider*") - (parameters - '("GstClock*" "clock") - '("gchar*" "address" (null-ok) (default "NULL")) - '("gint" "port" (default 0)) - ) -) diff --git a/gst/gst.override b/gst/gst.override deleted file mode 100644 index f1ee02e464..0000000000 --- a/gst/gst.override +++ /dev/null @@ -1,1748 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2002 David I. Lehn - * Copyright (C) 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 - */ -%% -headers -/* define this for all source files that don't run init_pygobject() - * before including pygobject.h */ -#define NO_IMPORT_PYGOBJECT - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "common.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "pygst-private.h" -#include "pygstvalue.h" -#include "pygstminiobject.h" -#include "pygstexception.h" - -/* These headers have been included directly to get around multiple - * GetAttrString calls */ -#include -#include - -/* Boonky define that allows for backwards compatibility with Python 2.4 */ -#if PY_VERSION_HEX < 0x02050000 -#define Py_ssize_t int -#endif - -GST_DEBUG_CATEGORY_EXTERN (python_debug); -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/* This function checks if a former Python code threw an exception and if - * so, transforms this exception into an error on the given GstElement. - * This allows code run on the element to just raise an exception instead of - * returning GStreamer specific return values. - * The exception is cleared afterwards. - */ -gboolean -_pygst_element_check_error (GstElement *element) -{ - PyObject *type, *value, *traceback, *lineno, *msg, *typemsg; - PyFrameObject *frame; - - if (!PyErr_Occurred()) - return FALSE; - - PyErr_Fetch (&type, &value, &traceback); - if (traceback) { - frame = (PyFrameObject *) PyObject_GetAttrString (traceback, "tb_frame"); - lineno = PyObject_GetAttrString (traceback, "tb_lineno"); - } else { - frame = NULL; - lineno = NULL; - } - msg = PyObject_Str (value); - typemsg = PyObject_Str (type); - if (msg && PyString_Check (msg)) { - gst_element_message_full (element, GST_MESSAGE_ERROR, - GST_LIBRARY_ERROR, - GST_LIBRARY_ERROR_FAILED, - g_strdup (PyString_AsString (msg)), - typemsg ? g_strconcat (PyString_AsString (typemsg), - ": ", PyString_AsString (msg), NULL) - : g_strdup (PyString_AsString (msg)), - frame ? PyString_AsString(frame->f_code->co_filename) : "???", - frame ? PyString_AsString(frame->f_code->co_name) : "???", - lineno ? PyInt_AsLong (lineno) : 0); - } else { - gst_element_message_full (element, GST_MESSAGE_ERROR, - GST_LIBRARY_ERROR, - GST_LIBRARY_ERROR_TOO_LAZY, - NULL, NULL, - frame ? PyString_AsString(frame->f_code->co_filename) : "???", - frame ? PyString_AsString(frame->f_code->co_name) : "???", - lineno ? PyInt_AsLong (lineno) : 0); - } - - PyErr_Clear (); - Py_XDECREF (frame); - Py_XDECREF (lineno); - Py_DECREF (msg); - Py_DECREF (typemsg); - - return TRUE; -} - -PyTypeObject PyGstPadTemplate_Type; -static int -add_templates (gpointer gclass, PyObject *templates) -{ - gint i, len; - PyGObject *templ; - - GST_DEBUG ("Adding templates to gclass %p", gclass); - if (pygobject_check(templates, &PyGstPadTemplate_Type)) { - gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (pygobject_get (templates))); - return 0; - } - - if (!PyTuple_Check(templates)) { - PyErr_SetString(PyExc_TypeError, "__gsttemplates__ attribute neither a tuple nor a GstPadTemplate!"); - return -1; - } - len = PyTuple_Size(templates); - if (len == 0) - return 0; - - for (i = 0; i < len; i++) { - templ = (PyGObject*) PyTuple_GetItem(templates, i); - if (!pygobject_check(templ, &PyGstPadTemplate_Type)) { - PyErr_SetString(PyExc_TypeError, "entries for __gsttemplates__ must be of type GstPadTemplate"); - return -1; - } - } - - for (i = 0; i < len; i++) { - templ = (PyGObject*) PyTuple_GetItem(templates, i); - gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (templ->obj)); - } - return 0; -} - -static int -_pygst_element_set_details (gpointer gclass, PyObject *details) -{ - GstElementDetails gstdetails = { 0, }; - - if (!PyTuple_Check (details)) { - PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be a tuple"); - return -1; - } - if (PyTuple_Size (details) != 4) { - PyErr_SetString(PyExc_TypeError, "__gstdetails__ must contain 4 elements"); - return -1; - } - if (!PyArg_ParseTuple (details, "ssss", &gstdetails.longname, &gstdetails.klass, - &gstdetails.description, &gstdetails.author)) { - PyErr_SetString (PyExc_TypeError, "__gstdetails__ must contain 4 strings"); - return -1; - } - GST_DEBUG ("setting details on gclass %p from __gstdetails__, longname %s", gclass, gstdetails.longname); - gst_element_class_set_details (gclass, &gstdetails); - return 0; -} - -static int -_pygst_element_init (gpointer gclass, PyTypeObject *pyclass) -{ - PyObject *templates, *details; - - GST_DEBUG ("_pygst_element_init for gclass %p", gclass); - templates = PyDict_GetItemString(pyclass->tp_dict, "__gsttemplates__"); - if (templates) { - if (add_templates(gclass, templates) != 0) - return -1; - } else { - PyErr_Clear(); - } - details = PyDict_GetItemString(pyclass->tp_dict, "__gstdetails__"); - if (details) { - if (_pygst_element_set_details (gclass, details) != 0) - return -1; - PyDict_DelItemString(pyclass->tp_dict, "__gstdetails__"); - } else { - PyErr_Clear(); - } - - return 0; -} - -static PyObject * -pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level, - gboolean isgstobject) -{ -#ifndef GST_DISABLE_GST_DEBUG - gchar *str; - gchar *function; - gchar *filename; - int lineno; - PyFrameObject *frame; - GObject *object = NULL; - - if (!PyArg_ParseTuple(string, "s:gst.debug_log", &str)) { - PyErr_SetString(PyExc_TypeError, "Need a string!"); - return NULL; - } - - frame = PyEval_GetFrame(); - function = PyString_AsString(frame->f_code->co_name); - filename = g_path_get_basename(PyString_AsString(frame->f_code->co_filename)); - lineno = PyCode_Addr2Line(frame->f_code, frame->f_lasti); - /* gst_debug_log : category, level, file, function, line, object, format, va_list */ - if (isgstobject) - object = G_OBJECT (pygobject_get (pyobject)); - gst_debug_log (python_debug, level, filename, function, lineno, object, "%s", str); - if (filename) - g_free(filename); -#endif - Py_INCREF (Py_None); - return Py_None; -} - -GType -gst_tag_get_tag_type (const gchar * tag) -{ - return gst_tag_get_type (tag); -} - -%% -include - gstbin.override - gstbuffer.override - gstbus.override - gstcaps.override - gstelement.override - gstelementfactory.override - gstevent.override - gstmessage.override - gstobject.override - gstpad.override - gstquery.override - gststructure.override - gsttaglist.override - gstlibs.override - gstbase.override - gstversion.override -%% -init -{ - pyg_register_class_init (GST_TYPE_ELEMENT, _pygst_element_init); - if (!pygst_value_init()) - return; - gst_controller_init(NULL, NULL); -} -%% -modulename gst -%% -import gobject.GObject as PyGObject_Type -%% -ignore-glob - _* - *_copy - *_error_quark - *_free - *_get_type - *_private - *_thyself - *_valist - *_ref - *_unref - *_deinit - gst_class_* - gst_init* - gst_interface_* - gst_value_* - gst_param_spec_* -%% -ignore - gst_alloc_trace_list - gst_alloc_trace_get - gst_error_get_message - gst_parse_launchv - gst_trace_read_tsc - gst_debug_log_default - gst_iterator_new_list - gst_task_set_lock - gst_clock_id_compare_func - gst_print_pad_caps - gst_util_set_value_from_string - gst_print_element_args - gst_atomic_int_set - gst_caps_replace - gst_mini_object_replace - gst_filter_run - gst_flow_to_quark - gst_implements_interface_cast - gst_implements_interface_check - gst_plugin_get_module - gst_object_sink - gst_version -%% -override-slot GstPluginFeature.tp_repr -static PyObject * -_wrap_gst_plugin_feature_tp_repr(PyObject *self) -{ - gchar *repr; - PyObject *ret; - GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self)); - - repr = g_strdup_printf ("<%s %s @ 0x%lx>", - self->ob_type->tp_name, gst_plugin_feature_get_name (feature), - (long) self); - ret = PyString_FromString(repr); - g_free (repr); - return ret; -} -%% -override-slot GstPluginFeature.tp_str -static PyObject * -_wrap_gst_plugin_feature_tp_str(PyObject *self) -{ - gchar *repr; - PyObject *ret; - GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self)); - - repr = g_strdup_printf ("<%s %s (%d)>", - self->ob_type->tp_name, gst_plugin_feature_get_name (feature), - gst_plugin_feature_get_rank (feature)); - ret = PyString_FromString(repr); - g_free (repr); - return ret; -} - -%% -override gst_type_find_factory_get_caps noargs -static PyObject * -_wrap_gst_type_find_factory_get_caps(PyGObject *self) -{ - GstCaps *ret = (GstCaps*)gst_type_find_factory_get_caps(GST_TYPE_FIND_FACTORY(self->obj)); - return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE); -} -%% -override-attr GError.domain -static PyObject * -_wrap_gst_g_error__get_domain(PyGObject *self, void *closure) -{ - return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain)); -} -%% -override-slot GError.tp_str -static PyObject * -_wrap_gst_g_error_tp_str(PyGObject *self) -{ - GError *error = (GError*)self->obj; - return PyString_FromString(gst_error_get_message (error->domain, - error->code)); -} -%% -override-attr GstDate.day -static PyObject * -_wrap_gst_date__get_day(PyGObject *self, void *closure) -{ - return PyInt_FromLong(g_date_get_day((GDate*)self->obj)); -} - -static int -_wrap_gst_date__set_day(PyGObject *self, PyObject *value, void *closure) -{ - GDate *date = (GDate *) self->obj; - - if (!(PyInt_Check(value))) - return -1; - - g_date_set_day(date, (int) PyInt_AsLong(value)); - return 0; -} -%% -override-attr GstDate.month -static PyObject * -_wrap_gst_date__get_month(PyGObject *self, void *closure) -{ - return PyInt_FromLong(g_date_get_month((GDate*)self->obj)); -} -static int -_wrap_gst_date__set_month(PyGObject *self, PyObject *value, void *closure) -{ - GDate *date = (GDate *) self->obj; - - if (!(PyInt_Check(value))) - return -1; - - g_date_set_month(date, (int) PyInt_AsLong(value)); - return 0; -} -%% -override-attr GstDate.year -static PyObject * -_wrap_gst_date__get_year(PyGObject *self, void *closure) -{ - return PyInt_FromLong(g_date_get_year((GDate*)self->obj)); -} -static int -_wrap_gst_date__set_year(PyGObject *self, PyObject *value, void *closure) -{ - GDate *date = (GDate *) self->obj; - - if (!(PyInt_Check(value))) - return -1; - - g_date_set_year(date, (int) PyInt_AsLong(value)); - return 0; -} -%% -override-slot GstDate.tp_repr -static PyObject * -_wrap_gst_date_tp_repr(PyGObject *self) -{ - GDate *date = (GDate *) self->obj; - - return PyString_FromFormat ("", - g_date_get_day(date), - g_date_get_month(date), - g_date_get_year(date)); -} -%% -override gst_registry_get_path_list -static PyObject * -_wrap_gst_registry_get_path_list (PyGObject *self) -{ - GstRegistry *registry; - GList *l, *paths; - PyObject *list; - gint i; - - registry = GST_REGISTRY (self->obj); - - paths = gst_registry_get_path_list (registry); - - list = PyList_New (g_list_length(paths)); - for (l = paths, i = 0; l; l = l->next, ++i) { - gchar *path = (gchar *) l->data; - PyList_SetItem (list, i, PyString_FromString(path)); - } - g_list_free (paths); - - return list; -} - -%% -override gst_registry_get_plugin_list -static PyObject * -_wrap_gst_registry_get_plugin_list (PyGObject *self) -{ - GstRegistry *registry; - GList *l, *plugins; - PyObject *list; - gint i; - - registry = GST_REGISTRY (self->obj); - - plugins = gst_registry_get_plugin_list (registry); - - list = PyList_New (g_list_length(plugins)); - for (l = plugins, i = 0; l; l = l->next, ++i) { - GstPlugin *plugin = (GstPlugin *) l->data; - PyObject *object = pygobject_new (G_OBJECT (plugin)); - gst_object_unref (plugin); - - PyList_SetItem (list, i, object); - } - g_list_free (plugins); - - return list; -} - -%% -override gst_registry_get_feature_list kwargs -static PyObject * -_wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "type", NULL }; - PyObject *py_type = NULL; - GType type; - - GstRegistry *registry; - GList *l, *features; - PyObject *list; - gint i; - - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O:GstRegistry.get_feature_list", kwlist, &py_type)) - return NULL; - if ((type = pyg_type_from_object(py_type)) == 0) - return NULL; - - registry = GST_REGISTRY (self->obj); - - pyg_begin_allow_threads; - features = gst_registry_get_feature_list (registry, type); - pyg_end_allow_threads; - - list = PyList_New (g_list_length(features)); - for (l = features, i = 0; l; l = l->next, ++i) { - GstPluginFeature *feature = (GstPluginFeature *) l->data; - PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature))); - gst_object_unref (feature); - } - g_list_free (features); - - return list; -} - -%% -override gst_registry_get_feature_list_by_plugin kwargs -static PyObject * -_wrap_gst_registry_get_feature_list_by_plugin (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", NULL }; - gchar * name = NULL; - - GstRegistry *registry; - GList *l, *features; - PyObject *list; - gint i; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "s:GstRegistry.get_feature_list_by_plugin", kwlist, &name)) - return NULL; - - registry = GST_REGISTRY (self->obj); - - pyg_begin_allow_threads; - features = gst_registry_get_feature_list_by_plugin (registry, name); - pyg_end_allow_threads; - - list = PyList_New (g_list_length(features)); - for (l = features, i = 0; l; l = l->next, ++i) { - GstPluginFeature *feature = (GstPluginFeature *) l->data; - PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature))); - } - g_list_free (features); - - return list; -} - -%% -new-constructor GST_TYPE_XML -%% -override gst_xml_new noargs - -extern PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc); -extern PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node); - -/* libxml2 available check */ -static PyObject * -_gst_get_libxml2_module(void) -{ - PyObject *xml = NULL; - - xml = PyImport_ImportModule("libxml2"); - if (!xml) { - PyErr_Clear(); - PyErr_SetString(PyExc_RuntimeError,"libxml2 bindings required"); - return NULL; - } - - return xml; - } - -static int -_wrap_gst_xml_new(PyGObject *self) -{ - PyObject *xml = _gst_get_libxml2_module(); - - if(!xml) - return -1; - - self->obj = (GObject *)gst_xml_new(); - - if (!self->obj) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstXML object"); - return -1; - } - - pygobject_register_wrapper((PyObject *)self); - - return 0; -} -%% -override gst_xml_get_topelements noargs -static PyObject * -_wrap_gst_xml_get_topelements(PyGObject *self) -{ - GList *l, *xml_elements; - PyObject *py_list; - gint i; - - xml_elements = gst_xml_get_topelements(GST_XML(self->obj)); - py_list = PyList_New(g_list_length(xml_elements)); - for (l = xml_elements, i = 0; l; l = l->next, ++i) { - GstElement *element = (GstElement*)l->data; - PyList_SetItem(py_list, i, pygobject_new(G_OBJECT(element))); - } - - return py_list; -} -%% -override gst_xml_parse_memory kwargs -static PyObject * -_wrap_gst_xml_parse_memory(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "buffer", "root", NULL }; - int buffer_len, ret; - char *root = NULL; - guchar *buffer; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "s#|s:GstXML.parse_memory", - kwlist, &buffer, &buffer_len, &root)) - return NULL; - - ret = gst_xml_parse_memory(GST_XML(self->obj), - buffer, buffer_len, root); - - return PyBool_FromLong(ret); -} -%% -override gst_tag_setter_get_tag_list noargs -static PyObject * -_wrap_gst_tag_setter_get_tag_list(PyGObject *self) -{ - GstTagList *ret; - - ret = (GstTagList*)gst_tag_setter_get_tag_list(GST_TAG_SETTER(self->obj)); - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_TAG_LIST, ret, TRUE, TRUE); -} -%% -override gst_element_register kwargs - -static GstPlugin * -_pygst_get_plugin(void) -{ - PyObject *dict = NULL, *module = NULL, *pyplugin = NULL; - GstPlugin *ret; - - if (!(module = PyImport_ImportModule ("gst"))) - goto err; - if (!(dict = PyModule_GetDict (module))) - goto err; - if (!(pyplugin = PyDict_GetItemString (dict, "__plugin__"))) - goto err; - ret = pyg_boxed_get (pyplugin, GstPlugin); - - Py_DECREF (module); - return ret; - -err: - Py_XDECREF (module); - PyErr_Clear (); - return NULL; -} - -static PyObject * -_wrap_gst_element_register(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "type", "elementname", "rank", NULL }; - PyObject *py_type = NULL; - guint rank = GST_RANK_NONE; - char *elementname = NULL; - int ret; - GType type; - - /* FIXME: can we make the name optional, too? Anyone know a good default? */ - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|I:element_register", kwlist, - &py_type, &elementname, &rank)) - return NULL; - if ((type = pyg_type_from_object(py_type)) == 0) - return NULL; - - ret = gst_element_register(_pygst_get_plugin(), elementname, rank, type); - return PyBool_FromLong(ret); -} -%% -override-attr GError.domain -static PyObject * -_wrap_gst_g_error__get_domain(PyGObject *self, void *closure) -{ - return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain)); -} -%% -override-slot GError.tp_str -static PyObject * -_wrap_gst_g_error_tp_str(PyGObject *self) -{ - GError *error = (GError*)self->obj; - return PyString_FromString(gst_error_get_message (error->domain, - error->code)); -} -%% -override gst_flow_get_name kwargs -static PyObject * -_wrap_gst_flow_get_name(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "ret", NULL }; - PyObject *py_ret = NULL; - const gchar *ret; - GstFlowReturn flow; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gst_flow_get_name", kwlist, &py_ret)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_FLOW_RETURN, py_ret, (gint *)&flow)) - return NULL; - if ((ret = gst_flow_get_name(flow))) { - return PyString_FromString(ret); - } - Py_INCREF(Py_None); - return Py_None; -} - -%% -override gst_debug_log args -static PyObject * -_wrap_gst_debug_log (PyObject *whatever, PyObject *string) -{ -#ifndef GST_DISABLE_GST_DEBUG - gchar *filename; - gchar *func; - gint lineno; - gchar *message; - - PyObject *py_level = NULL; - GstDebugLevel level; - - if (!PyArg_ParseTuple(string, "Ossis:gst.debug_log", &py_level, &filename, &func, &lineno, &message)) { - return NULL; - } - if (pyg_enum_get_value(GST_TYPE_DEBUG_LEVEL, py_level, (gint *)&level)) { - return NULL; - } - - /* gst_debug_log : category, level, file, function, line, object, format, va_list */ - gst_debug_log (python_debug, level, filename, func, lineno, NULL, "%s", message); -#endif - Py_INCREF (Py_None); - return Py_None; -} -%% -override gst_log args -static PyObject * -_wrap_gst_log (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_LOG, FALSE); -} -%% -override gst_debug args -static PyObject * -_wrap_gst_debug (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, FALSE); -} -%% -override gst_info args -static PyObject * -_wrap_gst_info (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_INFO, FALSE); -} -%% -override gst_warning args -static PyObject * -_wrap_gst_warning (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, FALSE); -} -%% -override gst_error args -static PyObject * -_wrap_gst_error (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, FALSE); -} -%% -override gst_fixme args -static PyObject * -_wrap_gst_fixme (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_FIXME, FALSE); -} -%% -override gst_memdump args -static PyObject * -_wrap_gst_memdump (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_MEMDUMP, FALSE); -} - -%% -override gst_object_log args -static PyObject * -_wrap_gst_object_log (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_LOG, TRUE); -} -%% -override gst_object_debug args -static PyObject * -_wrap_gst_object_debug (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, TRUE); -} -%% -override gst_object_info args -static PyObject * -_wrap_gst_object_info (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_INFO, TRUE); -} -%% -override gst_object_warning args -static PyObject * -_wrap_gst_object_warning (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, TRUE); -} -%% -override gst_object_error args -static PyObject * -_wrap_gst_object_error (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, TRUE); -} -%% -override gst_object_fixme args -static PyObject * -_wrap_gst_object_fixme (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_FIXME, TRUE); -} -%% -override gst_object_memdump args -static PyObject * -_wrap_gst_object_memdump (PyObject *whatever, PyObject *string) -{ - return pygst_debug_log (whatever, string, GST_LEVEL_MEMDUMP, TRUE); -} -%% -override GST_TIME_ARGS kwargs -static PyObject * -_wrap_GST_TIME_ARGS(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "time", NULL }; - PyObject *py_time = NULL; - PyObject *string; - gchar *ret; - guint64 time; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:time_to_string", kwlist, &py_time)) - return NULL; - time = PyInt_AsUnsignedLongLongMask(py_time); - if (PyErr_Occurred ()) - return NULL; - - if (GST_CLOCK_TIME_IS_VALID (time)) - ret = g_strdup_printf("%"GST_TIME_FORMAT, GST_TIME_ARGS(time)); - else - ret = g_strdup ("CLOCK_TIME_NONE"); - - if (!ret) { - Py_INCREF(Py_None); - return Py_None; - } - - if (!(string = PyString_FromString(ret))) { - g_free(ret); - return NULL; - } - g_free(ret); - return string; -} -%% -override gst_type_find_factory_get_list noargs -static PyObject * -_wrap_gst_type_find_factory_get_list (PyObject *self) -{ - GList *l, *list; - PyObject *py_list; - int i = 0; - - list = gst_type_find_factory_get_list (); - - py_list = PyList_New(g_list_length(list)); - for (l = list; l ; l = g_list_next(l), i++) { - GstTypeFindFactory *fact = (GstTypeFindFactory*) l->data; - - PyList_SetItem(py_list, i, - pygobject_new (G_OBJECT (fact))); - } - g_list_free (list); - - return py_list; -} -%% -override gst_get_gst_version noargs -static PyObject * -_wrap_gst_get_gst_version (PyObject *self) -{ - guint major, minor, micro, nano; - PyObject *py_tuple; - - gst_version (&major, &minor, µ, &nano); - py_tuple = PyTuple_New(4); - PyTuple_SetItem(py_tuple, 0, PyInt_FromLong(major)); - PyTuple_SetItem(py_tuple, 1, PyInt_FromLong(minor)); - PyTuple_SetItem(py_tuple, 2, PyInt_FromLong(micro)); - PyTuple_SetItem(py_tuple, 3, PyInt_FromLong(nano)); - - return py_tuple; -} -%% -override gst_get_pygst_version noargs -static PyObject * -_wrap_gst_get_pygst_version (PyObject *self) -{ - PyObject *py_tuple; - - py_tuple = Py_BuildValue ("(iiii)", PYGST_MAJOR_VERSION, PYGST_MINOR_VERSION, - PYGST_MICRO_VERSION, PYGST_NANO_VERSION); - - return py_tuple; -} -%% -override gst_clock_get_calibration noargs -static PyObject * -_wrap_gst_clock_get_calibration (PyGObject * self) -{ - PyObject *ret; - GstClockTime internal; - GstClockTime external; - GstClockTime rate_num; - GstClockTime rate_denom; - - gst_clock_get_calibration (GST_CLOCK (self->obj), - &internal, - &external, - &rate_num, - &rate_denom); - - ret = PyTuple_New(4); - PyTuple_SetItem(ret, 0, PyLong_FromUnsignedLongLong(internal)); - PyTuple_SetItem(ret, 1, PyLong_FromUnsignedLongLong(external)); - PyTuple_SetItem(ret, 2, PyLong_FromUnsignedLongLong(rate_num)); - PyTuple_SetItem(ret, 3, PyLong_FromUnsignedLongLong(rate_denom)); - - return ret; -} -%% -override gst_clock_add_observation kwargs -static PyObject * -_wrap_gst_clock_add_observation (PyGObject *self, PyObject * args, PyObject * kwargs) -{ - static char *kwlist[] = { "slave", "master", NULL}; - GstClockTime master, slave; - gdouble squared = 1.0; - PyObject *py_ret; - gboolean ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "KK:GstClock.add_observation", - kwlist, &master, &slave)) - return NULL; - - ret = gst_clock_add_observation (GST_CLOCK (self->obj), master, slave, - &squared); - - py_ret = PyList_New(2); - PyList_SetItem(py_ret, 0, PyBool_FromLong(ret)); - PyList_SetItem(py_ret, 1, PyFloat_FromDouble(squared)); - return py_ret; -} - -%% -override gst_type_find_helper_for_buffer kwargs -static PyObject * -_wrap_gst_type_find_helper_for_buffer (PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "object", "buffer", NULL }; - PyGObject *py_object; - PyGstMiniObject *py_buffer; - PyObject *py_ret; - GstTypeFindProbability prob = 0; - GstCaps *caps = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:type_find_helper_for_buffer", - kwlist, &PyGstObject_Type, &py_object, - &PyGstBuffer_Type, &py_buffer)) - return NULL; - - caps = gst_type_find_helper_for_buffer (GST_OBJECT (py_object->obj), - GST_BUFFER (py_buffer->obj), - &prob); - py_ret = PyTuple_New(2); - if (caps) - PyTuple_SetItem(py_ret, 0, pyg_boxed_new (GST_TYPE_CAPS, caps, FALSE, TRUE)); - else { - Py_INCREF(Py_None); - PyTuple_SetItem(py_ret, 0, Py_None); - } - - if (prob) - PyTuple_SetItem(py_ret, 1, pyg_enum_from_gtype(GST_TYPE_TYPE_FIND_PROBABILITY, prob)); - else { - Py_INCREF(Py_None); - PyTuple_SetItem(py_ret, 1, Py_None); - } - - return py_ret; -} -%% -override gst_type_find_new kwargs - -static guint8 * -gst_type_find_peek_handler (gpointer data, gint64 offset, guint size) -{ - PyGILState_STATE state; - guint8 * ret = NULL; - PyObject *py_data; - PyObject *callback, *args; - PyObject *py_ret; - - GST_DEBUG ("mkay"); - - g_return_val_if_fail (data != NULL, NULL); - py_data = (PyObject *) data; - g_assert (PyTuple_Check (py_data)); - - state = pyg_gil_state_ensure (); - - /* Figure out the callback and create the arguments */ - if (!(callback = PyTuple_GetItem(py_data, 1))) - goto beach; - - args = Py_BuildValue ("(OLI)", - PyTuple_GetItem(py_data, 0), - offset, size); - if (!args) - goto beach; - - /* Call python method */ - py_ret = PyObject_CallObject (callback, args); - - /* transform return value (a string) */ - if (!py_ret) { - Py_DECREF (args); - goto beach; - } - if (!PyString_Check(py_ret)) { - Py_DECREF (py_ret); - Py_DECREF (args); - goto beach; - } else { - gchar *str; - Py_ssize_t len; - - if ((PyString_AsStringAndSize(py_ret, &str, &len)) == -1) { - Py_DECREF (py_ret); - Py_DECREF (args); - goto beach; - } - GST_DEBUG ("got string of len %"G_GSSIZE_FORMAT, len); - if (len) - ret = g_memdup((gconstpointer) str, (guint) len); - } - Py_DECREF (py_ret); - Py_DECREF (args); - - beach: - pyg_gil_state_release (state); - return ret; -} - -static void -gst_type_find_suggest_handler (gpointer data, guint probability, const GstCaps * caps) -{ - PyGILState_STATE state; - PyObject *py_data; - PyObject *callback, *args; - - GST_DEBUG ("mkay"); - - if (!data) - return; - py_data = (PyObject *) data; - g_assert (PyTuple_Check (py_data)); - - state = pyg_gil_state_ensure (); - - /* Figure out the callback and create the arguments */ - if (!(callback = PyTuple_GetItem(py_data, 2))) - goto beach; - - args = Py_BuildValue ("(OIN)", - PyTuple_GetItem(py_data, 0), - probability, pyg_boxed_new (GST_TYPE_CAPS, (GstCaps*) caps, TRUE, TRUE)); - if (!args) - goto beach; - - /* Call python method */ - PyObject_CallObject (callback, args); - - Py_DECREF (args); - - beach: - pyg_gil_state_release (state); - return; -} - -static guint64 -gst_type_find_get_length_handler (gpointer data) -{ - guint64 ret = 0; - - /* Call python method */ - return ret; -} - -static PyObject * -_wrap_gst_type_find_new (PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "data", "peekfunction", "suggestfunction", "getlengthfunction", NULL }; - PyObject *py_data; - gpointer data; - PyObject *peekfunction; - PyObject *suggestfunction; - PyObject *getlengthfunction = NULL; - PyObject *pytypefind = NULL; - GstTypeFind *typefind = NULL; - - GST_DEBUG ("poeut"); - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO|O:type_find_new", - kwlist, &py_data, &peekfunction, - &suggestfunction, &getlengthfunction)) { - PyErr_SetString (PyExc_TypeError, "Error parsing values ..."); - return NULL; - } - - if (!PyCallable_Check(peekfunction)) { - PyErr_SetString (PyExc_TypeError, "peekfunction is not callable"); - return NULL; - } - if (!PyCallable_Check(suggestfunction)) { - PyErr_SetString (PyExc_TypeError, "suggestfunction is not callable"); - return NULL; - } - if (getlengthfunction && (!PyCallable_Check(suggestfunction))) { - PyErr_SetString (PyExc_TypeError, "getlengthfunction is not callable"); - return NULL; - } - - /* Create a python list to put in typefind->data */ - if (getlengthfunction) - data = Py_BuildValue("(OOOO)", py_data, peekfunction, suggestfunction, getlengthfunction); - else - data = Py_BuildValue("(OOO)", py_data, peekfunction, suggestfunction); - - typefind = g_new0(GstTypeFind, 1); - typefind->peek = gst_type_find_peek_handler; - typefind->suggest = gst_type_find_suggest_handler; - typefind->data = data; - if (getlengthfunction) - typefind->get_length = gst_type_find_get_length_handler; - - pytypefind = pyg_pointer_new (GST_TYPE_TYPE_FIND, typefind); - - if (!pytypefind) { - PyErr_SetString (PyExc_TypeError, "pyg_pointer_new failed"); - } - - GST_DEBUG ("poeut : %p", pytypefind); - - return pytypefind; -} - -%% -override gst_type_find_register args - -static void -type_find_function (GstTypeFind *find, gpointer user_data) -{ - PyGILState_STATE state; - PyObject *data; - PyObject *callback, *args, *old_args; - PyObject *typefind; - - state = pyg_gil_state_ensure (); - - typefind = pyg_pointer_new(GST_TYPE_TYPE_FIND, find); - - data = (PyObject *) user_data; - callback = PyTuple_GET_ITEM(data, 0); - args = Py_BuildValue("(O)", typefind); - if (PyTuple_GET_SIZE(data) > 1) { - old_args = args; - args = PySequence_Concat(args, PyTuple_GET_ITEM(data, 1)); - Py_DECREF(old_args); - } - - PyObject_CallObject(callback, args); - - Py_DECREF(args); - Py_DECREF(typefind); - - pyg_gil_state_release (state); - - return; -} - -static void -type_find_function_data_destroy_notify(gpointer data) -{ - Py_DECREF((PyObject *) data); -} - -static PyObject * -_wrap_gst_type_find_register (PyObject *self, PyObject *args) -{ - guint rank; - PyObject *required_args; - PyObject *function; - PyObject *function_args = NULL; - PyObject *py_extensions = NULL, *ext; - PyObject *py_possible_caps = NULL; - PyObject *py_res = NULL; - gchar *name; - gpointer *data = NULL; - GStrv extensions = NULL; - guint i, n_extensions; - GstCaps *possible_caps = NULL; - gboolean res = FALSE; - - if (PyTuple_GET_SIZE(args) > 5) { - required_args = PyTuple_GetSlice(args, 0, 5); - function_args = PyTuple_GetSlice(args, 5, PyTuple_GET_SIZE(args)); - } else { - required_args = args; - } - - if (!PyArg_ParseTuple(required_args, "siO|OO:type_find_register", - &name, &rank, &function, &py_extensions, &py_possible_caps)) { - goto out; - } - - if (!PyCallable_Check(function)) { - PyErr_SetString (PyExc_TypeError, "function is not a callable"); - goto out; - } - - if (py_extensions) { - n_extensions = PySequence_Size(py_extensions); - if (n_extensions == -1) { - goto out; - } - - if (n_extensions > 0) { - extensions = (char **) g_malloc(sizeof(char *) * n_extensions + 1); - for(i = 0; i < n_extensions; ++i) { - ext = PySequence_GetItem(py_extensions, i); - - if (!PyString_Check(ext)) { - PyErr_SetString(PyExc_TypeError, "extension is not a string"); - goto out; - } - - extensions[i] = g_strdup(PyString_AS_STRING(ext)); - } - - extensions[n_extensions] = NULL; - } - } - - if (py_possible_caps) - possible_caps = pygst_caps_from_pyobject(py_possible_caps, NULL); - - if (function_args) - data = (gpointer) Py_BuildValue("(OO)", function, function_args); - else - data = (gpointer) Py_BuildValue("(O)", function); - - pyg_begin_allow_threads; - res = gst_type_find_register(NULL, name, rank, - type_find_function, extensions, possible_caps, - data, type_find_function_data_destroy_notify); - pyg_end_allow_threads; - - py_res = PyBool_FromLong(res); - -out: - if (required_args != args) { - Py_DECREF(required_args); - } - - Py_XDECREF(function_args); - - if (extensions) - g_strfreev(extensions); - - if (possible_caps) - gst_caps_unref(possible_caps); - - if (res == FALSE && data) { - Py_DECREF((PyObject *) data); - } - - return py_res; -} - -%% -override gst_type_find_peek kwargs -static PyObject * -_wrap_gst_type_find_peek (PyObject * self, PyObject * args, PyObject * kwargs) -{ - static char *kwlist[] = { "offset", "size", NULL }; - gint64 offset; - guint size; - GstTypeFind *typefind; - guint8 *data; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"LI:GstTypeFind.peek", - kwlist, &offset, &size)) - return NULL; - - typefind = pyg_pointer_get(self, GstTypeFind); - pyg_begin_allow_threads; - data = gst_type_find_peek(typefind, offset, size); - pyg_end_allow_threads; - - if (data == NULL) - /* return the empty string */ - return PyString_FromStringAndSize(NULL, 0); - - return PyString_FromStringAndSize((char *) data, size); -} - -%% -override gst_segment_set_seek kwargs -static PyObject * -_wrap_gst_segment_set_seek (PyObject * self, PyObject * args, PyObject * kwargs) -{ - static char *kwlist[] = { "rate", "format", "flags", "start_type", "start", - "stop_type", "stop", NULL }; - GstSeekType start_type, stop_type; - PyObject *py_format = NULL, *py_flags = NULL, *py_start_type = NULL; - PyObject *py_stop_type = NULL, *py_ret; - double rate; - GstFormat format; - gint64 start, stop; - GstSeekFlags flags; - gboolean update = FALSE; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"dOOOLOL:GstSegment.set_seek", - kwlist, &rate, &py_format, &py_flags, - &py_start_type, &start, &py_stop_type, - &stop)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_FORMAT, py_format, (gint *)&format)) - return NULL; - if (pyg_flags_get_value(GST_TYPE_SEEK_FLAGS, py_flags, (gint *)&flags)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_SEEK_TYPE, py_start_type, (gint *)&start_type)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_SEEK_TYPE, py_stop_type, (gint *)&stop_type)) - return NULL; - pyg_begin_allow_threads; - gst_segment_set_seek(pyg_boxed_get(self, GstSegment), rate, format, flags, - start_type, start, stop_type, stop, &update); - pyg_end_allow_threads; - py_ret = PyBool_FromLong(update); - return py_ret; -} -%% -override gst_segment_clip kwargs -static PyObject * -_wrap_gst_segment_clip (PyObject * self, PyObject * args, PyObject * kwargs) -{ - static char *kwlist[] = { "format", "start", "stop", NULL}; - GstFormat format; - gint64 start, stop; - gint64 cstart = -1; - gint64 cstop = -1; - gboolean ret; - PyObject *py_ret, *py_format; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OLL:GstSegment.clip", - kwlist, &py_format, &start, &stop)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_FORMAT, py_format, (gint *)&format)) - return NULL; - pyg_begin_allow_threads; - ret = gst_segment_clip (pyg_boxed_get(self, GstSegment), format, start, stop, - &cstart, &cstop); - pyg_end_allow_threads; - - /* Returns gboolean ret, gint64 clip_start, gint64 clip_stop */ - py_ret = PyList_New(3); - PyList_SetItem(py_ret, 0, PyBool_FromLong(ret)); - PyList_SetItem(py_ret, 1, PyLong_FromLongLong(cstart)); - PyList_SetItem(py_ret, 2, PyLong_FromLongLong(cstop)); - - return py_ret; -} - -%% -override GstURIHandler__proxy_do_get_type_full -static GstURIType -_wrap_GstURIHandler__proxy_do_get_type_full (GType type) -{ - PyGILState_STATE __py_state; - PyTypeObject *py_class; - PyObject *py_method; - PyObject *py_retval; - guint retval; - - __py_state = pyg_gil_state_ensure(); - py_class = pygobject_lookup_class (type); - if (py_class == NULL) { - pyg_gil_state_release (__py_state); - return GST_URI_UNKNOWN; - } - - py_method = PyObject_GetAttrString((PyObject *) py_class, "do_get_type_full"); - Py_DECREF (py_class); - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return GST_URI_UNKNOWN; - } - - py_retval = PyObject_CallObject(py_method, NULL); - Py_DECREF (py_method); - if (!py_retval) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return GST_URI_UNKNOWN; - } - - retval = PyLong_AsLong (py_retval); - Py_DECREF(py_retval); - pyg_gil_state_release(__py_state); - - return retval; -} - -%% -override GstURIHandler__proxy_do_get_protocols_full -static gchar ** -_wrap_GstURIHandler__proxy_do_get_protocols_full (GType type) -{ - PyGILState_STATE __py_state; - PyTypeObject *py_class; - PyObject *py_method; - PyObject *py_retval; - Py_ssize_t ret_size, i; - gchar **retval; - - __py_state = pyg_gil_state_ensure(); - py_class = pygobject_lookup_class (type); - if (py_class == NULL) { - pyg_gil_state_release (__py_state); - return NULL; - } - - py_method = PyObject_GetAttrString((PyObject *) py_class, "do_get_protocols_full"); - Py_DECREF (py_class); - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return NULL; - } - - py_retval = PyObject_CallObject(py_method, NULL); - Py_DECREF (py_method); - if (!py_retval) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return NULL; - } - - if (!PySequence_Check (py_retval)) { - PyErr_SetString (PyExc_TypeError, "GstURIHandler.do_get_protocols_full " - "must return a sequence of strings"); - Py_DECREF (py_retval); - return NULL; - } - - ret_size = PySequence_Size (py_retval); - if (ret_size == -1) { - Py_DECREF (py_retval); - pyg_gil_state_release(__py_state); - return NULL; - } - - retval = g_new (gchar *, ret_size + 1); - retval[ret_size] = NULL; - for (i = 0; i < PySequence_Size (py_retval); ++i) { - PyObject *item = PySequence_GetItem (py_retval, i); - if (!item) { - if (PyErr_Occurred ()) - PyErr_Print (); - g_strfreev (retval); - Py_DECREF (py_retval); - pyg_gil_state_release(__py_state); - return NULL; - } - - if (!PyString_Check (item)) { - PyErr_SetString (PyExc_TypeError, "GstURIHandler.do_get_protocols_full " - "must return a sequence of strings"); - Py_DECREF (item); - g_strfreev (retval); - Py_DECREF (py_retval); - pyg_gil_state_release(__py_state); - return NULL; - } - - retval [i] = PyString_AsString (item); - if (!retval [i]) { - if (PyErr_Occurred ()) - PyErr_Print (); - g_strfreev (retval); - Py_DECREF (item); - Py_DECREF (py_retval); - pyg_gil_state_release(__py_state); - return NULL; - } - - Py_DECREF (item); - } - - Py_DECREF(py_retval); - pyg_gil_state_release(__py_state); - - return retval; -} -%% -override GstURIHandler__do_get_type_full -static PyObject * -_wrap_GstURIHandler__do_get_type_full(PyObject *cls, PyObject *args, PyObject *kwargs) -{ - GstURIHandlerInterface *iface; - static char *kwlist[] = { "self", "type", NULL }; - PyGObject *self; - PyObject *py_type = NULL; - GType type; - guint ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O:GstURIHandler.get_type_full", kwlist, &PyGstURIHandler_Type, &self, &py_type)) - return NULL; - if ((type = pyg_type_from_object(py_type)) == 0) - return NULL; - iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object(cls)), GST_TYPE_URI_HANDLER); - if (iface->get_type_full) - ret = iface->get_type_full(type); - else { - PyErr_SetString(PyExc_NotImplementedError, "interface method GstURIHandler.get_type_full not implemented"); - return NULL; - } - return PyLong_FromUnsignedLong(ret); -} -%% -override GstURIHandler__do_get_protocols_full -static PyObject * -_wrap_GstURIHandler__do_get_protocols_full(PyObject *cls, PyObject *args, PyObject *kwargs) -{ - GstURIHandlerInterface *iface; - static char *kwlist[] = { "self", "type", NULL }; - PyGObject *self; - PyObject *py_type = NULL; - GType type; - gchar **ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O:GstURIHandler.get_protocols_full", kwlist, &PyGstURIHandler_Type, &self, &py_type)) - return NULL; - if ((type = pyg_type_from_object(py_type)) == 0) - return NULL; - iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object(cls)), GST_TYPE_URI_HANDLER); - if (iface->get_protocols_full) - ret = iface->get_protocols_full(type); - else { - PyErr_SetString(PyExc_NotImplementedError, "interface method GstURIHandler.get_protocols_full not implemented"); - return NULL; - } - if (ret) { - guint size = g_strv_length(ret); - PyObject *py_ret = PyTuple_New(size); - gint i; - for (i = 0; i < size; i++) - PyTuple_SetItem(py_ret, i, - PyString_FromString(ret[i])); - return py_ret; - } - return PyTuple_New (0); - -} - -%% -override g_error_new kwargs -static int -_wrap_g_error_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "domain", "code", "message", NULL }; - int code; - gchar *message; - gchar *domain; - GQuark domainq; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sis:GError.__init__", kwlist, &domain, &code, &message)) - return -1; - domainq = g_quark_from_string(domain); - - self->gtype = GST_TYPE_G_ERROR; - self->free_on_dealloc = FALSE; - self->boxed = g_error_new(domainq, code, "%s", message); - - if (!self->boxed) { - PyErr_SetString(PyExc_RuntimeError, "could not create GError object"); - return -1; - } - self->free_on_dealloc = TRUE; - return 0; -} -%% -override-attr GstIndexEntry.NASSOCS -static PyObject * -_wrap_gst_index_entry__get_NASSOCS(PyObject *self, void *closure) -{ - GstIndexEntry *entry; - - g_assert (self); - entry = (GstIndexEntry*) pyg_boxed_get(self, GstIndexEntry); - g_assert (entry); - - if (entry->type != GST_INDEX_ENTRY_ASSOCIATION) { - PyErr_SetString(PyExc_RuntimeError, "IndexEntry is not an AssociationEntry"); - return NULL; - } - return PyInt_FromLong(GST_INDEX_NASSOCS(entry)); -} -%% -override-attr GstIndexEntry.ASSOC_FLAGS -static PyObject * -_wrap_gst_index_entry__get_ASSOC_FLAGS(PyObject *self, void *closure) -{ - GstIndexEntry *entry; - - g_assert (self); - entry = (GstIndexEntry*) pyg_boxed_get(self, GstIndexEntry); - g_assert (entry); - - if (entry->type != GST_INDEX_ENTRY_ASSOCIATION) { - PyErr_SetString(PyExc_RuntimeError, "IndexEntry is not an AssociationEntry"); - return NULL; - } - return pyg_flags_from_gtype(GST_TYPE_ASSOC_FLAGS, - GST_INDEX_ASSOC_FLAGS (entry)); -} -%% -override-attr GstIndexEntry.ID_DESCRIPTION -static PyObject * -_wrap_gst_index_entry__get_ID_DESCRIPTION(PyObject *self, void *closure) -{ - GstIndexEntry *entry; - - g_assert (self); - entry = (GstIndexEntry*) pyg_boxed_get(self, GstIndexEntry); - g_assert (entry); - - if (entry->type != GST_INDEX_ENTRY_ID) { - PyErr_SetString(PyExc_RuntimeError, "IndexEntry is not an ID Entry"); - return NULL; - } - if (GST_INDEX_ID_DESCRIPTION (entry)) - return PyString_FromString(GST_INDEX_ID_DESCRIPTION (entry)); - Py_INCREF(Py_None); - return Py_None; -} -%% -override-attr GstIndexEntry.FORMAT_FORMAT -static PyObject * -_wrap_gst_index_entry__get_FORMAT_FORMAT(PyObject *self, void *closure) -{ - GstIndexEntry *entry; - - g_assert (self); - entry = (GstIndexEntry*) pyg_boxed_get(self, GstIndexEntry); - g_assert (entry); - - if (entry->type != GST_INDEX_ENTRY_FORMAT) { - PyErr_SetString(PyExc_RuntimeError, "IndexEntry is not a FORMAT Entry"); - return NULL; - } - return pyg_enum_from_gtype (GST_TYPE_FORMAT, GST_INDEX_FORMAT_FORMAT (entry)); -} -%% -override-attr GstIndexEntry.FORMAT_KEY -static PyObject * -_wrap_gst_index_entry__get_FORMAT_KEY(PyObject *self, void *closure) -{ - GstIndexEntry *entry; - - g_assert (self); - entry = (GstIndexEntry*) pyg_boxed_get(self, GstIndexEntry); - g_assert (entry); - - if (entry->type != GST_INDEX_ENTRY_FORMAT) { - PyErr_SetString(PyExc_RuntimeError, "IndexEntry is not a FORMAT Entry"); - return NULL; - } - if (GST_INDEX_FORMAT_KEY (entry)) - return PyString_FromString(GST_INDEX_FORMAT_KEY (entry)); - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstbase.override b/gst/gstbase.override deleted file mode 100644 index a523cd2088..0000000000 --- a/gst/gstbase.override +++ /dev/null @@ -1,905 +0,0 @@ -/* -*- Mode: C; ; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2006 Edward Hervey - * - * 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: Johan Dahlin - */ - -%% -override GstBaseSrc__proxy_do_create -static GstFlowReturn -_wrap_GstBaseSrc__proxy_do_create (GstBaseSrc * self, - guint64 offset, - guint size, - GstBuffer ** buf) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - GstFlowReturn retval = GST_FLOW_ERROR; - PyObject *py_ret; - PyObject *py_flow; - PyObject *py_buffer; - PyObject *py_args; - PyObject *py_method; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_args = PyTuple_New(2); - PyTuple_SET_ITEM(py_args, 0, PyLong_FromUnsignedLongLong(offset)); - PyTuple_SET_ITEM(py_args, 1, PyInt_FromLong(size)); - - py_method = PyObject_GetAttrString(py_self, "do_create"); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, py_args); - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - /* process the python return value */ - /* Should be a list containing the gst.FlowReturn and the gst.Buffer */ - if (PyTuple_Check(py_ret)) { - /* gst.FlowReturn */ - py_flow = PyTuple_GetItem(py_ret, 0); - - if (!py_flow) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_ret); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - if (py_flow == Py_None) { - GST_ERROR ("None return flow is not valid"); - goto beach; - } - - GST_DEBUG ("py_flow:%p", py_flow); - - if (pyg_enum_get_value(GST_TYPE_FLOW_RETURN, py_flow, (gint*) &retval)) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_ret); - Py_DECREF(py_flow); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - retval = GST_FLOW_ERROR; - goto beach; - } - - py_buffer = PyTuple_GetItem(py_ret, 1); - if (!py_buffer) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_ret); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - if (pygstminiobject_check(py_buffer, &PyGstBuffer_Type)) { - *buf = GST_BUFFER (pygstminiobject_get (py_buffer)); - gst_buffer_ref (*buf); - } else { - *buf = NULL; - } - } - - Py_DECREF(py_ret); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - - beach: - pyg_gil_state_release(__py_state); - - return retval; -} -%% -override GstBaseSrc__do_create kwargs -static PyObject * -_wrap_GstBaseSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "offset", "size", NULL }; - PyGObject *self; - guint64 offset; - guint size; - PyObject *py_ret; - GstFlowReturn flow; - GstBuffer *buffer = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!KI:GstBaseSrc.create", - kwlist, &PyGstBaseSrc_Type, &self, &offset, &size)) - return NULL; - - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_SRC_CLASS(klass)->create) { - pyg_begin_allow_threads; - flow = GST_BASE_SRC_CLASS(klass)->create(GST_BASE_SRC(self->obj), offset, size, &buffer); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.set_caps not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - /* We now need to return a tuple with (flow, buffer) */ - if (buffer) - py_ret = PyTuple_New(2); - else - py_ret = PyTuple_New(1); - - PyTuple_SET_ITEM(py_ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, flow)); - - if (buffer) - PyTuple_SET_ITEM(py_ret, 1, pygstminiobject_new(GST_MINI_OBJECT (buffer))); - - return py_ret; -} -%% -override GstBaseSrc__proxy_do_get_size -static gboolean -_wrap_GstBaseSrc__proxy_do_get_size (GstBaseSrc * self, - guint64 * size) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - gboolean ret = FALSE; - PyObject *py_method; - PyObject *py_ret; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_method = PyObject_GetAttrString(py_self, "do_get_size"); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_self); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, NULL); - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_method); - Py_DECREF(py_self); - goto beach; - } - - /* - If the method returned a numeric, the return value will be TRUE. - For ANY other case, we don't set size and the return value is FALSE. - */ - - if (PyLong_Check(py_ret)) { - *size = PyLong_AsUnsignedLongLongMask(py_ret); - ret = TRUE; - } - - Py_DECREF(py_method); - Py_DECREF(py_self); - Py_DECREF(py_ret); - - beach: - pyg_gil_state_release(__py_state); - - return ret; -} -%% -override GstBaseSrc__do_get_size kwargs -static PyObject * -_wrap_GstBaseSrc__do_get_size (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", NULL }; - PyGObject *self; - gboolean ret; - guint64 size = 0; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GstBaseSrc.get_size", - kwlist, &PyGstBaseSrc_Type, &self)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_SRC_CLASS(klass)->get_size) { - pyg_begin_allow_threads; - ret = GST_BASE_SRC_CLASS(klass)->get_size(GST_BASE_SRC(self->obj), &size); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_size not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyLong_FromUnsignedLongLong(size); - - return py_ret; -} -%% -override GstBaseSrc__proxy_do_get_times -static void -_wrap_GstBaseSrc__proxy_do_get_times (GstBaseSrc * self, - GstBuffer *buffer, - GstClockTime * start, - GstClockTime * end) -{ - PyGILState_STATE __py_state; - PyObject *py_args; - PyObject *py_self; - PyObject *py_method; - PyObject *py_ret; - - __py_state = pyg_gil_state_ensure(); - - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - return; - } - - py_args = Py_BuildValue ("(N)", - pygstminiobject_new((GstMiniObject *)buffer)); - - py_method = PyObject_GetAttrString(py_self, "do_get_times"); - - Py_DECREF(py_self); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, py_args); - - Py_DECREF(py_method); - - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - /* - If the method returned a numeric, the return value will be TRUE. - For ANY other case, we don't set size and the return value is FALSE. - */ - - if ((PyTuple_Check(py_ret)) && (PyTuple_Size (py_ret) == 2)) - PyArg_ParseTuple (py_ret, "KK", start, end); - - Py_DECREF (py_ret); - beach: - Py_DECREF (py_args); - pyg_gil_state_release(__py_state); - return; -} -%% -override GstBaseSrc__do_get_times kwargs -static PyObject * -_wrap_GstBaseSrc__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "buffer", NULL }; - PyGObject *self; - PyGstMiniObject *py_buffer; - GstClockTime start = 0; - GstClockTime end = 0; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:GstBaseSrc.get_times", - kwlist, &PyGstBaseSrc_Type, &self, - &PyGstBuffer_Type, &py_buffer)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_SRC_CLASS(klass)->get_times) { - pyg_begin_allow_threads; - GST_BASE_SRC_CLASS(klass)->get_times(GST_BASE_SRC(self->obj), - GST_BUFFER(py_buffer->obj), - &start, &end); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_times not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyTuple_New(2); - PyTuple_SetItem(py_ret, 0, PyLong_FromUnsignedLongLong(start)); - PyTuple_SetItem(py_ret, 1, PyLong_FromUnsignedLongLong(end)); - - return py_ret; -} -%% -override GstPushSrc__proxy_do_create -static GstFlowReturn -_wrap_GstPushSrc__proxy_do_create (GstPushSrc * self, - GstBuffer **buffer) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - PyObject *py_method; - PyObject *py_ret; - PyGstMiniObject *py_buffer; - PyObject *py_flow; - GstFlowReturn ret = GST_FLOW_OK; - - __py_state = pyg_gil_state_ensure(); - - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_method = PyObject_GetAttrString(py_self, "do_create"); - - Py_DECREF(py_self); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, NULL); - - Py_DECREF(py_method); - - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - /* - If the method returned a numeric, the return value will be TRUE. - For ANY other case, we don't set size and the return value is FALSE. - */ - - if ((PyTuple_Check(py_ret)) && (PyTuple_Size (py_ret) == 2)) { - PyArg_ParseTuple (py_ret, "O!O!", &PyGEnum_Type, &py_flow, - &PyGstBuffer_Type, &py_buffer); - *buffer = GST_BUFFER (((PyGstMiniObject*) self)->obj); - gst_buffer_ref (*buffer); - pyg_enum_get_value(GST_TYPE_FLOW_RETURN, py_flow, (gint*)&ret); - } - - Py_DECREF (py_ret); - beach: - pyg_gil_state_release(__py_state); - return ret; -} -%% -override GstPushSrc__do_create kwargs -static PyObject * -_wrap_GstPushSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", NULL }; - PyGObject *self; - GstBuffer *buffer; - GstFlowReturn flow; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:GstPushSrc.create", - kwlist, &PyGstPushSrc_Type, &self)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_PUSH_SRC_CLASS(klass)->create) { - pyg_begin_allow_threads; - flow = GST_PUSH_SRC_CLASS(klass)->create(GST_PUSH_SRC(self->obj), - (GstBuffer**) &buffer); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstPushSrc.create not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyTuple_New(2); - PyList_SetItem(py_ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, flow)); - PyList_SetItem(py_ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buffer))); - - return py_ret; -} -%% -override GstBaseTransform__proxy_do_get_unit_size -static gboolean -_wrap_GstBaseTransform__proxy_do_get_unit_size (GstBaseTransform * self, - GstCaps * caps, - guint * size) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - PyObject *py_caps; - gboolean ret = FALSE; - PyObject *py_args; - PyObject *py_method; - PyObject *py_ret; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - if (caps) - py_caps = pyg_boxed_new(GST_TYPE_CAPS, caps, FALSE, FALSE); // should copyval be TRUE instead? - else { - Py_INCREF (Py_None); - py_caps = Py_None; - } - - py_args = PyTuple_New(1); - PyTuple_SET_ITEM(py_args, 0, py_caps); - - py_method = PyObject_GetAttrString(py_self, "do_get_unit_size"); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, py_args); - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - goto beach; - } - - /* - If the method returned a numeric, the return value will be TRUE. - For ANY other case, we don't set size and the return value is FALSE. - */ - - if (PyInt_Check(py_ret)) { - *size = PyInt_AsLong(py_ret); - ret = TRUE; - } - - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - Py_DECREF(py_ret); - - beach: - pyg_gil_state_release(__py_state); - return ret; -} -%% -override GstBaseTransform__do_get_unit_size kwargs -static PyObject * -_wrap_GstBaseTransform__do_get_unit_size (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "caps", NULL }; - PyGObject *self; - PyGObject *caps; - gboolean ret; - guint size = 0; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:GstBaseTransform.get_unit_size", - kwlist, &PyGstBaseTransform_Type, &self, &PyGstCaps_Type, &caps)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size) { - pyg_begin_allow_threads; - ret = GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size(GST_BASE_TRANSFORM(self->obj), GST_CAPS(caps->obj), &size); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.get_unit_size not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyLong_FromUnsignedLongLong(size); - - return py_ret; -} -%% -override GstBaseTransform__proxy_do_transform_size -static gboolean -_wrap_GstBaseTransform__proxy_do_transform_size (GstBaseTransform * self, - GstPadDirection direction, - GstCaps * caps, - guint size, - GstCaps * othercaps, - guint * othersize) -{ - PyGILState_STATE __py_state; - PyObject *py_self = NULL; - PyObject *py_direction = NULL; - PyObject *py_caps = NULL; - PyObject *py_size = NULL; - PyObject *py_othercaps = NULL; - PyObject *py_args = NULL; - PyObject *py_method = NULL; - PyObject *py_ret = NULL; - gboolean ret = FALSE; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_direction = pyg_enum_from_gtype(GST_TYPE_PAD_DIRECTION, direction); - - if (caps) - py_caps = pyg_boxed_new(GST_TYPE_CAPS, caps, FALSE, FALSE); // should copyval be TRUE instead? - else { - Py_INCREF (Py_None); - py_caps = Py_None; - } - - py_size = PyInt_FromLong(size); - - if (othercaps) - py_othercaps = pyg_boxed_new(GST_TYPE_CAPS, caps, FALSE, FALSE); // should copyval be TRUE instead? - else { - Py_INCREF (Py_None); - py_othercaps = Py_None; - } - - py_args = PyTuple_New(4); - PyTuple_SET_ITEM(py_args, 0, py_direction); - PyTuple_SET_ITEM(py_args, 1, py_caps); - PyTuple_SET_ITEM(py_args, 2, py_size); - PyTuple_SET_ITEM(py_args, 3, py_othercaps); - - py_method = PyObject_GetAttrString(py_self, "do_transform_size"); - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, py_args); - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - if (PyInt_Check(py_ret)) { - *othersize = PyInt_AsLong(py_ret); - ret = TRUE; - } - -beach: - Py_XDECREF(py_self); - Py_XDECREF(py_args); - Py_XDECREF(py_method); - Py_XDECREF(py_ret); - - pyg_gil_state_release(__py_state); - return ret; -} -%% -override GstBaseTransform__do_transform_size kwargs -static PyObject * -_wrap_GstBaseTransform__do_transform_size (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "direction", "caps", "size", "othercaps", NULL }; - PyGObject *self; - PyGObject *py_direction; - PyGObject *py_caps; - PyGObject *py_othercaps; - gboolean ret; - GstPadDirection direction; - guint size = 0; - guint othersize = 0; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!O!iO!:GstBaseTransform.get_unit_size", - kwlist, &PyGstBaseTransform_Type, &self, &PyGEnum_Type, &py_direction, - &PyGstCaps_Type, &py_caps, &size, &PyGstCaps_Type, &py_othercaps)) - return NULL; - - pyg_enum_get_value(GST_TYPE_PAD_DIRECTION, - (PyObject *) py_direction, (gint *) &direction); - - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_TRANSFORM_CLASS(klass)->transform_size) { - pyg_begin_allow_threads; - ret = GST_BASE_TRANSFORM_CLASS(klass)->transform_size(GST_BASE_TRANSFORM(self->obj), - direction, GST_CAPS(py_caps->obj), size, - GST_CAPS(py_othercaps->obj), &othersize); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.transform_size not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyLong_FromUnsignedLongLong(othersize); - return py_ret; -} -%% -override GstBaseSink__proxy_do_get_times -static void -_wrap_GstBaseSink__proxy_do_get_times (GstBaseSink * self, - GstBuffer *buffer, - GstClockTime * start, - GstClockTime * end) -{ - PyGILState_STATE __py_state; - PyObject *py_args; - PyObject *py_self; - PyObject *py_method; - PyObject *py_ret; - - __py_state = pyg_gil_state_ensure(); - - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return; - } - - py_args = Py_BuildValue ("(N)", - pygstminiobject_new((GstMiniObject *)buffer)); - - py_method = PyObject_GetAttrString(py_self, "do_get_times"); - - Py_DECREF(py_self); - - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - py_ret = PyObject_CallObject(py_method, py_args); - - Py_DECREF(py_method); - - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - - /* - If the method returned a numeric, the return value will be TRUE. - For ANY other case, we don't set size and the return value is FALSE. - */ - - if ((PyTuple_Check(py_ret)) && (PyTuple_Size (py_ret) == 2)) - PyArg_ParseTuple (py_ret, "KK", start, end); - - Py_DECREF (py_ret); - beach: - Py_DECREF (py_args); - pyg_gil_state_release(__py_state); - return; -} -%% -override GstBaseSink__do_get_times kwargs -static PyObject * -_wrap_GstBaseSink__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "buffer", NULL }; - PyGObject *self; - PyGstMiniObject *py_buffer; - GstClockTime start = 0; - GstClockTime end = 0; - PyObject *py_ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:GstBaseSink.get_times", - kwlist, &PyGstBaseSink_Type, &self, - &PyGstBuffer_Type, &py_buffer)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_SINK_CLASS(klass)->get_times) { - pyg_begin_allow_threads; - GST_BASE_SINK_CLASS(klass)->get_times(GST_BASE_SINK(self->obj), - GST_BUFFER(py_buffer->obj), - &start, &end); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSink.get_times not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - - py_ret = PyTuple_New(2); - PyTuple_SetItem(py_ret, 0, PyLong_FromUnsignedLongLong(start)); - PyTuple_SetItem(py_ret, 1, PyLong_FromUnsignedLongLong(end)); - - return py_ret; -} -%% -override gst_base_sink_query_latency noargs -static PyObject * -_wrap_gst_base_sink_query_latency (PyGObject *self) -{ - gboolean res, live = FALSE, upstream_live = FALSE; - GstClockTime minlat = GST_CLOCK_TIME_NONE, maxlat = GST_CLOCK_TIME_NONE; - - res = gst_base_sink_query_latency (GST_BASE_SINK (self->obj), &live, &upstream_live, - &minlat, &maxlat); - return Py_BuildValue("(OOOKK)", - PyBool_FromLong(res), - PyBool_FromLong(live), - PyBool_FromLong(upstream_live), - minlat, maxlat); -} -%% -override gst_base_src_query_latency noargs -static PyObject * -_wrap_gst_base_src_query_latency (PyGObject *self) -{ - gboolean res, live = FALSE; - GstClockTime minlat = GST_CLOCK_TIME_NONE, maxlat = GST_CLOCK_TIME_NONE; - - res = gst_base_src_query_latency (GST_BASE_SRC (self->obj), &live, - &minlat, &maxlat); - return Py_BuildValue("(OOKK)", - PyBool_FromLong(res), - PyBool_FromLong(live), - minlat, maxlat); -} -%% -override GstBaseTransform__do_src_event kwargs -static PyObject * -_wrap_GstBaseTransform__do_src_event(PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "event", NULL }; - PyGObject *self; - int ret; - PyGstMiniObject *event; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!:GstBaseTransform.src_event", kwlist, &PyGstBaseTransform_Type, &self, &PyGstEvent_Type, &event)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BASE_TRANSFORM_CLASS(klass)->src_event) { - pyg_begin_allow_threads; - ret = GST_BASE_TRANSFORM_CLASS(klass)->src_event(GST_BASE_TRANSFORM(self->obj), - gst_event_ref (GST_EVENT(event->obj))); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.src_event not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - return PyBool_FromLong(ret); - -} -%% -override gst_adapter_take kwargs -static PyObject * -_wrap_gst_adapter_take(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "nbytes", NULL }; - PyObject *py_nbytes = NULL; - guint nbytes = 0; - guint8 *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GstAdapter.take", kwlist, &py_nbytes)) - return NULL; - if (py_nbytes) { - if (PyLong_Check(py_nbytes)) - nbytes = PyLong_AsUnsignedLong(py_nbytes); - else if (PyInt_Check(py_nbytes)) - nbytes = PyInt_AsLong(py_nbytes); - else - PyErr_SetString(PyExc_TypeError, "Parameter 'nbytes' must be an int or a long"); - if (PyErr_Occurred()) - return NULL; - } - pyg_begin_allow_threads; - ret = gst_adapter_take(GST_ADAPTER(self->obj), nbytes); - pyg_end_allow_threads; - if (ret) { - PyObject *py_ret = PyString_FromStringAndSize((gchar*) ret, nbytes); - g_free(ret); - return py_ret; - } - Py_INCREF(Py_None); - return Py_None; -} -%% -override gst_adapter_peek kwargs -static PyObject * -_wrap_gst_adapter_peek(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "size", NULL }; - PyObject *py_size = NULL; - const guint8 *ret; - guint size = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GstAdapter.peek", kwlist, &py_size)) - return NULL; - if (py_size) { - if (PyLong_Check(py_size)) - size = PyLong_AsUnsignedLong(py_size); - else if (PyInt_Check(py_size)) - size = PyInt_AsLong(py_size); - else - PyErr_SetString(PyExc_TypeError, "Parameter 'size' must be an int or a long"); - if (PyErr_Occurred()) - return NULL; - } - pyg_begin_allow_threads; - ret = gst_adapter_peek(GST_ADAPTER(self->obj), size); - pyg_end_allow_threads; - if (ret) - return PyString_FromStringAndSize((gchar*) ret, size); - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstbin.override b/gst/gstbin.override deleted file mode 100644 index c47316389e..0000000000 --- a/gst/gstbin.override +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 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: Johan Dahlin - */ - -%% -ignore - gst_bin_get_by_name_recurse_up -%% -override gst_bin_add args -static PyObject * -_wrap_gst_bin_add(PyGObject *self, PyObject *args) -{ - PyGObject *element; - int i, len; - - len = PyTuple_Size(args); - if (len == 0) { - PyErr_SetString(PyExc_TypeError, "GstBin.add_many requires at least one argument"); - return NULL; - } - - - for (i = 0; i < len; i++) { - element = (PyGObject*)PyTuple_GetItem(args, i); - if (!pygobject_check(element, &PyGstElement_Type)) - { - PyErr_SetString(PyExc_TypeError, "argument must be a GstElement"); - return NULL; - } - } - - for (i = 0; i < len; i++) { - gboolean rest; - - element = (PyGObject*)PyTuple_GetItem(args, i); - pyg_begin_allow_threads; - rest = gst_bin_add(GST_BIN(self->obj), GST_ELEMENT(element->obj)); - pyg_end_allow_threads; - if (!rest) { - PyErr_Format(PyGstExc_AddError, "Could not add element '%s'", GST_OBJECT_NAME(element->obj)); - return NULL; - } - } - - Py_INCREF(Py_None); - return Py_None; -} - -%% -override gst_bin_add_many kwargs -static PyObject * -_wrap_gst_bin_add_many(PyGObject *self, PyObject *args) -{ - if (PyErr_Warn(PyExc_DeprecationWarning, "gst.Bin.add_many() is deprecated, use gst.Bin.add()") < 0) - return NULL; - return _wrap_gst_bin_add (self, args); -} - -%% -override gst_bin_remove args -static PyObject * -_wrap_gst_bin_remove(PyGObject *self, PyObject *args) -{ - PyGObject *element; - int i, len; - - len = PyTuple_Size(args); - if (len == 0) { - PyErr_SetString(PyExc_TypeError, "GstBin.remove_many requires at least one argument"); - return NULL; - } - - - for (i = 0; i < len; i++) { - element = (PyGObject*)PyTuple_GetItem(args, i); - if (!pygobject_check(element, &PyGstElement_Type)) - { - PyErr_SetString(PyExc_TypeError, "argument must be a GstElement"); - return NULL; - } - } - - for (i = 0; i < len; i++) { - gboolean rest; - element = (PyGObject*)PyTuple_GetItem(args, i); - pyg_begin_allow_threads; - rest = gst_bin_remove(GST_BIN(self->obj), GST_ELEMENT(element->obj)); - pyg_end_allow_threads; - if (!rest) { - PyErr_Format(PyGstExc_RemoveError, "Could not remove element '%s'", GST_OBJECT_NAME(element->obj)); - return NULL; - } - } - - Py_INCREF(Py_None); - return Py_None; -} - -%% -override gst_bin_remove_many kwargs -static PyObject * -_wrap_gst_bin_remove_many(PyGObject *self, PyObject *args) -{ - if (PyErr_Warn(PyExc_DeprecationWarning, "gst.Bin.remove_many() is deprecated, use gst.Bin.remove()") < 0) - return NULL; - return _wrap_gst_bin_remove (self, args); -} -%% -override gst_bin_get_by_name kwargs -static PyObject * -_wrap_gst_bin_get_by_name(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", "recurse", NULL }; - char *name; - gboolean recurse = FALSE; - GstElement *el; - PyObject *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|b:GstBin.get_by_name", - kwlist, &name, &recurse)) - return NULL; - - if (recurse) - el = gst_bin_get_by_name_recurse_up(GST_BIN(self->obj), name); - else - el = gst_bin_get_by_name(GST_BIN(self->obj), name); - - /* pygobject_new handles NULL checking */ - ret = pygobject_new((GObject *)el); - if (el) - gst_object_unref (el); /* from get_by_name */ - return ret; -} -%% -override-slot GstBin.tp_iter -static PyObject * -_wrap_gst_bin_tp_iter(PyGObject *self) -{ - return _wrap_gst_bin_iterate_elements(self); -} -%% -override GstBin__do_handle_message kwargs -static PyObject * -_wrap_GstBin__do_handle_message(PyObject *cls, PyObject *args, PyObject *kwargs) -{ - gpointer klass; - static char *kwlist[] = { "self", "message", NULL }; - PyGObject *self; - PyGstMiniObject *message; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!:GstBin.handle_message", kwlist, &PyGstBin_Type, &self, &PyGstMessage_Type, &message)) - return NULL; - klass = g_type_class_ref(pyg_type_from_object(cls)); - if (GST_BIN_CLASS(klass)->handle_message) { - gst_mini_object_ref (message->obj); - pyg_begin_allow_threads; - GST_BIN_CLASS(klass)->handle_message(GST_BIN(self->obj), GST_MESSAGE(message->obj)); - pyg_end_allow_threads; - } else { - PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBin.handle_message not implemented"); - g_type_class_unref(klass); - return NULL; - } - g_type_class_unref(klass); - Py_INCREF(Py_None); - return Py_None; -} - -%% -override GstBin__proxy_do_handle_message -static void -_wrap_GstBin__proxy_do_handle_message(GstBin *self, GstMessage*message) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - PyObject *py_message = NULL; - PyObject *py_retval; - PyObject *py_args; - PyObject *py_method; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return; - } - if (message) { - py_message = pygstminiobject_new((GstMiniObject *) message); - gst_mini_object_unref ((GstMiniObject *) message); - } else { - Py_INCREF(Py_None); - py_message = Py_None; - } - - py_args = PyTuple_New(1); - Py_INCREF(py_message); - PyTuple_SET_ITEM(py_args, 0, py_message); - - py_method = PyObject_GetAttrString(py_self, "do_handle_message"); - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_args); - gst_mini_object_ref ((GstMiniObject *) message); Py_DECREF(py_message); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return; - } - py_retval = PyObject_CallObject(py_method, py_args); - if (!py_retval) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_method); - Py_DECREF(py_args); - gst_mini_object_ref ((GstMiniObject *) message); Py_DECREF(py_message); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return; - } - if (py_retval != Py_None) { - if (PyErr_Occurred()) - PyErr_Print(); - PyErr_SetString(PyExc_TypeError, "retval should be None"); - Py_DECREF(py_retval); - Py_DECREF(py_method); - Py_DECREF(py_args); - gst_mini_object_ref ((GstMiniObject *) message); Py_DECREF(py_message); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return; - } - - - Py_DECREF(py_retval); - Py_DECREF(py_method); - Py_DECREF(py_args); - gst_mini_object_ref ((GstMiniObject *) message); Py_DECREF(py_message); - - /* #577735: since the bus handler will return BUS_DROP, we should unref. - This is the only change from the generated code. */ - gst_mini_object_unref ((GstMiniObject *) message); - - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); -} diff --git a/gst/gstbuffer.override b/gst/gstbuffer.override deleted file mode 100644 index c3c6ffe010..0000000000 --- a/gst/gstbuffer.override +++ /dev/null @@ -1,611 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2002 David I. Lehn - * Copyright (C) 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: Johan Dahlin - */ -%% -headers - -static Py_ssize_t gst_buffer_getreadbuffer (PyObject *self, - Py_ssize_t index, void **ptr); -static Py_ssize_t gst_buffer_getwritebuf (PyObject *self, - Py_ssize_t index, void **ptr); -static Py_ssize_t gst_buffer_getsegcount (PyObject *self, - Py_ssize_t *lenp); - -#if PY_VERSION_HEX >= 0x02050000 -static Py_ssize_t gst_buffer_getcharbuf (PyObject *self, - Py_ssize_t index, char **ptr); -#else -static Py_ssize_t gst_buffer_getcharbuf (PyObject *self, - Py_ssize_t index, const char **ptr); -#endif -%% -override gst_buffer_new kwargs -static int -_wrap_gst_buffer_new(PyGstMiniObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "data", "buffer_size", NULL }; - char *data = NULL; - int size = 0; - int buf_size = -1; - - GST_INFO("self:%p", self); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z#i:GstBuffer.__init__", kwlist, - &data, &size, &buf_size)) - return -1; - - if (size < 0) { - PyErr_SetString(PyExc_TypeError, "buffer size must be >= 0"); - return -1; - } - if (buf_size < 0) - buf_size = size; - if (buf_size < size) { - PyErr_SetString(PyExc_TypeError, "buffer size must be >= data size"); - return -1; - } - - self->obj = GST_MINI_OBJECT(gst_buffer_new_and_alloc(buf_size)); - GST_INFO ("pyo:%p pyr:%"G_GSSIZE_FORMAT" minio:%p minir:%d", - self, ((PyObject*)self)->ob_refcnt, - self->obj, GST_MINI_OBJECT_REFCOUNT_VALUE(self->obj)); - if (!self->obj) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstBuffer object"); - return -1; - } - pygstminiobject_register_wrapper((PyObject *) self); - - if (data == NULL) - return 0; - - memcpy (GST_BUFFER_DATA (self->obj), data, size); - GST_BUFFER_SIZE (self->obj) = size; - - return 0; -} -%% -override-slot GstBuffer.tp_str -static PyObject * -_wrap_gst_buffer_tp_str (PyGstMiniObject *self) -{ - GstBuffer *buf; - - g_assert (self); - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert (buf); - - return PyString_FromStringAndSize((const gchar*) GST_BUFFER_DATA(buf), - (gint) GST_BUFFER_SIZE(buf)); -} - -%% -override-slot GstBuffer.tp_repr -static PyObject * -_wrap_gst_buffer_tp_repr (PyGstMiniObject *self) -{ - GstBuffer *buf; - guchar *data; - gchar *repr; - gint size = 0; - PyObject *ret; - - g_assert (self); - buf = GST_BUFFER(self->obj); - g_assert (buf); - - size = GST_BUFFER_SIZE (buf); - - if (size == 0) { - repr = g_strdup_printf ("", buf, size); - } else { - data = GST_BUFFER_DATA (buf); - repr = g_strdup_printf ( - "", buf, size, - *data, - size > 0 ? *(data + 1) : 0, - size > 1 ? *(data + 2) : 0, - size > 2 ? *(data + 3) : 0 - ); - } - ret = PyString_FromStringAndSize(repr, strlen (repr)); - g_free (repr); - return ret; -} - -%% -override-slot GstBuffer.tp_as_buffer -static PyBufferProcs _wrap_gst_buffer_tp_as_buffer = { - gst_buffer_getreadbuffer, /* bf_getreadbuffer */ - gst_buffer_getwritebuf, /* bf_getwritebuffer */ - gst_buffer_getsegcount, /* bf_getsegcount */ - gst_buffer_getcharbuf, /* bf_getcharbuffer */ -}; - -static Py_ssize_t -gst_buffer_getreadbuffer(PyObject *self, Py_ssize_t index, - void **ptr) -{ - GstBuffer *buf = GST_BUFFER(pygstminiobject_get(self)); - - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent GstBuffer segment"); - return -1; - } - - *ptr = GST_BUFFER_DATA(buf); - return GST_BUFFER_SIZE(buf); -} - -static Py_ssize_t -gst_buffer_getsegcount(PyObject *self, Py_ssize_t *lenp) -{ - GstBuffer *buf = GST_BUFFER(pygstminiobject_get(self)); - - if (lenp) - *lenp = GST_BUFFER_SIZE(buf); - return 1; -} - -/* Need a version that has const char ** for Python 2.4 */ -#if PY_VERSION_HEX >= 0x02050000 -static Py_ssize_t gst_buffer_getcharbuf (PyObject *self, - Py_ssize_t index, char **ptr) -#else -static Py_ssize_t gst_buffer_getcharbuf (PyObject *self, - Py_ssize_t index, const char **ptr) -#endif -{ - return gst_buffer_getreadbuffer (self, index, (void **) ptr); -} - -static Py_ssize_t -gst_buffer_getwritebuf(PyObject *self, Py_ssize_t index, void **ptr) -{ - GstBuffer *buf = GST_BUFFER(pygstminiobject_get(self)); - - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent GstBuffer segment"); - return -1; - } - - if (!gst_buffer_is_writable (buf)) { - PyErr_SetString(PyExc_TypeError, - "buffer is not writable"); - return -1; - } - - *ptr = GST_BUFFER_DATA(buf); - return GST_BUFFER_SIZE(buf); -} - -%% -override-slot GstBuffer.tp_as_sequence -/* FIXME: should buffer parts be buffers or strings? */ - -static Py_ssize_t -pygst_buffer_length(PyObject *self) -{ - return GST_BUFFER_SIZE(pygobject_get (self)); -} - -static PyObject * -pygst_buffer_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end) -{ - GstBuffer *buf = GST_BUFFER (pygobject_get (self)); - if (start < 0) - start = 0; - if (end < 0) - end = 0; - if (end > GST_BUFFER_SIZE(buf)) - end = GST_BUFFER_SIZE(buf); - - if (end <= start) { - PyErr_SetString(PyExc_IndexError, "buffer index out of range"); - return NULL; - } - return PyString_FromStringAndSize((gchar *) GST_BUFFER_DATA (buf) + start, end - start); -} - -static PyObject * -pygst_buffer_item(PyObject *self, Py_ssize_t index) -{ - return pygst_buffer_slice (self, index, index + 1); -} - -static int -pygst_buffer_ass_slice (PyObject *self, Py_ssize_t start, - Py_ssize_t end, PyObject *val) -{ - GstBuffer *buf = GST_BUFFER (pygobject_get (self)); - const void *data; - Py_ssize_t len; - - if (!gst_buffer_is_writable (buf)) { - PyErr_SetString(PyExc_TypeError, "buffer is not writable"); - return -1; - } - /* FIXME: policy? */ - if (start < 0 || end <= start || end > GST_BUFFER_SIZE (buf)) { - PyErr_SetString(PyExc_IndexError, "buffer index out of range"); - return -1; - } - end -= start; - if (PyObject_AsReadBuffer(val, &data, &len)) - return -1; - if (len > end) - len = end; - memcpy (GST_BUFFER_DATA (buf) + start, data, len); - return 0; -} - -static int -pygst_buffer_ass_item (PyObject *self, Py_ssize_t index, PyObject *val) -{ - GstBuffer *buf = GST_BUFFER (pygobject_get (self)); - const void *data; - Py_ssize_t len; - - if (!gst_buffer_is_writable (buf)) { - PyErr_SetString(PyExc_TypeError, "buffer is not writable"); - return -1; - } - if (index < 0 || index > GST_BUFFER_SIZE (buf)) { - PyErr_SetString(PyExc_IndexError, "buffer index out of range"); - return -1; - } - if (PyObject_AsReadBuffer(val, &data, &len)) - return -1; - /* FIXME: how do we handle this? */ - if (len > GST_BUFFER_SIZE (buf) - index) - len = GST_BUFFER_SIZE (buf) - index; - memcpy (GST_BUFFER_DATA (buf) + index, data, len); - return 0; -} - -static PySequenceMethods _wrap_gst_buffer_tp_as_sequence = { - pygst_buffer_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - pygst_buffer_item, /* sq_item */ - pygst_buffer_slice, /* sq_slice */ - pygst_buffer_ass_item, /* sq_ass_item */ - pygst_buffer_ass_slice, /* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ -}; -%% -define GstBuffer.copy_on_write -static PyObject * -_wrap_gst_buffer_copy_on_write (PyObject *self) -{ - GstBuffer *buf = GST_BUFFER(pygstminiobject_get(self)); - - GST_INFO("INCREF"); - if (gst_buffer_is_writable (buf)) { - Py_INCREF (self); - return self; - } - buf = gst_buffer_copy (buf); - self = pygstminiobject_new ((GstMiniObject *)(buf)); - gst_buffer_unref (buf); - return self; -} -%% -define GstBuffer.flag_is_set -static PyObject * -_wrap_gst_buffer_flag_is_set(PyObject *self, PyObject *args) -{ - int flag; - PyObject *retval; - GstBuffer *buf; - - if (!PyArg_ParseTuple(args, "i:GstBuffer.flag_is_set", &flag)) - return NULL; - - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert(GST_IS_BUFFER(buf)); - - retval = GST_BUFFER_FLAG_IS_SET(buf, flag) ? Py_True : Py_False; - Py_INCREF(retval); - return retval; -} -%% -define GstBuffer.flag_set -static PyObject * -_wrap_gst_buffer_flag_set(PyObject *self, PyObject *args) -{ - int flag; - GstBuffer *buf; - - if (!PyArg_ParseTuple(args, "i:GstBuffer.set", &flag)) - return NULL; - - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert(GST_IS_BUFFER(buf)); - GST_BUFFER_FLAG_SET(buf, flag); - - Py_INCREF(Py_None); - return Py_None; -} -%% -define GstBuffer.flag_unset -static PyObject * -_wrap_gst_buffer_flag_unset(PyObject *self, PyObject *args) -{ - int flag; - GstBuffer *buf; - - if (!PyArg_ParseTuple(args, "i:GstBuffer.unset", &flag)) - return NULL; - - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert(GST_IS_BUFFER(buf)); - GST_BUFFER_FLAG_UNSET(buf, flag); - - Py_INCREF(Py_None); - return Py_None; -} - -%% -override-attr GstBuffer.data -static PyObject * -_wrap_gst_buffer__get_data(PyObject *self, void *closure) -{ - GstBuffer *buf; - - g_assert (self); - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert (buf); - - return PyString_FromStringAndSize((const gchar*) GST_BUFFER_DATA(buf), - (gint) GST_BUFFER_SIZE(buf)); -} - -%% -override-attr GstBuffer.size -static PyObject * -_wrap_gst_buffer__get_size(PyObject *self, void *closure) -{ - return PyLong_FromUnsignedLongLong((guint) GST_BUFFER_SIZE(GST_BUFFER(pygstminiobject_get(self)))); -} -static int -_wrap_gst_buffer__set_size(PyGstMiniObject *self, PyObject *value, void *closure) -{ - guint val; - GstBuffer *buf; - void* ptr; - - if (PyInt_CheckExact(value)) - val = PyInt_AsUnsignedLongLongMask(value); - else - val = PyLong_AsUnsignedLongLong(value); - if (PyErr_Occurred()) - return -1; - - g_assert (self); - buf = GST_BUFFER(pygstminiobject_get(self)); - g_assert (buf); - - ptr = realloc( GST_BUFFER_DATA(buf), val ); - if (ptr) - { - GST_BUFFER_DATA(buf) = ptr; - GST_BUFFER_SIZE(buf) = val; - } - else - { - /* Raise an error */ - PyErr_SetString( PyExc_RuntimeError, "Unable to realloc Buffer" ); - } - return 0; -} -%% -override-attr GstBuffer.timestamp -static PyObject * -_wrap_gst_buffer__get_timestamp(PyObject *self, void *closure) -{ - guint64 ret; - - ret = GST_BUFFER(pygstminiobject_get(self))->timestamp; - return PyLong_FromUnsignedLongLong(ret); -} -static int -_wrap_gst_buffer__set_timestamp(PyGstMiniObject *self, PyObject *value, void *closure) -{ - guint64 val; - - if (PyInt_CheckExact(value)) - val = PyInt_AsUnsignedLongLongMask(value); - else - val = PyLong_AsUnsignedLongLong(value); - if (PyErr_Occurred()) - return -1; - - GST_BUFFER(self->obj)->timestamp = val; - return 0; -} -%% -override-attr GstBuffer.duration -static PyObject * -_wrap_gst_buffer__get_duration(PyObject *self, void *closure) -{ - guint64 ret; - - ret = GST_BUFFER(pygstminiobject_get(self))->duration; - return PyLong_FromUnsignedLongLong(ret); -} -static int -_wrap_gst_buffer__set_duration(PyGstMiniObject *self, PyObject *value, void *closure) -{ - guint64 val; - - if (PyInt_CheckExact(value)) - val = PyInt_AsUnsignedLongLongMask(value); - else - val = PyLong_AsUnsignedLongLong(value); - if (PyErr_Occurred()) - return -1; - - GST_BUFFER(self->obj)->duration = val; - return 0; -} - -%% -override-attr GstBuffer.offset -static PyObject * -_wrap_gst_buffer__get_offset (PyObject *self, void *closure) -{ - guint64 ret; - GstMiniObject *miniobject; - g_assert (self); - - miniobject = pygstminiobject_get (self); - g_assert (miniobject); - - ret = GST_BUFFER_OFFSET (GST_BUFFER (miniobject)); - return PyLong_FromUnsignedLongLong (ret); -} - -static int -_wrap_gst_buffer__set_offset (PyGstMiniObject *self, PyObject *value, void *closure) -{ - guint64 val; - g_assert (self); - - if (PyInt_CheckExact (value)) - val = PyInt_AsUnsignedLongLongMask (value); - else - val = PyLong_AsUnsignedLongLong (value); - if (PyErr_Occurred()) - return -1; - - GST_BUFFER_OFFSET (GST_BUFFER (self->obj)) = val; - return 0; -} - -%% -override-attr GstBuffer.offset_end -static PyObject * -_wrap_gst_buffer__get_offset_end (PyObject *self, void *closure) -{ - guint64 ret; - GstMiniObject *miniobject; - g_assert (self); - - miniobject = pygstminiobject_get (self); - g_assert (miniobject); - - ret = GST_BUFFER_OFFSET_END (GST_BUFFER (miniobject)); - return PyLong_FromUnsignedLongLong (ret); -} - -static int -_wrap_gst_buffer__set_offset_end (PyGstMiniObject *self, PyObject *value, void *closure) -{ - guint64 val; - g_assert (self); - - if (PyInt_CheckExact (value)) - val = PyInt_AsUnsignedLongLongMask (value); - else - val = PyLong_AsUnsignedLongLong (value); - if (PyErr_Occurred ()) - return -1; - - GST_BUFFER_OFFSET_END (GST_BUFFER (self->obj)) = val; - return 0; -} - -%% -override gst_buffer_stamp kwargs -static PyObject * -_wrap_gst_buffer_stamp (PyGstMiniObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "src", NULL }; - PyGstMiniObject *srcobj; - GstBuffer *dest, *src; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, - "O:GstBuffer.stamp", - kwlist, &srcobj)) - return NULL; - dest = GST_BUFFER(pygstminiobject_get(self)); - src = GST_BUFFER(pygstminiobject_get(srcobj)); - gst_buffer_stamp (dest, (const GstBuffer*) src); - - Py_INCREF(Py_None); - return Py_None; -} -%% -override-attr GstBuffer.caps -static PyObject * -_wrap_gst_buffer__get_caps (PyObject *self, void *closure) -{ - GstMiniObject *miniobject; - GstCaps *ret; - - miniobject = pygstminiobject_get (self); - g_assert (miniobject); - - pyg_begin_allow_threads; - ret = gst_buffer_get_caps(GST_BUFFER(miniobject)); - pyg_end_allow_threads; - return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE); -} -static int -_wrap_gst_buffer__set_caps (PyGstMiniObject *self, PyObject *value, void *closure) -{ - GstCaps *caps; - g_assert (self); - - caps = pygst_caps_from_pyobject (value, NULL); - if (PyErr_Occurred()) - return -1; - pyg_begin_allow_threads; - gst_buffer_set_caps(GST_BUFFER(self->obj), caps); - gst_caps_unref (caps); - pyg_end_allow_threads; - return 0; -} -%% -override gst_buffer_set_caps kwargs -static PyObject * -_wrap_gst_buffer_set_caps(PyGstMiniObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "caps", NULL }; - PyObject *py_caps; - GstCaps *caps; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstBuffer.set_caps", kwlist, &py_caps)) - return NULL; - caps = pygst_caps_from_pyobject (py_caps, NULL); - if (PyErr_Occurred()) - return NULL; - pyg_begin_allow_threads; - gst_buffer_set_caps(GST_BUFFER(self->obj), caps); - gst_caps_unref (caps); - pyg_end_allow_threads; - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstbus.override b/gst/gstbus.override deleted file mode 100644 index 23db49541d..0000000000 --- a/gst/gstbus.override +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vi:si:et:sw=4:sts=4:ts=4 - * - * gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Edward Hervey - */ -%% -ignore - gst_bus_create_watch - gst_bus_sync_signal_handler - gst_bus_async_signal_func -%% -headers -static GstBusSyncReply -bus_sync_handler (GstBus *bus, GstMessage *message, gpointer user_data) -{ - PyGILState_STATE state; - GstBusSyncReply res; - PyObject *py_userdata; - PyObject *py_msg; - PyObject *callback, *args; - PyObject *ret; - gint i, len; - - g_return_val_if_fail (user_data != NULL, GST_BUS_PASS); - - state = pyg_gil_state_ensure (); - - py_userdata = (PyObject *) user_data; - py_msg = pygstminiobject_new (GST_MINI_OBJECT (message)); - callback = PyTuple_GetItem (py_userdata, 0); - - /* Using N we give away our references to the args tuple */ - args = Py_BuildValue ("(NN)", - pygobject_new (G_OBJECT (bus)), - py_msg); - - /* add all *args to the args tuple object */ - len = PyTuple_Size (py_userdata); - for (i = 1; i < len; ++i) { - PyObject *tuple = args; - args = PySequence_Concat (tuple, PyTuple_GetItem (py_userdata, i)); - Py_DECREF (tuple); - } - ret = PyObject_CallObject (callback, args); - - if (!ret) { - PyErr_Print (); - res = GST_BUS_PASS; - } else { - if (ret == Py_None) { - PyErr_SetString (PyExc_TypeError, - "callback should return a BusSyncReply"); - PyErr_Print (); - res = GST_BUS_PASS; - } else if (pyg_enum_get_value (GST_TYPE_BUS_SYNC_REPLY, ret, - (gint *) &res)) - res = GST_BUS_PASS; - - Py_DECREF (ret); - } - Py_DECREF (args); - - pyg_gil_state_release (state); - - return res; -} - -static gboolean -bus_func (GstBus *bus, GstMessage *message, gpointer user_data) -{ - PyGILState_STATE state; - gboolean res; - PyObject *py_userdata; - PyObject *py_msg; - PyObject *callback, *args; - PyObject *ret; - gint i, len; - - g_return_val_if_fail (user_data != NULL, TRUE); - - GST_DEBUG_OBJECT (bus, "dispatching message %p", message); - - state = pyg_gil_state_ensure (); - - py_userdata = (PyObject *) user_data; - g_assert (PyTuple_Check (py_userdata)); - - py_msg = pygstminiobject_new (GST_MINI_OBJECT (message)); - callback = PyTuple_GetItem (py_userdata, 0); - - /* Using N we give away our references to the args tuple */ - args = Py_BuildValue ("(NN)", - pygobject_new (G_OBJECT (bus)), - py_msg); - g_assert (args); - - /* add all *args to the args tuple object */ - len = PyTuple_Size (py_userdata); - for (i = 1; i < len; ++i) { - PyObject *item; - PyObject *tuple = args; - - item = PyTuple_GetItem (py_userdata, i); - g_assert (item); - - args = PySequence_Concat (tuple, item); - g_assert (args); - - Py_DECREF (tuple); - } - ret = PyObject_CallObject(callback, args); - - if (!ret) { - PyErr_Print (); - res = TRUE; - } else { - if (ret == Py_None) { - PyErr_SetString (PyExc_TypeError, - "callback should return True or False"); - PyErr_Print (); - res = TRUE; - } else - res = PyObject_IsTrue (ret); - Py_DECREF (ret); - } - Py_DECREF (args); - - pyg_gil_state_release (state); - - GST_DEBUG_OBJECT (bus, "dispatched message %p", message); - - return res; -} - -%% -override gst_bus_set_sync_handler args -static PyObject * -_wrap_gst_bus_set_sync_handler (PyGObject *self, PyObject *args) -{ - PyObject *callback = NULL; - PyObject *cbargs = NULL; - PyObject *data = NULL; - PyObject *old_data = NULL; - gint len; - static GQuark sync_handler_data_quark = 0; - - len = PyTuple_Size(args); - - if (len < 1) { - PyErr_SetString(PyExc_TypeError, "Bus requires at least 1 arg"); - return NULL; - } - - if (sync_handler_data_quark == 0) - sync_handler_data_quark = \ - g_quark_from_static_string("PyGst::BusSyncHandlerData"); - - callback = PySequence_GetItem(args, 0); - if (callback != Py_None) { - if (!PyCallable_Check(callback)) { - Py_DECREF (callback); - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - - cbargs = PySequence_GetSlice(args, 1, len); - if (cbargs == NULL) { - Py_DECREF (callback); - return NULL; - } - - data = Py_BuildValue("(ON)", callback, cbargs); - Py_DECREF (cbargs); - if (data == NULL) { - Py_DECREF (callback); - return NULL; - } - - old_data = g_object_get_qdata (self->obj, sync_handler_data_quark); - if (old_data != NULL) { - Py_DECREF (old_data); - } - - g_object_set_qdata (self->obj, sync_handler_data_quark, data); - - gst_bus_set_sync_handler (GST_BUS (self->obj), - (GstBusSyncHandler) bus_sync_handler, - data); - } else { - old_data = g_object_get_qdata (self->obj, sync_handler_data_quark); - if (old_data != NULL) { - Py_DECREF (old_data); - } - - g_object_set_qdata (self->obj, sync_handler_data_quark, NULL); - - gst_bus_set_sync_handler (GST_BUS (self->obj), NULL, NULL); - } - - Py_DECREF (callback); - - Py_INCREF(Py_None); - return Py_None; -} -%% -override gst_bus_add_watch args -static PyObject * -_wrap_gst_bus_add_watch (PyGObject *self, PyObject *args) -{ - PyObject *callback, *cbargs = NULL, *data; - guint sigid; - guint len; - - len = PyTuple_Size(args); - - if (len < 1) { - PyErr_SetString(PyExc_TypeError, "Bus.add_watch requires at least 1 argument"); - return NULL; - } - - callback = PySequence_GetItem(args, 0); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - cbargs = PySequence_GetSlice(args, 1, len); - if (cbargs == NULL) - return NULL; - /* FIXME: thomas: I'm pretty sure the second N needs to be O */ - data = Py_BuildValue("(ON)", callback, cbargs); - if (data == NULL) - return NULL; - - sigid = gst_bus_add_watch_full (GST_BUS (self->obj), G_PRIORITY_DEFAULT, - (GstBusFunc) bus_func, data, (GDestroyNotify)pyg_destroy_notify); - - return PyInt_FromLong(sigid); -} -%% -override gst_bus_add_signal_watch kwargs -static PyObject * -_wrap_gst_bus_add_signal_watch(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "priority", NULL }; - int priority = G_PRIORITY_DEFAULT; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:GstBus.add_signal_watch", kwlist, &priority)) - return NULL; - pyg_begin_allow_threads; - gst_bus_add_signal_watch_full(GST_BUS(self->obj), priority); - pyg_end_allow_threads; - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstcaps.override b/gst/gstcaps.override deleted file mode 100644 index 77e3d848c6..0000000000 --- a/gst/gstcaps.override +++ /dev/null @@ -1,474 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2005 Johan Dahlin - * 2005 Benjamin Otte - * - * 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: Johan Dahlin - * Benjamin Otte - */ -%% -headers -/* This is a (hopefully) smart hack to allow access to a caps' - * structures without falling into traps when the caps get destroyed - * before the structures get. - * This Hash Table uses the structure PyObjects as keys and the caps - * PyObjects as values. No clue if this is a fast data structure but it - * probably doesn't matter anyway. - */ -static GHashTable *structure_caps_map = NULL; - -static void -pygst_caps_map_add (PyObject *structure, PyObject *caps) -{ - /* we can't have free_on_dealloc stuff in here */ - g_assert (((PyGBoxed *)structure)->free_on_dealloc == FALSE); - g_hash_table_insert (structure_caps_map, structure, caps); -} - -static void -pygst_caps_map_remove_structure (PyObject *structure) -{ - g_hash_table_remove (structure_caps_map, structure); -} - -static gboolean -pygst_caps_map_foreach (gpointer structure, gpointer caps, gpointer match) -{ - PyGBoxed *boxed = structure; - - if (match != caps) - return FALSE; - - /* we can't have free_on_dealloc stuff in here */ - g_assert (boxed->free_on_dealloc == FALSE); - boxed->boxed = gst_structure_copy (boxed->boxed); - boxed->free_on_dealloc = TRUE; - return TRUE; -} - -static void -pygst_caps_map_modified (PyObject *caps) -{ - g_hash_table_foreach_remove (structure_caps_map, pygst_caps_map_foreach, caps); -} - -%% -init - structure_caps_map = g_hash_table_new (g_direct_hash, g_direct_equal); -%% -ignore - gst_caps_new_simple - gst_caps_new_full - gst_caps_set_simple -%% -override gst_caps_get_structure kwargs -static PyObject *pygst_caps_sq_item(PyObject *self, Py_ssize_t i); -static PyObject * -_wrap_gst_caps_get_structure(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "index", NULL }; - int index; - - if (PyErr_Warn(PyExc_DeprecationWarning, "caps.get_structure(i) is deprecated, use caps[i]") < 0) - return NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GstCaps.get_structure", kwlist, &index)) - return NULL; - return pygst_caps_sq_item (self, index); -} -%% -override gst_caps_new_empty kwargs -static int -_wrap_gst_caps_new_empty(PyGBoxed *self, PyObject *args, PyObject *kwargs) -{ - PyObject* item; - int len, i; - - /* we wrap caps_new, caps_from_string and caps_new_full */ - len = PyTuple_Size(args); - self->gtype = GST_TYPE_CAPS; - self->free_on_dealloc = TRUE; - - if (len == 0) { - /* 0 length creates a new empty caps */ - self->boxed = gst_caps_new_empty(); - } else if (len == 1) { - item = PyTuple_GetItem(args, 0); - /* 1 length is either a string or a structure */ - self->boxed = pygst_caps_from_pyobject (item, NULL); - } else { - /* it's multiple arguments that can all be made to caps */ - GstCaps *append; - self->boxed = gst_caps_new_empty(); - for (i = 0; i < len; i++) - { - item = PyTuple_GetItem(args, i); - append = pygst_caps_from_pyobject (item, NULL); - if (!append) { - gst_caps_unref (self->boxed); - self->boxed = NULL; - break; - } - gst_caps_append (self->boxed, append); - } - } - if (!self->boxed) { - PyErr_SetString(PyExc_TypeError, "wrong arguments when creating GstCaps object"); - return -1; - } - return 0; -} - -%% -override-slot GstCaps.tp_richcompare - -static gboolean -pygst_caps_is_true_subset (GstCaps *caps1, GstCaps *caps2) -{ - GstCaps *tmp; - gboolean ret; - - /* order is important here */ - if (gst_caps_is_any (caps1)) - return FALSE; - if (gst_caps_is_any (caps2)) - return TRUE; - if (gst_caps_is_empty (caps2)) - return FALSE; - if (gst_caps_is_empty (caps1)) - return TRUE; - - tmp = gst_caps_subtract (caps1, caps2); - ret = gst_caps_is_empty (tmp); - gst_caps_unref (tmp); - if (!ret) - return FALSE; - tmp = gst_caps_subtract (caps2, caps1); - ret = gst_caps_is_empty (tmp); - gst_caps_unref (tmp); - return !ret; -} - -static PyObject * -_wrap_gst_caps_tp_richcompare (PyObject *py_caps1, PyObject *py_caps2, int comparison) -{ - GstCaps *caps1, *caps2; - gboolean caps2_is_copy; - PyObject *ret; - - caps1 = pyg_boxed_get (py_caps1, GstCaps); - caps2 = pygst_caps_from_pyobject (py_caps2, &caps2_is_copy); - if (PyErr_Occurred()) { - /* the second arg is not a caps */ - switch (comparison) { - case Py_EQ: - PyErr_Clear(); - ret = Py_False; - Py_INCREF (ret); - return ret; - case Py_NE: - PyErr_Clear(); - ret = Py_True; - Py_INCREF (ret); - return ret; - default: - return NULL; - } - } - - switch (comparison) { - case Py_LT: - ret = pygst_caps_is_true_subset (caps1, caps2) ? Py_True : Py_False; - break; - case Py_LE: - ret = gst_caps_is_subset (caps1, caps2) ? Py_True : Py_False; - break; - case Py_NE: - ret = gst_caps_is_equal (caps1, caps2) ? Py_False : Py_True; - break; - case Py_EQ: - ret = gst_caps_is_equal (caps1, caps2) ? Py_True : Py_False; - break; - case Py_GE: - ret = gst_caps_is_subset (caps2, caps1) ? Py_True : Py_False; - break; - case Py_GT: - ret = pygst_caps_is_true_subset (caps2, caps1) ? Py_True : Py_False; - break; - default: - PyErr_SetString (PyExc_RuntimeError, "invalid comparison operation"); - if (caps2 && caps2_is_copy) - gst_caps_unref (caps2); - return NULL; - } - if (caps2 && caps2_is_copy) - gst_caps_unref (caps2); - - Py_INCREF (ret); - return ret; -} - -%% -override-slot GstCaps.tp_as_number - -/* In this number code, we mimic the Python set.Set datatype. - * The same operations are supported. If you want to have an operation - * supported for caps, add it to Python's Set type first. - */ -#define BINARY_FUNC(name,func) \ -static PyObject * \ -name (PyObject *py_caps1, PyObject *py_caps2) \ -{ \ - GstCaps *caps1, *caps2, *ret; \ - gboolean caps2_is_copy; \ -\ - caps1 = pyg_boxed_get (py_caps1, GstCaps); \ - caps2 = pygst_caps_from_pyobject (py_caps2, &caps2_is_copy); \ - if (PyErr_Occurred()) \ - return NULL; \ - ret = func (caps1, caps2); \ - if (caps2 && caps2_is_copy) \ - gst_caps_unref (caps2); \ - return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE); \ -} - -BINARY_FUNC (pygst_caps_nb_subtract, gst_caps_subtract) -BINARY_FUNC (pygst_caps_nb_and, gst_caps_intersect) -BINARY_FUNC (pygst_caps_nb_or, gst_caps_union) -static GstCaps * -pygst_caps_xor (const GstCaps *caps1, const GstCaps *caps2) -{ - GstCaps *intersect, *_union, *ret; - intersect = gst_caps_intersect (caps1, caps2); - _union = gst_caps_union (caps1, caps2); - ret = gst_caps_subtract (_union, intersect); - gst_caps_unref (_union); - gst_caps_unref (intersect); - gst_caps_do_simplify (ret); - return ret; -} -BINARY_FUNC (pygst_caps_nb_xor, pygst_caps_xor) - -static int -pygst_caps_nb_nonzero (PyObject *py_caps) -{ - GstCaps *caps = pyg_boxed_get (py_caps, GstCaps); - - if (gst_caps_is_empty (caps)) - return 0; - else - return 1; -} - -static int -pygst_caps_nb_coerce (PyObject **py_caps1, PyObject **py_caps2) -{ - GstCaps *caps1, *caps2 = NULL; - gboolean caps1_is_copy, caps2_is_copy; - - caps1 = pygst_caps_from_pyobject (*py_caps1, &caps1_is_copy); - if (!caps1) - goto error; - caps2 = pygst_caps_from_pyobject (*py_caps2, &caps2_is_copy); - if (!caps2) - goto error; - /* if they're not copies, they're caps already */ - if (caps1_is_copy) - *py_caps1 = pyg_boxed_new (GST_TYPE_CAPS, caps1, FALSE, TRUE); - else - Py_INCREF (*py_caps1); - if (caps2_is_copy) - *py_caps2 = pyg_boxed_new (GST_TYPE_CAPS, caps2, FALSE, TRUE); - else - Py_INCREF (*py_caps2); - return 0; - -error: - g_assert (PyErr_Occurred ()); - PyErr_Clear (); - if (caps1 && !caps1_is_copy) - gst_caps_unref (caps1); - return 1; -} - -static PyNumberMethods _wrap_gst_caps_tp_as_number = { - 0, /* nb_add */ - pygst_caps_nb_subtract, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - pygst_caps_nb_nonzero, /* nb_nonzero */ - 0, /* nb_invert */ - 0, /* nb_lshift */ - 0, /* nb_rshift */ - pygst_caps_nb_and, /* nb_and */ - pygst_caps_nb_xor, /* nb_xor */ - pygst_caps_nb_or, /* nb_or */ - pygst_caps_nb_coerce, /* nb_coerce */ - 0, /* nb_int */ - 0, /* nb_long */ - 0, /* nb_float */ - 0, /* nb_oct */ - 0, /* nb_hex */ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_divide */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - 0, /* nb_floor_divide */ - 0, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ -}; -%% -override-slot GstCaps.tp_as_sequence -static Py_ssize_t -pygst_caps_sq_length(PyObject *self) -{ - GstCaps *caps = pyg_boxed_get (self, GstCaps); - return gst_caps_get_size(caps); -} - -static PyObject * -pygst_caps_sq_item(PyObject *self, Py_ssize_t i) -{ - GstCaps *caps = pyg_boxed_get (self, GstCaps); - GstStructure *structure; - PyObject *ret; - - if (i < 0 || i >= gst_caps_get_size(caps)) { - PyErr_SetString(PyExc_IndexError, "list index out of range"); - return NULL; - } - - structure = gst_caps_get_structure(caps, i); - - /* pyg_boxed_new handles NULL checking */ - ret = pyg_boxed_new(GST_TYPE_STRUCTURE, - structure, - FALSE, FALSE); - if (ret) - pygst_caps_map_add (ret, self); - return ret; -} - -/* FIXME: This syntax sucks */ -static PyObject * -pygst_caps_sq_slice(PyObject *self, Py_ssize_t start, Py_ssize_t end) -{ - GstCaps *caps = pyg_boxed_get (self, GstCaps); - GstCaps *ret = gst_caps_new_empty (); - int i; - - if (start < 0) - start = 0; - if (end > gst_caps_get_size (caps)) - end = gst_caps_get_size (caps); - - for (i = start; i < end; i++) - gst_caps_append_structure (ret, gst_structure_copy (gst_caps_get_structure (caps, i))); - - return pyg_boxed_new(GST_TYPE_CAPS, ret, FALSE, TRUE); -} - -static PySequenceMethods _wrap_gst_caps_tp_as_sequence = { - pygst_caps_sq_length, - NULL, /* not allowed for sets, use | instead of + */ - NULL, /* doesn't make sense, because it'd still be the same */ - pygst_caps_sq_item, - pygst_caps_sq_slice, - NULL, /* doesn't make sense, you can only append */ - NULL, /* doesn't make sense, you can only append */ - NULL, /* doesn't make sense really, unless you use is_subset */ - NULL, /* not allowed for sets, use | instead of + */ - NULL /* doesn't make sense, because it'd still be the same */ -}; -%% -override-slot GstCaps.tp_dealloc -static void -_wrap_gst_caps_tp_dealloc (PyObject *self) -{ - PyGBoxed *boxed = (PyGBoxed *) self; - - if (boxed->free_on_dealloc && boxed->boxed) { - pygst_caps_map_modified (self); - GST_DEBUG ("unreffing caps %" GST_PTR_FORMAT " at %p with refcount %d", - boxed->boxed, boxed->boxed, GST_CAPS_REFCOUNT (boxed->boxed)); - gst_caps_unref (boxed->boxed); - } - - self->ob_type->tp_free((PyObject *)self); -} - -%% -override-slot GstCaps.tp_str -static PyObject * -_wrap_gst_caps_tp_str(PyGObject *self) -{ - gchar *tmp; - PyObject *retval; - - tmp = gst_caps_to_string((GstCaps*)self->obj); - retval = PyString_FromString(tmp); - g_free(tmp); - - return retval; -} - -%% -override-attr GstCaps.__refcount__ - -static PyObject * -_wrap_gst_caps__get___refcount__(PyGObject *self, void *closure) -{ - return PyInt_FromLong(GST_CAPS_REFCOUNT(self->obj)); -} - -%% -override gst_caps_append_structure kwargs -static PyObject * -_wrap_gst_caps_append_structure(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "structure", NULL }; - PyObject *py_structure; - GstStructure *structure = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GstCaps.append_structure", kwlist, &py_structure)) - return NULL; - if (pyg_boxed_check(py_structure, GST_TYPE_STRUCTURE)) - structure = gst_structure_copy(pyg_boxed_get(py_structure, GstStructure)); - else { - PyErr_SetString(PyExc_TypeError, "structure should be a GstStructure"); - return NULL; - } - pyg_begin_allow_threads; - gst_caps_append_structure(pyg_boxed_get(self, GstCaps), structure); - pyg_end_allow_threads; - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstelement.override b/gst/gstelement.override deleted file mode 100644 index e8dc0ab055..0000000000 --- a/gst/gstelement.override +++ /dev/null @@ -1,637 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 8 -*- */ -/* gst-python - * Copyright (C) 2005 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: Johan Dahlin - */ -%% -ignore - gst_element_get - gst_element_set - gst_element_get_property - gst_element_set_property -%% -override gst_element_get_pad_template args -static PyObject * -_wrap_gst_element_get_pad_template(PyGObject *self, PyObject *args) -{ - PyObject *ret; - gchar *name; - GstPadTemplate *tmpl; - - if (!PyArg_ParseTuple(args, "s:GstElement.get_pad_template", &name)) - return NULL; - - pyg_begin_allow_threads; - tmpl = gst_element_class_get_pad_template - (GST_ELEMENT_GET_CLASS (self->obj), name); - pyg_end_allow_threads; - - if (tmpl) { - ret = pygobject_new (G_OBJECT (tmpl)); - } else { - ret = Py_None; - Py_INCREF (ret); - } - - return ret; -} -%% -override gst_element_set_state kwargs -static PyObject * -_wrap_gst_element_set_state(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "state", NULL }; - PyObject *py_state = NULL; - GstState state; - gint ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstElement.set_state", kwlist, &py_state)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_STATE, py_state, (gint *)&state)) - return NULL; - - pyg_begin_allow_threads; - - ret = gst_element_set_state(GST_ELEMENT(self->obj), state); - - pyg_end_allow_threads; - - return pyg_enum_from_gtype(GST_TYPE_STATE_CHANGE_RETURN, ret); -} -%% -override gst_element_get_state kwargs -static PyObject * -_wrap_gst_element_get_state(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "timeout", NULL }; - GstState state; - GstState pending; - GstStateChangeReturn ret; - GstClockTime timeout = GST_CLOCK_TIME_NONE; - PyObject *tuple; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "|K:GstElement.get_state", kwlist, - &timeout)) { - PyErr_SetString(PyExc_RuntimeError, "Timeout not specified correctly"); - return NULL; - } - - pyg_begin_allow_threads; - - ret = gst_element_get_state(GST_ELEMENT (self->obj), &state, &pending, - timeout); - - pyg_end_allow_threads; - - tuple = Py_BuildValue("(OOO)", - pyg_enum_from_gtype (GST_TYPE_STATE_CHANGE_RETURN, ret), - pyg_enum_from_gtype (GST_TYPE_STATE, state), - pyg_enum_from_gtype (GST_TYPE_STATE, pending)); - - return tuple; -} -%% -override gst_element_link_many args -static PyObject * -_wrap_gst_element_link_many(PyObject *self, PyObject *args) -{ - PyGObject *element, *element2; - int i, len; - - len = PyTuple_Size(args); - if (len < 2) - { - PyErr_SetString(PyExc_TypeError, "gst.element_link_many requires at least two argument"); - return NULL; - } - - - for (i = 0; i < len; i++) - { - element = (PyGObject*)PyTuple_GetItem(args, i); - if (!pygobject_check(element, &PyGstElement_Type)) - { - PyErr_SetString(PyExc_TypeError, "argument must be a GstElement"); - return NULL; - } - } - - /* Mimic the real gst_element_link_many */ - element = (PyGObject*)PyTuple_GetItem(args, 0); - element2 = (PyGObject*)PyTuple_GetItem(args, 1); - - i = 2; - while (1) { - gboolean res; - - pyg_begin_allow_threads; - res = gst_element_link(GST_ELEMENT(element->obj), - GST_ELEMENT(element2->obj)); - pyg_end_allow_threads; - - if (!res) - { - PyErr_Format(PyGstExc_LinkError, - "failed to link %s with %s", - GST_ELEMENT_NAME(element->obj), - GST_ELEMENT_NAME(element2->obj)); - return NULL; - } - - if (i >= len) - break; - - element = element2; - element2 = (PyGObject*)PyTuple_GetItem(args, i); - - i++; - } - - Py_INCREF(Py_True); - return Py_True; -} - - -%% -override gst_element_link kwargs -static PyObject * -_wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "dest", "filtercaps", NULL }; - PyGObject *dest; - PyObject *py_caps = NULL; - int ret; - GstCaps *caps = NULL; - gboolean caps_is_copy; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link", - kwlist, &PyGstElement_Type, &dest, &py_caps)) - return NULL; - if (py_caps == NULL) - caps = NULL; - else { - caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy); - if (caps == NULL) - /* an error happened, propagate up */ - return NULL; - } - - pyg_begin_allow_threads; - ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps); - pyg_end_allow_threads; - - if (caps && caps_is_copy) - gst_caps_unref (caps); - if (!ret) { - PyErr_Format(PyGstExc_LinkError, - "failed to link %s with %s", - GST_ELEMENT_NAME(self->obj), - GST_ELEMENT_NAME(dest->obj)); - return NULL; - } - return PyBool_FromLong(ret); -} - -%% -override gst_element_link_filtered kwargs -static PyObject * -_wrap_gst_element_link_filtered(PyGObject *self, PyObject *args, - PyObject *kwargs) -{ - if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0) - return NULL; - return _wrap_gst_element_link (self, args, kwargs); -} - -%% -override gst_element_link_pads kwargs -static gboolean -pad_name_from_object (PyObject *object, const gchar **name) -{ - if (object == Py_None) { - *name = NULL; - return TRUE; - } else if (PyString_Check (object)) { - *name = PyString_AsString (object); - return TRUE; - } else if (pygobject_check (object, &PyGstPad_Type)) { - GstObject *obj = GST_OBJECT (pygobject_get (object)); - pyg_begin_allow_threads; - *name = gst_object_get_name (obj); - pyg_end_allow_threads; - return TRUE; - } - PyErr_SetString(PyExc_TypeError, "argument could not be converted to a pad"); - return FALSE; -} - -static PyObject * -_wrap_gst_element_link_pads(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "srcpadname", "dest", "destpadname", NULL }; - const char *srcpadname, *destpadname; - PyGObject *dest; - PyObject *srcpad, *destpad; - int ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "OO!O:GstElement.link_pads", kwlist, - &srcpad, &PyGstElement_Type, &dest, - &destpad)) - return NULL; - if (!pad_name_from_object (srcpad, &srcpadname) || - !pad_name_from_object (destpad, &destpadname)) - return NULL; - - pyg_begin_allow_threads; - ret = gst_element_link_pads(GST_ELEMENT(self->obj), srcpadname, - GST_ELEMENT(dest->obj), destpadname); - pyg_end_allow_threads; - if (!ret) { - PyErr_SetString(PyGstExc_LinkError, "link failed"); - return NULL; - } - return PyBool_FromLong(ret); - -} - -%% -override gst_element_link_pads_filtered kwargs -static PyObject * -_wrap_gst_element_link_pads_filtered(PyGObject *self, PyObject *args, - PyObject *kwargs) -{ - static char *kwlist[] = { "srcpadname", "dest", "destpadname", - "filtercaps", NULL }; - char *srcpadname, *destpadname; - PyGObject *dest; - int ret; - PyObject *py_filtercaps; - GstCaps *filtercaps = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "sO!sO:GstElement.link_pads_filtered", - kwlist, &srcpadname, &PyGstElement_Type, - &dest, &destpadname, &py_filtercaps)) - return NULL; - if (pyg_boxed_check(py_filtercaps, GST_TYPE_CAPS)) - filtercaps = pyg_boxed_get(py_filtercaps, GstCaps); - else { - PyErr_SetString(PyExc_TypeError, "filtercaps should be a GstCaps"); - return NULL; - } - pyg_begin_allow_threads; - ret = gst_element_link_pads_filtered(GST_ELEMENT(self->obj), srcpadname, - GST_ELEMENT(dest->obj), destpadname, - filtercaps); - pyg_end_allow_threads; - if (!ret) { - PyErr_SetString(PyGstExc_LinkError, "link failed"); - return NULL; - } - return PyBool_FromLong(ret); -} - -%% -override gst_element_unlink_many args -static PyObject * -_wrap_gst_element_unlink_many(PyObject *self, PyObject *args) -{ - PyGObject *element, *element2; - int i, len; - - len = PyTuple_Size(args); - if (len < 2) - { - PyErr_SetString(PyExc_TypeError, "gst.element_unlink_many requires at least two arguments"); - return NULL; - } - - - for (i = 0; i < len; i++) - { - element = (PyGObject*)PyTuple_GetItem(args, i); - if (!pygobject_check(element, &PyGstElement_Type)) - { - PyErr_SetString(PyExc_TypeError, "argument must be a GstElement"); - return NULL; - } - } - - /* Mimic the real gst_element_unlink_many */ - element = (PyGObject*)PyTuple_GetItem(args, 0); - element2 = (PyGObject*)PyTuple_GetItem(args, 1); - - i = 2; - while (1) { - pyg_begin_allow_threads; - gst_element_unlink(GST_ELEMENT(element->obj), GST_ELEMENT(element2->obj)); - pyg_end_allow_threads; - - if (i >= len) - break; - - element = element2; - element2 = (PyGObject*)PyTuple_GetItem(args, i); - - i++; - } - Py_INCREF(Py_None); - return Py_None; -} -%% -override gst_element_send_event kwargs -static PyObject * -_wrap_gst_element_send_event(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "event", NULL }; - PyObject *py_event; - int ret; - GstEvent *event = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstElement.send_event", kwlist, &py_event)) - return NULL; - if (pygstminiobject_check (py_event, &PyGstEvent_Type)) { - event = GST_EVENT (pygstminiobject_get (py_event)); - } else { - PyErr_SetString(PyExc_TypeError, "event should be a GstEvent"); - return NULL; - } - - /* The pipeline unrefs the event, but we want to keep the ownership */ - gst_event_ref(event); - - pyg_begin_allow_threads; - ret = gst_element_send_event(GST_ELEMENT(self->obj), event); - pyg_end_allow_threads; - - return PyBool_FromLong(ret); -} -%% -override gst_element_query_position args -static PyObject * -_wrap_gst_element_query_position (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - gboolean res; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - pyg_begin_allow_threads; - res = gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur); - pyg_end_allow_threads; - - if (!res) { - PyErr_Format(PyGstExc_QueryError, - "query failed"); - return NULL; - } - - return Py_BuildValue("(LO)", cur, - pyg_enum_from_gtype(GST_TYPE_FORMAT, format)); -} -%% -override gst_element_query_duration args -static PyObject * -_wrap_gst_element_query_duration (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - gboolean res; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - pyg_begin_allow_threads; - res = gst_element_query_duration(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur); - pyg_end_allow_threads; - - if (!res) { - PyErr_Format(PyGstExc_QueryError, - "query failed"); - return NULL; - } - - return Py_BuildValue("(LO)", cur, - pyg_enum_from_gtype(GST_TYPE_FORMAT, format)); -} -%% -override gst_element_query_convert kwargs -static PyObject * -_wrap_gst_element_query_convert (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "fromformat", "fromvalue", "destformat", NULL }; - PyObject *pfromformat, *pdestformat; - GstFormat srcformat, destformat; - gint64 fromval, dstval; - gboolean res; - - /* Input : src_format, src_val, dst_format */ - /* Returns : dst_format, dst_val OR None */ - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "OLO:GstElement.query_convert", - kwlist, &pfromformat, &fromval, &pdestformat)) - return NULL; - - if (pyg_enum_get_value(GST_TYPE_FORMAT, pfromformat, (gint *) &srcformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - if (pyg_enum_get_value(GST_TYPE_FORMAT, pdestformat, (gint *) &destformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - pyg_begin_allow_threads; - res = gst_element_query_convert (GST_ELEMENT(self->obj), - srcformat, fromval, - &destformat, &dstval); - pyg_end_allow_threads; - - if (!res) { - Py_INCREF(Py_None); - return Py_None; - } - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype(GST_TYPE_FORMAT, destformat), - dstval); -} -%% -override gst_element_get_query_types noargs -static PyObject * -_wrap_gst_element_get_query_types (PyGObject *self) -{ - PyObject *ret; - PyObject *item; - int i; - GstQueryType *tab; - - pyg_begin_allow_threads; - tab = (GstQueryType*) gst_element_get_query_types(GST_ELEMENT(self->obj)); - pyg_end_allow_threads; - if (tab == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - - ret = PyList_New(0); - for (i = 0; tab[i] != 0; i++) { - item = pyg_enum_from_gtype (GST_TYPE_QUERY_TYPE, tab[i]); - PyList_Append(ret, item); - } - - return ret; -} -%% -override-slot GstElement.tp_iter -static PyObject * -_wrap_gst_element_tp_iter(PyGObject *self) -{ - return _wrap_gst_element_iterate_pads(self); -} -%% -override gst_element_get_pad_template_list noargs -static PyObject * -_wrap_gst_element_get_pad_template_list(PyGObject *self) -{ - PyObject *ret; - GList *res = NULL; - guint i; - - pyg_begin_allow_threads; - res = gst_element_class_get_pad_template_list - (GST_ELEMENT_GET_CLASS (self->obj)); - pyg_end_allow_threads; - - if (res) { - i = g_list_length (res); - ret = PyList_New (i); - for (i = 0 ; res ; res = g_list_next (res), i++) { - GstPadTemplate * tmpl = (GstPadTemplate *) res->data; - PyList_SetItem (ret, i, pygobject_new (G_OBJECT (tmpl))); - } - } else { - ret = Py_None; - Py_INCREF (ret); - } - - return ret; -} -%% -override GstElement__proxy_do_request_new_pad -static GstPad* -_wrap_GstElement__proxy_do_request_new_pad(GstElement *self, GstPadTemplate*templ, const gchar*name) -{ - PyGILState_STATE __py_state; - PyObject *py_self; - PyObject *py_templ = NULL; - PyObject *py_name; - GstPad* retval; - PyObject *py_retval; - PyObject *py_args; - PyObject *py_method; - - __py_state = pyg_gil_state_ensure(); - py_self = pygobject_new((GObject *) self); - if (!py_self) { - if (PyErr_Occurred()) - PyErr_Print(); - pyg_gil_state_release(__py_state); - return NULL; - } - if (templ) - py_templ = pygobject_new((GObject *) templ); - else { - Py_INCREF(Py_None); - py_templ = Py_None; - } - - if (name == NULL) { - Py_INCREF(Py_None); - py_name = Py_None; - } else { - py_name = PyString_FromString(name); - if (!py_name) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_templ); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return NULL; - } - } - - py_args = PyTuple_New(2); - PyTuple_SET_ITEM(py_args, 0, py_templ); - PyTuple_SET_ITEM(py_args, 1, py_name); - - py_method = PyObject_GetAttrString(py_self, "do_request_new_pad"); - if (!py_method) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_args); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return NULL; - } - py_retval = PyObject_CallObject(py_method, py_args); - if (!py_retval) { - if (PyErr_Occurred()) - PyErr_Print(); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return NULL; - } - if (!PyObject_TypeCheck(py_retval, &PyGObject_Type)) { - PyErr_SetString(PyExc_TypeError, "retval should be a GObject"); - PyErr_Print(); - Py_DECREF(py_retval); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - return NULL; - } - retval = (GstPad*) pygobject_get(py_retval); - g_object_ref((GObject *) retval); - - - Py_DECREF(py_retval); - Py_DECREF(py_method); - Py_DECREF(py_args); - Py_DECREF(py_self); - pyg_gil_state_release(__py_state); - - return retval; -} diff --git a/gst/gstelementfactory.override b/gst/gstelementfactory.override deleted file mode 100644 index 7d13189d6e..0000000000 --- a/gst/gstelementfactory.override +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* - * gstelementfactory.override - gstreamer element factory override - * Copyright (C) 2005 Alessandro Decina - * - * Authors: - * Alessandro Decina - * - * 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. - */ - -%% -override gst_element_factory_make kwargs -static PyObject * -_wrap_gst_element_factory_make(PyObject *self, PyObject *args, PyObject *kwargs){ - static char *kwlist[] = { "factoryname", "name", NULL }; - char *factoryname, *name = NULL; - PyObject *py_ret; - GstElement *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z:element_factory_make", kwlist, &factoryname, &name)) - return NULL; - - pyg_begin_allow_threads; - ret = gst_element_factory_make(factoryname, name); - pyg_end_allow_threads; - - if (ret == NULL) { - PyErr_SetString(PyGstExc_ElementNotFoundError, factoryname); - return NULL; - } - py_ret = pygobject_new((GObject *)ret); - g_object_unref((GObject *)ret); - return py_ret; -} -%% -override gst_element_factory_get_static_pad_templates noargs -static PyObject * -_wrap_gst_element_factory_get_static_pad_templates(PyGObject *self) -{ - const GList *list; - GList *l; - PyObject *py_list; - int i = 0; - - pyg_begin_allow_threads; - list = gst_element_factory_get_static_pad_templates (GST_ELEMENT_FACTORY (self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(g_list_length ((GList*) list)); - - for (l = (GList*) list; l ; l = g_list_next(l), i++) { - GstStaticPadTemplate *templ = (GstStaticPadTemplate*) l->data; - PyList_SetItem(py_list, i, pyg_pointer_new(GST_TYPE_STATIC_PAD_TEMPLATE, (gpointer) templ)); - } - return py_list; -} -%% -override gst_element_factory_list_get_elements kwargs -static PyObject * -_wrap_gst_element_factory_list_get_elements(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "type", "minrank", NULL }; - PyObject *py_minrank; - GstRank minrank; - GstElementFactoryListType listype; - GList *res, *tmp; - PyObject *pyres; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"KO:element_factory_list_get_elements", kwlist, - &listype, &py_minrank)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_RANK, py_minrank, (gint *)&minrank)) - return NULL; - pyg_begin_allow_threads; - res = gst_element_factory_list_get_elements(listype, minrank); - pyg_end_allow_threads; - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - GstElementFactory *fact = (GstElementFactory*) tmp->data; - PyObject *ltmp = pygobject_new (G_OBJECT (fact)); - - PyList_Append(pyres, ltmp); - } - gst_plugin_feature_list_free (res); - - return pyres; -} -%% -override gst_element_factory_list_filter kwargs -static PyObject * -_wrap_gst_element_factory_list_filter(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "list", "caps", "direction", "subsetonly", NULL }; - PyObject *py_list, *py_caps, *py_direction; - GList *inlist = NULL; - GList *res, *tmp; - GstCaps *caps; - GstPadDirection direction; - gboolean subsetonly, caps_is_copy; - PyObject *pyres; - guint i, n; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OOOi:element_factory_list_filter", kwlist, - &py_list, &py_caps, &py_direction, &subsetonly)) - return NULL; - if (!PyList_Check (py_list)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_PAD_DIRECTION, py_direction, (gint *)&direction)) - return NULL; - caps = pygst_caps_from_pyobject(py_caps, &caps_is_copy); - n = PyList_GET_SIZE(py_list); - for (i = 0; i < n; i++) { - /* Get Object */ - inlist = g_list_append(inlist, pygobject_get (PyList_GET_ITEM (py_list, i))); - } - - pyg_begin_allow_threads; - res = gst_element_factory_list_filter(inlist, caps, direction, subsetonly); - pyg_end_allow_threads; - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - GstElementFactory *fact = (GstElementFactory*) tmp->data; - PyObject *ltmp = pygobject_new (G_OBJECT (fact)); - - PyList_Append(pyres, ltmp); - } - - gst_plugin_feature_list_free (res); - if (caps && caps_is_copy) - gst_caps_unref (caps); - if (inlist) - g_list_free (inlist); - - return pyres; -} - - diff --git a/gst/gstevent.override b/gst/gstevent.override deleted file mode 100644 index c79526cf21..0000000000 --- a/gst/gstevent.override +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "k&r"; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Johan Dahlin - */ -%% -override gst_event_get_structure noargs -static PyObject * -_wrap_gst_event_get_structure(PyGstMiniObject *self) -{ - GstStructure *ret; - - ret = (GstStructure *) gst_event_get_structure(GST_EVENT(self->obj)); - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, TRUE, TRUE); -} - -%% -override-slot GstEvent.tp_repr -static PyObject * -_wrap_gst_event_tp_repr (PyGObject *self) -{ - char *buf; - PyObject *retval; - GstEvent *event; - - event = GST_EVENT(self->obj); - - buf = g_strdup_printf ("", - gst_event_type_get_name (event->type), (long) self->obj); - - retval = PyString_FromString(buf); - g_free(buf); - return retval; -} -%% -override gst_event_parse_new_segment noargs -static PyObject * -_wrap_gst_event_parse_new_segment (PyGstMiniObject *self) -{ - gboolean update; - gdouble rate; - GstFormat format; - gint64 start_value, stop_value, base; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_NEWSEGMENT) { - PyErr_SetString(PyExc_TypeError, "Event is not a 'NewSegment' event"); - return NULL; - } - - gst_event_parse_new_segment (GST_EVENT(self->obj), &update, &rate, &format, - &start_value, &stop_value, &base); - - return Py_BuildValue("(OdOLLL)", - PyBool_FromLong(update), - rate, pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - start_value, stop_value, base); -} -%% -override gst_event_parse_tag noargs -static PyObject * -_wrap_gst_event_parse_tag (PyGstMiniObject *self) -{ - PyObject *ret; - GstTagList *taglist; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_TAG) { - PyErr_SetString(PyExc_TypeError, "Event is not an 'Tag' event"); - return NULL; - } - - gst_event_parse_tag (GST_EVENT(self->obj), &taglist); - - ret = pyg_boxed_new (GST_TYPE_TAG_LIST, taglist, TRUE, TRUE); - - return ret; -} -%% -override gst_event_parse_qos noargs -static PyObject * -_wrap_gst_event_parse_qos (PyGstMiniObject *self) -{ - gdouble proportion; - GstClockTimeDiff diff; - GstClockTime timestamp; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_QOS) { - PyErr_SetString(PyExc_TypeError, "Event is not an 'Qos' event"); - return NULL; - } - - gst_event_parse_qos (GST_EVENT(self->obj), &proportion, - &diff, ×tamp); - - return Py_BuildValue("(dLK)", proportion, diff, timestamp); -} -%% -override gst_event_parse_seek noargs -static PyObject * -_wrap_gst_event_parse_seek (PyGstMiniObject *self) -{ - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType cur_type; - gint64 cur; - GstSeekType stop_type; - gint64 stop; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_SEEK) { - PyErr_SetString(PyExc_TypeError, "Event is not an 'Seek' event"); - return NULL; - } - - gst_event_parse_seek (GST_EVENT(self->obj), &rate, &format, &flags, - &cur_type, &cur, &stop_type, &stop); - - return Py_BuildValue("(dOOOLOL)", - rate, - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - pyg_flags_from_gtype (GST_TYPE_SEEK_FLAGS, flags), - pyg_enum_from_gtype (GST_TYPE_SEEK_TYPE, cur_type), - cur, - pyg_enum_from_gtype (GST_TYPE_SEEK_TYPE, stop_type), - stop); -} -%% -override gst_event_parse_buffer_size noargs -static PyObject * -_wrap_gst_event_parse_buffer_size (PyGstMiniObject *self) -{ - GstFormat format; - gint64 minsize; - gint64 maxsize; - gboolean async; - - if (GST_EVENT_TYPE (self->obj) != GST_EVENT_BUFFERSIZE) { - PyErr_SetString(PyExc_TypeError, "Event is not an 'BufferSize' event"); - return NULL; - } - - gst_event_parse_buffer_size (GST_EVENT (self->obj), - &format, &minsize, - &maxsize, &async); - - return Py_BuildValue("(OLLO)", - pyg_enum_from_gtype(GST_TYPE_FORMAT, format), - minsize, maxsize, - PyBool_FromLong(async)); -} -%% -override gst_event_parse_latency noargs -static PyObject * -_wrap_gst_event_parse_latency (PyGstMiniObject * self) -{ - GstClockTime ctime = GST_CLOCK_TIME_NONE; - - if (GST_EVENT_TYPE (self->obj) != GST_EVENT_LATENCY) { - PyErr_SetString(PyExc_TypeError, "Event is not a 'latency' event"); - return NULL; - } - - gst_event_parse_latency (GST_EVENT (self->obj), &ctime); - - return PyLong_FromUnsignedLongLong(ctime); -} -%% -override gst_event_new_navigation kwargs -static PyObject * -_wrap_gst_event_new_navigation(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "structure", NULL }; - PyObject *py_structure, *py_ret; - GstEvent *ret; - GstStructure *structure = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:event_new_navigation", kwlist, &py_structure)) - return NULL; - if (pyg_boxed_check(py_structure, GST_TYPE_STRUCTURE)) - structure = pyg_boxed_get(py_structure, GstStructure); - else { - PyErr_SetString(PyExc_TypeError, "structure should be a GstStructure"); - return NULL; - } - pyg_begin_allow_threads; - ret = gst_event_new_navigation(gst_structure_copy(structure)); - pyg_end_allow_threads; - py_ret = pygstminiobject_new((GstMiniObject *)ret); - if (ret != NULL) - gst_mini_object_unref((GstMiniObject *)ret); - return py_ret; -} -%% -override gst_event_new_custom kwargs -static PyObject * -_wrap_gst_event_new_custom(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "type", "structure", NULL }; - PyObject *py_type = NULL, *py_structure, *py_ret; - GstEvent *ret; - GstStructure *structure = NULL; - GstEventType type; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OO:event_new_custom", kwlist, &py_type, &py_structure)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_EVENT_TYPE, py_type, (gint *)&type)) - return NULL; - if (pyg_boxed_check(py_structure, GST_TYPE_STRUCTURE)) - structure = pyg_boxed_get(py_structure, GstStructure); - else { - PyErr_SetString(PyExc_TypeError, "structure should be a GstStructure"); - return NULL; - } - pyg_begin_allow_threads; - ret = gst_event_new_custom(type, gst_structure_copy(structure)); - pyg_end_allow_threads; - py_ret = pygstminiobject_new((GstMiniObject *)ret); - if (ret != NULL) - gst_mini_object_unref((GstMiniObject *)ret); - return py_ret; -} -%% -override gst_event_new_tag kwargs -static PyObject * -_wrap_gst_event_new_tag(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "taglist", NULL }; - GstTagList *taglist = NULL; - PyObject *py_taglist, *py_ret; - GstEvent *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:event_new_tag", kwlist, &py_taglist)) - return NULL; - if (pyg_boxed_check(py_taglist, GST_TYPE_TAG_LIST)) - taglist = pyg_boxed_get(py_taglist, GstTagList); - else { - PyErr_SetString(PyExc_TypeError, "taglist should be a GstTagList"); - return NULL; - } - pyg_begin_allow_threads; - ret = gst_event_new_tag(gst_tag_list_copy(taglist)); - pyg_end_allow_threads; - py_ret = pygstminiobject_new((GstMiniObject *)ret); - if (ret != NULL) - gst_mini_object_unref((GstMiniObject *)ret); - return py_ret; -} -%% -override gst_event_parse_step noargs -static PyObject * -_wrap_gst_event_parse_step (PyGstMiniObject * self) -{ - GstFormat format; - guint64 amount; - gdouble rate; - gboolean flush, intermediate; - - if (GST_EVENT_TYPE (self->obj) != GST_EVENT_STEP) { - PyErr_SetString(PyExc_TypeError, "Event is not a 'step' event"); - return NULL; - } - - gst_event_parse_step (GST_EVENT (self->obj), &format, &amount, &rate, - &flush, &intermediate); - - return Py_BuildValue("OKdOO", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - amount, rate, - PyBool_FromLong(flush), - PyBool_FromLong(intermediate)); -} -%% -override gst_event_parse_new_segment_full noargs -static PyObject * -_wrap_gst_event_parse_new_segment_full (PyGstMiniObject *self) -{ - gboolean update; - gdouble rate, applied_rate; - GstFormat format; - gint64 start_value, stop_value, base; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_NEWSEGMENT) { - PyErr_SetString(PyExc_TypeError, "Event is not a 'NewSegment' event"); - return NULL; - } - - gst_event_parse_new_segment_full (GST_EVENT(self->obj), &update, &rate, - &applied_rate, &format, - &start_value, &stop_value, &base); - - return Py_BuildValue("(OddOLLL)", - PyBool_FromLong(update), - rate, applied_rate, pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - start_value, stop_value, base); -} -%% -override gst_event_parse_sink_message noargs -static PyObject * -_wrap_gst_event_parse_sink_message (PyGstMiniObject *self) -{ - GstMessage *message; - - if (GST_EVENT_TYPE(self->obj) != GST_EVENT_SINK_MESSAGE) { - PyErr_SetString(PyExc_TypeError, "Event is not a 'SinkMessage' event"); - return NULL; - } - - gst_event_parse_sink_message (GST_EVENT(self->obj), &message); - - if (message) - return pygstminiobject_new (GST_MINI_OBJECT (message)); - - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstlibs.override b/gst/gstlibs.override deleted file mode 100644 index 4280e13e5a..0000000000 --- a/gst/gstlibs.override +++ /dev/null @@ -1,402 +0,0 @@ -/* -*- Mode: C; ; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Johan Dahlin - */ -%% -ignore - gst_controller_new - gst_controller_*_valist - gst_controller_remove_properties_list - -%% -override gst_controller_set args -static PyObject * -_wrap_gst_controller_set (PyGObject *self, PyObject *args) -{ - GstController *controller = (GstController *) self->obj; - gchar *param_name; - GParamSpec *pspec = NULL; - GstClockTime timestamp; - GValue value = { 0, }; - PyObject *pvalue; - gboolean res; - - if (!PyArg_ParseTuple(args, "sLO:GstController.set", - ¶m_name, ×tamp, &pvalue)) - return NULL; - - if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object), - (const gchar*) param_name))) { - PyErr_SetString (PyExc_TypeError, - "The controlled object doesn't have the given property"); - return NULL; - } - - g_value_init (&value, pspec->value_type); - - if (pyg_value_from_pyobject (&value, pvalue)) { - PyErr_SetString (PyExc_TypeError, - "Couldn't convert the given value to the good type"); - return NULL; - } - - res = gst_controller_set (controller, param_name, timestamp, &value); - if (res) { - Py_INCREF (Py_True); - return Py_True; - } - Py_INCREF (Py_False); - return Py_False; -} -%% -override gst_controller_get kwargs -static PyObject * -_wrap_gst_controller_get (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - GstController *controller = (GstController *) self->obj; - static char *kwlist[] = { "propertyname", "timestamp", NULL }; - gchar *propertyname; - GstClockTime timestamp; - GValue *value = NULL; - PyObject *pyvalue; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, - "sL:GstController.get", - kwlist, &propertyname, ×tamp)) - return NULL; - - value = gst_controller_get (controller, propertyname, timestamp); - if (value) { - pyvalue = pyg_value_as_pyobject (value, FALSE); - return pyvalue; - } - Py_INCREF (Py_None); - return Py_None; -} -%% -override gst_controller_new_list args -static int -_wrap_gst_controller_new_list(PyGObject *self, PyObject *args) -{ - PyObject *target_pyobj; - PyGObject *target; - gint len; - GList *list = NULL; - - if ((len = PyTuple_Size(args)) < 1) { - PyErr_SetString(PyExc_TypeError, "Controller requires at least a target object"); - return -1; - } - - target_pyobj = PyTuple_GetItem(args, 0); - if (!PyObject_TypeCheck(target_pyobj, &PyGObject_Type)) { - PyErr_Format(PyExc_TypeError, - "argument 1 must be %s, not %s", - PyGObject_Type.tp_name, - target_pyobj == Py_None ? "None" : target_pyobj->ob_type->tp_name); - return -1; - } - - target = (PyGObject *) target_pyobj; - - if (len > 1) - while (len-- > 1) { - PyObject *temp; - gchar *str; - - temp = PyTuple_GetItem(args, len); - str = PyString_AsString(temp); - if (str == NULL) { - g_list_free (list); - return -1; - } - GST_INFO("prepending %s [%d]", str, len); - list = g_list_prepend(list, str); - } - - self->obj = (GObject *) gst_controller_new_list(target->obj, list); - g_list_free (list); - - if (!self->obj) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstController object"); - return -1; - } - - pygobject_register_wrapper((PyObject *) self); - return 0; -} -%% -override gst_controller_remove_properties args -static PyObject * -_wrap_gst_controller_remove_properties (PyGObject *self, PyObject *args) -{ - GstController *controller = (GstController *) self->obj; - gint len; - GList *list = NULL; - gboolean res = FALSE; - PyObject *pret; - - if ((len = PyTuple_Size(args)) < 1) { - PyErr_SetString(PyExc_TypeError, "Please give at least one property name to remove"); - return NULL; - } - - while (len--) { - PyObject *temp; - gchar *str; - - temp = PyTuple_GetItem(args, len); - str = PyString_AsString(temp); - if (str == NULL) { - g_list_free (list); - return NULL; - } - GST_INFO("prepending %s [%d]", str, len); - list = g_list_prepend(list, str); - } - - res = gst_controller_remove_properties_list(controller, list); - g_list_free (list); - - if (res) - pret = Py_True; - else - pret = Py_False; - - Py_INCREF (pret); - - return pret; -} -%% -override gst_controller_set_from_list args -static PyObject * -_wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args) -{ - GstController *controller = (GstController *) self->obj; - PyObject *temp; - gint len; - gchar *pname; - GSList *list = NULL; - GParamSpec *pspec = NULL; - gboolean res = FALSE; - PyObject *pret; - - if ((len = PyTuple_Size(args)) < 2) { - PyErr_SetString(PyExc_TypeError, "Please give a property name and a tuple of (time,value)"); - return NULL; - } - - temp = PyTuple_GetItem(args, 0); - if (!PyString_Check (temp)) { - PyErr_SetString(PyExc_TypeError, "First argument must be a string"); - return NULL; - } - pname = PyString_AsString(temp); - - if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object), - (const gchar*) pname))) - goto error; - - while (len-- > 1) { - PyObject *temp2; - GstTimedValue *tval; - - temp2 = PyTuple_GetItem(args, len); - if (!PyTuple_Check (temp2)) { - PyErr_SetString (PyExc_TypeError, "Tuple doesn't contain tuples !"); - goto error; - } - tval = g_new0(GstTimedValue, 1); - tval->timestamp = PyLong_AsUnsignedLongLong(PyTuple_GetItem(temp2, 0)); - g_value_init (&tval->value, pspec->value_type); - if ((pyg_value_from_pyobject (&tval->value, PyTuple_GetItem (temp2, 1))) < 0) { - PyErr_SetString (PyExc_TypeError, "Couldn't convert value to correct type"); - goto error; - }; - - list = g_slist_prepend(list, tval); - } - - res = gst_controller_set_from_list(controller, pname, list); - g_slist_free (list); - - if (res) - pret = Py_True; - else - pret = Py_False; - - Py_INCREF (pret); - - return pret; - - error: - while (list) { - g_free(list->data); - list = g_slist_next(list); - } - g_slist_free (list); - return NULL; -} -%% -override gst_dp_header_payload_length kwargs -static PyObject * -_wrap_gst_dp_header_payload_length(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header", NULL }; - char *header; - gulong ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:dp_header_payload_length", kwlist, &header)) - return NULL; - ret = gst_dp_header_payload_length((guint8*)header); - return PyLong_FromUnsignedLong(ret); -} -%% -overrid gst_dp_header_payload_type kwargs -static PyObject * -_wrap_gst_dp_header_payload_type(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header", NULL }; - char *header; - gint ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:dp_header_payload_type", kwlist, &header)) - return NULL; - ret = gst_dp_header_payload_type((guint8*)header); - return pyg_enum_from_gtype(G_TYPE_NONE, ret); -} -%% -override gst_dp_buffer_from_header kwargs -static PyObject * -_wrap_gst_dp_buffer_from_header(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", NULL }; - char *header; - GstBuffer *ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Is:dp_buffer_from_header", kwlist, &header_length, &header)) - return NULL; - ret = gst_dp_buffer_from_header(header_length, (guint8*)header); - /* pygobject_new handles NULL checking */ - return pygstminiobject_new((GstMiniObject *)ret); -} -%% -override gst_dp_caps_from_packet kwargs -static PyObject * -_wrap_gst_dp_caps_from_packet(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", "payload", NULL }; - char *header, *payload; - GstCaps *ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Iss:dp_caps_from_packet", kwlist, &header_length, &header, &payload)) - return NULL; - ret = gst_dp_caps_from_packet(header_length, - (guint8*) header, - (guint8*) payload); - return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE); -} -%% -override gst_dp_event_from_packet kwargs -static PyObject * -_wrap_gst_dp_event_from_packet(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", "payload", NULL }; - char *header, *payload; - GstEvent *ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Iss:dp_event_from_packet", kwlist, &header_length, &header, &payload)) - return NULL; - ret = gst_dp_event_from_packet(header_length, - (guint8*) header, - (guint8*) payload); - /* pygobject_new handles NULL checking */ - return pygstminiobject_new((GstMiniObject *)ret); -} -%% -override gst_dp_validate_header kwargs -static PyObject * -_wrap_gst_dp_validate_header(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", NULL }; - char *header; - int ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Is:dp_validate_header", kwlist, &header_length, &header)) - return NULL; - ret = gst_dp_validate_header(header_length, (guint8*) header); - return PyBool_FromLong(ret); - -} -%% -override gst_dp_validate_payload kwargs -static PyObject * -_wrap_gst_dp_validate_payload(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", "payload", NULL }; - char *header, *payload; - int ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Iss:dp_validate_payload", kwlist, &header_length, &header, &payload)) - return NULL; - ret = gst_dp_validate_payload(header_length, - (guint8*) header, - (guint8*) payload); - return PyBool_FromLong(ret); - -} -%% -override gst_dp_validate_packet kwargs -static PyObject * -_wrap_gst_dp_validate_packet(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header_length", "header", "payload", NULL }; - char *header, *payload; - int ret; - guint header_length; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Iss:dp_validate_packet", kwlist, &header_length, &header, &payload)) - return NULL; - ret = gst_dp_validate_packet(header_length, - (guint8*) header, - (guint8*) payload); - return PyBool_FromLong(ret); - -} -%% -override gst_dp_header_payload_type kwargs -static PyObject * -_wrap_gst_dp_header_payload_type(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "header", NULL }; - char *header; - gint ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:dp_header_payload_type", kwlist, &header)) - return NULL; - ret = gst_dp_header_payload_type((guint8*) header); - return pyg_enum_from_gtype(G_TYPE_NONE, ret); -} - diff --git a/gst/gstmessage.override b/gst/gstmessage.override deleted file mode 100644 index 666d589346..0000000000 --- a/gst/gstmessage.override +++ /dev/null @@ -1,540 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Johan Dahlin - */ - -%% -override-slot GstMessage.tp_repr -static PyObject * -_wrap_gst_message_tp_repr (PyGstMiniObject *self) -{ - GstMessage *msg; - gchar *repr, *structure_str, *src_str; - PyObject *ret; - - g_assert (self); - msg = GST_MESSAGE (self->obj); - g_assert (msg); - - structure_str = msg->structure ? gst_structure_to_string (msg->structure) - : g_strdup ("(none)"); - if (msg->src) { - pyg_begin_allow_threads; - src_str = gst_object_get_name (msg->src); - pyg_end_allow_threads; - } else { - src_str = g_strdup ("(no src)"); - } - - repr = g_strdup_printf ("", - structure_str, src_str, msg); - g_free (src_str); - g_free (structure_str); - - ret = PyString_FromStringAndSize(repr, strlen (repr)); - g_free (repr); - - return ret; -} - -%% -override gst_message_parse_state_changed noargs -static PyObject * -_wrap_gst_message_parse_state_changed (PyGstMiniObject *self) -{ - GstState old; - GstState new; - GstState pen; - - /* Should raise an exception if it's not a state-changed message */ - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_STATE_CHANGED) { - PyErr_SetString(PyExc_TypeError, "Message is not a state-changed message"); - return NULL; - } - gst_message_parse_state_changed (GST_MESSAGE(self->obj), &old, &new, &pen); - - return Py_BuildValue("[OOO]", - pyg_enum_from_gtype(GST_TYPE_STATE, old), - pyg_enum_from_gtype(GST_TYPE_STATE, new), - pyg_enum_from_gtype(GST_TYPE_STATE, pen)); -} -%% -override gst_message_parse_segment_start noargs -static PyObject * -_wrap_gst_message_parse_segment_start (PyGstMiniObject *self) -{ - gint64 position; - GstFormat format; - - /* Should raise an exception if it's not a segment start message */ - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_SEGMENT_START) { - PyErr_SetString(PyExc_TypeError, "Message is not a segment start message"); - return NULL; - } - gst_message_parse_segment_start (GST_MESSAGE(self->obj), &format, &position); - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype(GST_TYPE_FORMAT, format), - position); -} - -%% -override gst_message_parse_segment_done noargs -static PyObject * -_wrap_gst_message_parse_segment_done (PyGstMiniObject *self) -{ - gint64 position; - GstFormat format; - - /* Should raise an exception if it's not a segment done message */ - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_SEGMENT_DONE) { - PyErr_SetString(PyExc_TypeError, "Message is not a segment done message"); - return NULL; - } - gst_message_parse_segment_done (GST_MESSAGE(self->obj), &format, &position); - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype(GST_TYPE_FORMAT, format), - position); -} - -%% -override gst_message_parse_error noargs -static PyObject * -_wrap_gst_message_parse_error (PyGstMiniObject *self) -{ - PyObject *ret; - GError *error = NULL; - gchar *debug; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_ERROR) { - PyErr_SetString(PyExc_TypeError, "Message is not an error message"); - return NULL; - } - - gst_message_parse_error (GST_MESSAGE(self->obj), &error, &debug); - - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_boxed_new (GST_TYPE_G_ERROR, error, TRUE, TRUE)); - if (error) - g_error_free (error); - if (debug != NULL) { - PyList_SetItem(ret, 1, PyString_FromString(debug)); - } else { - Py_INCREF (Py_None); - PyList_SetItem(ret, 1, Py_None); - } - g_free(debug); - return ret; -} -%% -override gst_message_parse_warning noargs -static PyObject * -_wrap_gst_message_parse_warning (PyGstMiniObject *self) -{ - PyObject *ret; - GError *warning = NULL; - gchar *debug; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_WARNING) { - PyErr_SetString(PyExc_TypeError, "Message is not an warning message"); - return NULL; - } - - gst_message_parse_warning (GST_MESSAGE(self->obj), &warning, &debug); - - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_boxed_new (GST_TYPE_G_ERROR, warning, TRUE, TRUE)); - if (warning) - g_error_free (warning); - if (debug != NULL) { - PyList_SetItem(ret, 1, PyString_FromString(debug)); - } else { - Py_INCREF (Py_None); - PyList_SetItem(ret, 1, Py_None); - } - g_free(debug); - return ret; -} -%% -override gst_message_parse_info noargs -static PyObject * -_wrap_gst_message_parse_info (PyGstMiniObject *self) -{ - PyObject *ret; - GError *info = NULL; - gchar *debug; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_INFO) { - PyErr_SetString(PyExc_TypeError, "Message is not an info message"); - return NULL; - } - - gst_message_parse_info (GST_MESSAGE(self->obj), &info, &debug); - - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_boxed_new (GST_TYPE_G_ERROR, info, TRUE, TRUE)); - if (info) - g_error_free (info); - if (debug != NULL) { - PyList_SetItem(ret, 1, PyString_FromString(debug)); - } else { - Py_INCREF (Py_None); - PyList_SetItem(ret, 1, Py_None); - } - g_free(debug); - return ret; -} -%% -override gst_message_parse_tag noargs -static PyObject * -_wrap_gst_message_parse_tag (PyGstMiniObject *self) -{ - PyObject *ret; - GstTagList *taglist; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_TAG) { - PyErr_SetString(PyExc_TypeError, "Message is not an Tag message"); - return NULL; - } - - gst_message_parse_tag (GST_MESSAGE(self->obj), &taglist); - - ret = pyg_boxed_new (GST_TYPE_TAG_LIST, taglist, TRUE, TRUE); - gst_tag_list_free (taglist); - return ret; -} -%% -override gst_message_parse_clock_provide noargs -static PyObject * -_wrap_gst_message_parse_clock_provide (PyGstMiniObject *self) -{ - GstClock *clock; - gboolean ready; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_CLOCK_PROVIDE) { - PyErr_SetString(PyExc_TypeError, "Message is not a 'clock provide' message"); - return NULL; - } - - gst_message_parse_clock_provide (GST_MESSAGE(self->obj), &clock, &ready); - - return Py_BuildValue("(OO)", - pygobject_new(G_OBJECT (clock)), - PyBool_FromLong(ready)); -} -%% -override gst_message_parse_clock_lost noargs -static PyObject * -_wrap_gst_message_parse_clock_lost (PyGstMiniObject *self) -{ - GstClock *clock; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_CLOCK_LOST) { - PyErr_SetString(PyExc_TypeError, "Message is not a 'clock lost' message"); - return NULL; - } - - gst_message_parse_clock_lost (GST_MESSAGE(self->obj), &clock); - - return pygobject_new(G_OBJECT(clock)); -} -%% -override gst_message_parse_new_clock noargs -static PyObject * -_wrap_gst_message_parse_new_clock (PyGstMiniObject *self) -{ - GstClock *clock; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_NEW_CLOCK) { - PyErr_SetString(PyExc_TypeError, "Message is not a 'new clock' message"); - return NULL; - } - - gst_message_parse_new_clock (GST_MESSAGE(self->obj), &clock); - - return pygobject_new(G_OBJECT(clock)); -} -%% -override gst_message_parse_duration noargs -static PyObject * -_wrap_gst_message_parse_duration (PyGstMiniObject *self) -{ - GstFormat format; - gint64 duration; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_DURATION) { - PyErr_SetString(PyExc_TypeError, "Message is not a 'duration' message"); - return NULL; - } - - gst_message_parse_duration (GST_MESSAGE(self->obj), &format, &duration); - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - duration); -} -%% -override gst_message_parse_async_start noargs -static PyObject * -_wrap_gst_message_parse_async_start (PyGstMiniObject *self) -{ - gboolean res = FALSE; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_ASYNC_START) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'async-start' message"); - return NULL; - } - - gst_message_parse_async_start (GST_MESSAGE(self->obj), &res); - - return PyBool_FromLong (res); -} -%% -override gst_message_parse_buffering noargs -static PyObject * -_wrap_gst_message_parse_buffering (PyGstMiniObject *self) -{ - gint percent; - - if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_BUFFERING) { - PyErr_SetString(PyExc_TypeError, "Message is not a 'buffering' message"); - return NULL; - } - - gst_message_parse_buffering (GST_MESSAGE(self->obj), &percent); - - return Py_BuildValue("i", percent); -} -%% -override gst_message_parse_tag_full noargs -static PyObject * -_wrap_gst_message_parse_tag_full (PyGstMiniObject *self) -{ - GstPad *pad; - GstTagList *taglist; - PyObject *ptlist; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_TAG) { - PyErr_SetString(PyExc_TypeError, "Message is not an Tag message"); - return NULL; - } - - gst_message_parse_tag_full (GST_MESSAGE (self->obj), &pad, &taglist); - ptlist = pyg_boxed_new (GST_TYPE_TAG_LIST, taglist, TRUE, TRUE); - gst_tag_list_free (taglist); - - return Py_BuildValue("(OO)", - pygobject_new((GObject*) pad), - ptlist); -} -%% -override gst_message_parse_step_done noargs -static PyObject * -_wrap_gst_message_parse_step_done (PyGstMiniObject *self) -{ - GstFormat format; - guint64 amount, duration; - gdouble rate; - gboolean flush, intermediate, eos; - - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_STEP_DONE) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'step-done' message"); - return NULL; - } - - gst_message_parse_step_done (GST_MESSAGE (self->obj), &format, &amount, &rate, - &flush, &intermediate, &duration, &eos); - - return Py_BuildValue("OKdOOKO", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - amount, rate, - PyBool_FromLong(flush), - PyBool_FromLong(intermediate), - duration, - PyBool_FromLong(eos)); -} -%% -override gst_message_parse_step_start noargs -static PyObject * -_wrap_gst_message_parse_step_start (PyGstMiniObject *self) -{ - GstFormat format; - guint64 amount; - gdouble rate; - gboolean active, flush, intermediate; - - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_STEP_START) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'step-start' message"); - return NULL; - } - - gst_message_parse_step_start (GST_MESSAGE (self->obj), &active, &format, - &amount, &rate, &flush, &intermediate); - - return Py_BuildValue("OOKdOO", - PyBool_FromLong(active), - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - amount, rate, - PyBool_FromLong(flush), - PyBool_FromLong(intermediate)); -} -%% -override gst_message_parse_stream_status noargs -static PyObject * -_wrap_gst_message_parse_stream_status (PyGstMiniObject *self) -{ - GstStreamStatusType type; - GstElement *owner; - - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_STREAM_STATUS) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'stream-status' message"); - return NULL; - } - - gst_message_parse_stream_status (GST_MESSAGE (self->obj), &type, &owner); - - return Py_BuildValue("OO", - pyg_enum_from_gtype (GST_TYPE_STREAM_STATUS_TYPE, type), - pygobject_new((GObject*) owner)); -} -%% -override gst_message_parse_structure_change noargs -static PyObject * -_wrap_gst_message_parse_structure_change (PyGstMiniObject *self) -{ - GstStructureChangeType type; - GstElement *owner; - gboolean busy; - - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_STRUCTURE_CHANGE) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'structure_change' message"); - return NULL; - } - - gst_message_parse_structure_change (GST_MESSAGE (self->obj), &type, &owner, &busy); - - return Py_BuildValue("OOO", - pyg_enum_from_gtype (GST_TYPE_STRUCTURE_CHANGE_TYPE, type), - pygobject_new((GObject*) owner), - PyBool_FromLong(busy)); -} -%% -override gst_message_parse_request_state noargs -static PyObject * -_wrap_gst_message_parse_request_state (PyGstMiniObject *self) -{ - GstState state; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_REQUEST_STATE) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'request_state' message"); - return NULL; - } - - gst_message_parse_request_state (GST_MESSAGE (self->obj), &state); - - return pyg_enum_from_gtype(GST_TYPE_STATE, state); -} -%% -override gst_message_parse_buffering_stats noargs -static PyObject * -_wrap_gst_message_parse_buffering_stats (PyGstMiniObject *self) -{ - GstBufferingMode mode; - gint avg_in, avg_out; - gint64 buffering_left; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_BUFFERING) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'buffering' message"); - return NULL; - } - - gst_message_parse_buffering_stats (GST_MESSAGE (self->obj), &mode, &avg_in, &avg_out, - &buffering_left); - - return Py_BuildValue("OiiL", - pyg_enum_from_gtype (GST_TYPE_BUFFERING_MODE, mode), - avg_in, avg_out, buffering_left); -} -%% -override gst_message_parse_qos noargs -static PyObject * -_wrap_gst_message_parse_qos (PyGstMiniObject *self) -{ - gboolean live; - guint64 running_time, stream_time, timestamp, duration; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_QOS) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'qos' message"); - return NULL; - } - - gst_message_parse_qos (GST_MESSAGE (self->obj), &live, &running_time, &stream_time, - ×tamp, &duration); - - return Py_BuildValue("OKKKK", - PyBool_FromLong(live), running_time, stream_time, - timestamp, duration); -} -%% -override gst_message_parse_qos_values noargs -static PyObject * -_wrap_gst_message_parse_qos_values (PyGstMiniObject *self) -{ - gint64 jitter; - gdouble proportion; - gint quality; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_QOS) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'qos' message"); - return NULL; - } - - gst_message_parse_qos_values (GST_MESSAGE (self->obj), &jitter, - &proportion, &quality); - - return Py_BuildValue("Ldi", - jitter, proportion, quality); -} -%% -override gst_message_parse_qos_stats noargs -static PyObject * -_wrap_gst_message_parse_qos_stats (PyGstMiniObject *self) -{ - GstFormat format; - guint64 processed; - guint64 dropped; - - if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_QOS) { - PyErr_SetString(PyExc_TypeError, "Message is not an 'qos' message"); - return NULL; - } - - gst_message_parse_qos_stats (GST_MESSAGE (self->obj), &format, - &processed, &dropped); - - return Py_BuildValue("OKK", - pyg_enum_from_gtype(GST_TYPE_FORMAT, format), - processed, dropped); -} diff --git a/gst/gstmodule.c b/gst/gstmodule.c deleted file mode 100644 index 2a37f8e97c..0000000000 --- a/gst/gstmodule.c +++ /dev/null @@ -1,395 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "k&r"; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2002 David I. Lehn - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include -#include "pygst-private.h" -#include "pygstexception.h" - -#include - - -void pygst_register_classes (PyObject * d); -void pygst_add_constants (PyObject * module, const gchar * strip_prefix); -void _pygst_register_boxed_types (PyObject * moddict); - -extern PyMethodDef pygst_functions[]; - -GST_DEBUG_CATEGORY (pygst_debug); /* for bindings code */ -GST_DEBUG_CATEGORY (python_debug); /* for python code */ - -/* copied from pygtk to register GType */ -#define REGISTER_TYPE(d, type, name) \ - type.ob_type = &PyType_Type; \ - type.tp_alloc = PyType_GenericAlloc; \ - type.tp_new = PyType_GenericNew; \ - if (PyType_Ready(&type)) \ - return; \ - PyDict_SetItemString(d, name, (PyObject *)&type); - -#define REGISTER_GTYPE(d, type, name, gtype) \ - REGISTER_TYPE(d, type, name); \ - PyDict_SetItemString(type.tp_dict, "__gtype__", \ - o=pyg_type_wrapper_new(gtype)); \ - Py_DECREF(o); - -static PyObject * -pygstminiobject_from_gvalue (const GValue * value) -{ - GstMiniObject *miniobj; - - if ((miniobj = gst_value_get_mini_object (value)) == NULL) { - Py_INCREF (Py_None); - return Py_None; - } - return pygstminiobject_new (miniobj); -} - -static int -pygstminiobject_to_gvalue (GValue * value, PyObject * obj) -{ - PyGstMiniObject *self = (PyGstMiniObject *) obj; - - gst_value_set_mini_object (value, obj == Py_None ? NULL : self->obj); - - return 0; -} - -static void -sink_gstobject (GObject * object) -{ - if (GST_OBJECT_IS_FLOATING (object)) { - g_object_ref (object); - gst_object_sink (GST_OBJECT (object)); - } -} - -static PyObject * -pygst_fraction_from_value (const GValue * value) -{ - PyObject *module, *dict, *fraction_type, *args, *fraction; - gint numerator, denominator; - - numerator = gst_value_get_fraction_numerator (value); - denominator = gst_value_get_fraction_denominator (value); - - module = PyImport_ImportModule ("gst"); - dict = PyModule_GetDict (module); - fraction_type = PyMapping_GetItemString (dict, "Fraction"); - - args = Py_BuildValue ("(ii)", numerator, denominator); - fraction = PyObject_Call (fraction_type, args, NULL); - Py_DECREF (args); - Py_DECREF (fraction_type); - Py_DECREF (module); - - return fraction; -} - -static int -pygst_fraction_to_value (GValue * value, PyObject * object) -{ - PyObject *numerator, *denominator; - - numerator = PyObject_GetAttrString (object, "num"); - if (numerator == NULL) - goto fail; - - denominator = PyObject_GetAttrString (object, "denom"); - if (denominator == NULL) - goto fail; - - gst_value_set_fraction (value, - PyLong_AsLong (numerator), PyLong_AsLong (denominator)); - - return 0; - -fail: - return -1; -} - -struct _PyGst_Functions pygst_api_functions = { - pygst_caps_from_pyobject, - pygst_iterator_new, - pygstminiobject_new -}; - -/* for addon libraries ... */ -static void -pygst_register_api (PyObject * d) -{ - PyObject *api; - - api = PyCObject_FromVoidPtr (&pygst_api_functions, NULL); - PyDict_SetItemString (d, "_PyGst_API", api); - Py_DECREF (api); -} - -DL_EXPORT (void) -init_gst (void) -{ - PyObject *m, *d; - PyObject *av, *tuple; - int argc, i; - guint major, minor, micro, nano; - char **argv; - GError *error = NULL; - - init_pygobject (); - - /* pull in arguments */ - av = PySys_GetObject ("argv"); - if (av != NULL) { - argc = PyList_Size (av); - argv = g_new (char *, argc); - for (i = 0; i < argc; i++) - argv[i] = g_strdup (PyString_AsString (PyList_GetItem (av, i))); - } else { - /* gst_init_check does not like argc == 0 */ - argc = 1; - argv = g_new (char *, argc); - argv[0] = g_strdup (""); - } - if (!gst_init_check (&argc, &argv, &error)) { - gchar *errstr; - - if (argv != NULL) { - for (i = 0; i < argc; i++) - g_free (argv[i]); - g_free (argv); - } - errstr = g_strdup_printf ("can't initialize module gst: %s", - error ? GST_STR_NULL (error->message) : "no error given"); - PyErr_SetString (PyExc_RuntimeError, errstr); - g_free (errstr); - g_error_free (error); - setlocale (LC_NUMERIC, "C"); - return; - } - - setlocale (LC_NUMERIC, "C"); - if (argv != NULL) { - PySys_SetArgv (argc, argv); - for (i = 0; i < argc; i++) - g_free (argv[i]); - g_free (argv); - } - - /* Initialize debugging category */ - GST_DEBUG_CATEGORY_INIT (pygst_debug, "pygst", 0, - "GStreamer python bindings"); - GST_DEBUG_CATEGORY_INIT (python_debug, "python", GST_DEBUG_FG_GREEN, - "python code using gst-python"); - - pygobject_register_sinkfunc (GST_TYPE_OBJECT, sink_gstobject); - - m = Py_InitModule ("_gst", pygst_functions); - d = PyModule_GetDict (m); - pygst_register_api (d); - - /* gst version */ - gst_version (&major, &minor, µ, &nano); - tuple = Py_BuildValue ("(iii)", major, minor, micro); - PyDict_SetItemString (d, "gst_version", tuple); - Py_DECREF (tuple); - - /* gst-python version */ - tuple = Py_BuildValue ("(iii)", PYGST_MAJOR_VERSION, PYGST_MINOR_VERSION, - PYGST_MICRO_VERSION); - PyDict_SetItemString (d, "pygst_version", tuple); - Py_DECREF (tuple); - - /* clock stuff */ - PyModule_AddIntConstant (m, "SECOND", GST_SECOND); - PyModule_AddIntConstant (m, "MSECOND", GST_MSECOND); - PyModule_AddIntConstant (m, "NSECOND", GST_NSECOND); - - PyModule_AddObject (m, "CLOCK_TIME_NONE", - PyLong_FromUnsignedLongLong (GST_CLOCK_TIME_NONE)); - PyModule_AddObject (m, "BUFFER_OFFSET_NONE", - PyLong_FromUnsignedLongLong (GST_BUFFER_OFFSET_NONE)); - - pygst_exceptions_register_classes (d); - - REGISTER_TYPE (d, PyGstIterator_Type, "Iterator"); - - - pygstminiobject_register_class (d, "GstMiniObject", GST_TYPE_MINI_OBJECT, - &PyGstMiniObject_Type, NULL); - pyg_register_boxed_custom (GST_TYPE_MINI_OBJECT, - pygstminiobject_from_gvalue, pygstminiobject_to_gvalue); - - pygst_register_classes (d); - pygst_add_constants (m, "GST_"); - - /* make our types available */ - PyModule_AddObject (m, "TYPE_ELEMENT_FACTORY", - pyg_type_wrapper_new (GST_TYPE_ELEMENT_FACTORY)); - PyModule_AddObject (m, "TYPE_INDEX_FACTORY", - pyg_type_wrapper_new (GST_TYPE_INDEX_FACTORY)); - PyModule_AddObject (m, "TYPE_TYPE_FIND_FACTORY", - pyg_type_wrapper_new (GST_TYPE_TYPE_FIND_FACTORY)); - -#define ADD_GST_TAG(a) PyModule_AddStringConstant(m, "TAG_" #a, GST_TAG_##a) - /* GStreamer core tags */ - ADD_GST_TAG (TITLE); - ADD_GST_TAG (ARTIST); - ADD_GST_TAG (ALBUM); - ADD_GST_TAG (DATE); - ADD_GST_TAG (GENRE); - ADD_GST_TAG (COMMENT); - ADD_GST_TAG (TRACK_NUMBER); - ADD_GST_TAG (TRACK_COUNT); - ADD_GST_TAG (ALBUM_VOLUME_NUMBER); - ADD_GST_TAG (ALBUM_VOLUME_COUNT); - ADD_GST_TAG (LOCATION); - ADD_GST_TAG (DESCRIPTION); - ADD_GST_TAG (VERSION); - ADD_GST_TAG (ISRC); - ADD_GST_TAG (ORGANIZATION); - ADD_GST_TAG (COPYRIGHT); - ADD_GST_TAG (CONTACT); - ADD_GST_TAG (LICENSE); - ADD_GST_TAG (PERFORMER); - ADD_GST_TAG (DURATION); - ADD_GST_TAG (CODEC); - ADD_GST_TAG (VIDEO_CODEC); - ADD_GST_TAG (AUDIO_CODEC); - ADD_GST_TAG (BITRATE); - ADD_GST_TAG (NOMINAL_BITRATE); - ADD_GST_TAG (MINIMUM_BITRATE); - ADD_GST_TAG (MAXIMUM_BITRATE); - ADD_GST_TAG (SERIAL); - ADD_GST_TAG (ENCODER); - ADD_GST_TAG (ENCODER_VERSION); - ADD_GST_TAG (TRACK_GAIN); - ADD_GST_TAG (TRACK_PEAK); - ADD_GST_TAG (ALBUM_GAIN); - ADD_GST_TAG (ALBUM_PEAK); - ADD_GST_TAG (LANGUAGE_CODE); - ADD_GST_TAG (IMAGE); - ADD_GST_TAG (PREVIEW_IMAGE); - ADD_GST_TAG (EXTENDED_COMMENT); - ADD_GST_TAG (REFERENCE_LEVEL); - ADD_GST_TAG (BEATS_PER_MINUTE); - ADD_GST_TAG (LICENSE_URI); - ADD_GST_TAG (COPYRIGHT_URI); - ADD_GST_TAG (COMPOSER); - ADD_GST_TAG (ARTIST_SORTNAME); - ADD_GST_TAG (ALBUM_SORTNAME); - ADD_GST_TAG (TITLE_SORTNAME); -#if ((GST_VERSION_MICRO >= 21) || (GST_VERSION_MICRO == 20 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (ATTACHMENT); - ADD_GST_TAG (KEYWORDS); - ADD_GST_TAG (GEO_LOCATION_NAME); - ADD_GST_TAG (GEO_LOCATION_LATITUDE); - ADD_GST_TAG (GEO_LOCATION_LONGITUDE); - ADD_GST_TAG (GEO_LOCATION_ELEVATION); -#if ((GST_VERSION_MICRO >= 23) || (GST_VERSION_MICRO == 22 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (SUBTITLE_CODEC); - ADD_GST_TAG (HOMEPAGE); -#if ((GST_VERSION_MICRO >= 24) || (GST_VERSION_MICRO == 23 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (CONTAINER_FORMAT); -#if ((GST_VERSION_MICRO >= 25) || (GST_VERSION_MICRO == 24 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (ALBUM_ARTIST); - ADD_GST_TAG (ALBUM_ARTIST_SORTNAME); -#if ((GST_VERSION_MICRO >= 26) || (GST_VERSION_MICRO == 25 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (SHOW_NAME); - ADD_GST_TAG (SHOW_SORTNAME); - ADD_GST_TAG (SHOW_EPISODE_NUMBER); - ADD_GST_TAG (SHOW_SEASON_NUMBER); - ADD_GST_TAG (LYRICS); - ADD_GST_TAG (COMPOSER_SORTNAME); - ADD_GST_TAG (GROUPING); -#if ((GST_VERSION_MICRO >= 29) || (GST_VERSION_MICRO == 28 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (GEO_LOCATION_COUNTRY); - ADD_GST_TAG (GEO_LOCATION_CITY); - ADD_GST_TAG (GEO_LOCATION_SUBLOCATION); - ADD_GST_TAG (USER_RATING); -#if ((GST_VERSION_MICRO >= 30) || (GST_VERSION_MICRO == 29 && GST_VERSION_NANO > 0)) - ADD_GST_TAG (DEVICE_MANUFACTURER); - ADD_GST_TAG (IMAGE_ORIENTATION); - ADD_GST_TAG (DEVICE_MODEL); - ADD_GST_TAG (GEO_LOCATION_MOVEMENT_SPEED); - ADD_GST_TAG (GEO_LOCATION_MOVEMENT_DIRECTION); - ADD_GST_TAG (GEO_LOCATION_CAPTURE_DIRECTION); - ADD_GST_TAG (IMAGE_ORIENTATION); -#if ((GST_VERSION_MICRO >= 31) || (GST_VERSION_MICRO == 30 && GST_VERSION_NANO > 0)) -#define ADD_FACTORY_TYPE(a) PyModule_AddObject(m, "ELEMENT_FACTORY_TYPE_" #a,\ - PyLong_FromUnsignedLongLong(GST_ELEMENT_FACTORY_TYPE_##a)) - ADD_FACTORY_TYPE (DECODER); - ADD_FACTORY_TYPE (ENCODER); - ADD_FACTORY_TYPE (SINK); - ADD_FACTORY_TYPE (SRC); - ADD_FACTORY_TYPE (MUXER); - ADD_FACTORY_TYPE (DEMUXER); - ADD_FACTORY_TYPE (PARSER); - ADD_FACTORY_TYPE (PAYLOADER); - ADD_FACTORY_TYPE (DEPAYLOADER); - ADD_FACTORY_TYPE (FORMATTER); - ADD_FACTORY_TYPE (MAX_ELEMENTS); - ADD_FACTORY_TYPE (MEDIA_VIDEO); - ADD_FACTORY_TYPE (MEDIA_AUDIO); - ADD_FACTORY_TYPE (MEDIA_IMAGE); - ADD_FACTORY_TYPE (MEDIA_SUBTITLE); - ADD_FACTORY_TYPE (MEDIA_METADATA); - ADD_FACTORY_TYPE (ANY); - ADD_FACTORY_TYPE (MEDIA_ANY); - ADD_FACTORY_TYPE (VIDEO_ENCODER); - ADD_FACTORY_TYPE (AUDIO_ENCODER); - ADD_FACTORY_TYPE (AUDIOVIDEO_SINKS); - ADD_FACTORY_TYPE (DECODABLE); - ADD_GST_TAG (DATE_TIME); - ADD_GST_TAG (APPLICATION_NAME); - ADD_GST_TAG (APPLICATION_DATA); - ADD_GST_TAG (GEO_LOCATION_HORIZONTAL_ERROR); -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif - - PyModule_AddStringConstant (m, "LIBRARY_ERROR", - (gchar *) g_quark_to_string (GST_LIBRARY_ERROR)); - PyModule_AddStringConstant (m, "RESOURCE_ERROR", - (gchar *) g_quark_to_string (GST_RESOURCE_ERROR)); - PyModule_AddStringConstant (m, "CORE_ERROR", - (gchar *) g_quark_to_string (GST_CORE_ERROR)); - PyModule_AddStringConstant (m, "STREAM_ERROR", - (gchar *) g_quark_to_string (GST_STREAM_ERROR)); - - pyg_register_gtype_custom (GST_TYPE_FRACTION, - pygst_fraction_from_value, pygst_fraction_to_value); - - if (PyErr_Occurred ()) { - Py_FatalError ("can't initialize module gst"); - } -} diff --git a/gst/gstobject.override b/gst/gstobject.override deleted file mode 100644 index ec8e78c26f..0000000000 --- a/gst/gstobject.override +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Edward Hervey - */ - -%% -ignore - gst_object_default_deep_notify - gst_object_check_uniqueness - gst_object_replace - -%% -override-attr GstObject.__gstrefcount__ - -/* keep this attribute around even after 2.8 for compatibility reasons */ -static PyObject * -_wrap_gst_object__get___gstrefcount__ (PyGObject * self, void *closure) -{ - return PyInt_FromLong (GST_OBJECT_REFCOUNT_VALUE (self->obj)); -} - -%% -override-slot GstObject.tp_repr -static PyObject * -_wrap_gst_object_tp_repr (PyObject * self) -{ - gchar *repr; - PyObject *ret; - GstObject *object = GST_OBJECT (pygobject_get (self)); - - repr = g_strdup_printf ("<%s object (%s) at 0x%lx>", - self->ob_type->tp_name, - object ? ( - GST_OBJECT_NAME (object) ? GST_OBJECT_NAME (object) : "unnamed" - ) : "(null)", - (long) self); - ret = PyString_FromString (repr); - g_free (repr); - return ret; -} - -%% -override-slot GstObject.tp_str -static PyObject * -_wrap_gst_object_tp_str (PyObject * self) -{ - gchar *repr, *path; - PyObject *ret; - GstObject *object = GST_OBJECT (pygobject_get (self)); - - pyg_begin_allow_threads; - path = gst_object_get_path_string (object); - pyg_end_allow_threads; - - repr = g_strdup_printf ("%s (%s)", path, self->ob_type->tp_name); - ret = PyString_FromString (repr); - g_free (repr); - g_free (path); - return ret; -} -%% -override gst_object_set_property args - -/* - * REMOVE THE FOLLOWING CODE, once pygobject has fixed the issue of not - * releasing the GIL when calling g_object_set_property. - * - * See bug #395048 : set_property() doesn't release the GIL - **/ - -static gboolean -set_property_from_pspec(GObject *obj, - char *attr_name, - GParamSpec *pspec, - PyObject *pvalue) -{ - GValue value = { 0, }; - - if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) { - PyErr_Format(PyExc_TypeError, - "property '%s' can only be set in constructor", - attr_name); - return FALSE; - } - - if (!(pspec->flags & G_PARAM_WRITABLE)) { - PyErr_Format(PyExc_TypeError, - "property '%s' is not writable", attr_name); - return FALSE; - } - - g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); -/* FIXME: bug in pygtk 2.8 series; see -http://svn.gnome.org/viewcvs/pygobject/trunk/gobject/pygobject.h?rev=566&r1=564&r2=566 */ - -#ifndef PYGOBJECT_2_12 -#undef pyg_param_gvalue_from_pyobject -#define pyg_param_gvalue_from_pyobject (_PyGObject_API->gvalue_from_param_pyobject) -#endif - - if (pyg_param_gvalue_from_pyobject(&value, pvalue, pspec) < 0) { - PyErr_SetString(PyExc_TypeError, - "could not convert argument to correct param type"); - return FALSE; - } - - pyg_begin_allow_threads; - g_object_set_property(obj, attr_name, &value); - pyg_end_allow_threads; - - g_value_unset(&value); - - return TRUE; -} - -static PyObject * -_wrap_gst_object_set_property(PyGObject *self, PyObject *args) -{ - gchar *param_name; - GParamSpec *pspec; - PyObject *pvalue; - - if (!PyArg_ParseTuple(args, "sO:gst.Object.set_property", ¶m_name, - &pvalue)) - return NULL; - - if (!GST_IS_OBJECT (self->obj)) { - PyErr_Format (PyExc_TypeError, - "object at %p of type %s is not initialized", - self, self->ob_type->tp_name); - return NULL; - } - - pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(self->obj), - param_name); - if (!pspec) { - PyErr_Format(PyExc_TypeError, - "object of type `%s' does not have property `%s'", - g_type_name(G_OBJECT_TYPE(self->obj)), param_name); - return NULL; - } - - if (!set_property_from_pspec(self->obj, param_name, pspec, pvalue)) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} diff --git a/gst/gstpad.override b/gst/gstpad.override deleted file mode 100644 index db1fa49192..0000000000 --- a/gst/gstpad.override +++ /dev/null @@ -1,1690 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ - * vi:si:et:sw=4:sts=4:ts=4 - * - * gst-python - * Copyright (C) 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: Johan Dahlin 0) || \ - (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \ - (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && \ - GST_VERSION_MICRO >= 23) || \ - (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && \ - GST_VERSION_MICRO == 22 && GST_VERSION_NANO > 0)) -#define HAVE_SET_BLOCKED_ASYNC_FULL 1 -#else -#define HAVE_SET_BLOCKED_ASYNC_FULL 0 -#endif - -/* we need to do this until PyClosures get exception handlers */ -#ifndef pyg_closure_set_exception_handler -# define pyg_closure_set_exception_handler(ig, nore) -# define EXCEPTION_HANDLER G_GNUC_UNUSED -#else -# define EXCEPTION_HANDLER -#endif -#define SET_PAD_CLOSURE(self, args, kwargs, name) \ - static char *kwlist[] = { G_STRINGIFY (name), NULL }; \ - PyObject *function; \ - GstPad *pad; \ - GClosure *closure; \ - PyGstPadPrivate *priv; \ -\ - if (!PyArg_ParseTupleAndKeywords(args, kwargs, \ - "O:GstPad.set_" G_STRINGIFY (name), \ - kwlist, \ - &function)) { \ - return NULL; \ - } \ -\ - if (!PyCallable_Check(function)) { \ - PyErr_SetString(PyExc_TypeError, G_STRINGIFY (name) " not callable"); \ - return NULL; \ - } \ -\ - closure = pyg_closure_new (function, NULL, NULL); \ - pyg_closure_set_exception_handler (closure, handle_ ## name ## _exception); \ - pygobject_watch_closure((PyObject *)self, closure); \ - priv = py_pad_private(self);\ - if (priv->name) { \ - g_closure_invalidate (priv->name); \ - g_closure_unref (priv->name); \ - } \ - priv->name = closure; \ - pad = (GstPad*)pygobject_get(self); \ - gst_pad_set_ ## name (pad, call_ ## name); \ -\ - Py_INCREF(Py_None); \ - return Py_None; - -static void -free_pad_private (gpointer data) -{ - PyGstPadPrivate *private = data; -#define INVALIDATE_CLOSURE(closure) \ - if (closure) { \ - g_closure_invalidate (closure); \ - g_closure_unref (closure); \ - closure = NULL; \ - } - INVALIDATE_CLOSURE (private->link_function) - INVALIDATE_CLOSURE (private->event_function) - INVALIDATE_CLOSURE (private->chain_function) - INVALIDATE_CLOSURE (private->get_function) - INVALIDATE_CLOSURE (private->getcaps_function) - INVALIDATE_CLOSURE (private->setcaps_function) - INVALIDATE_CLOSURE (private->activate_function) - INVALIDATE_CLOSURE (private->activatepull_function) - INVALIDATE_CLOSURE (private->activatepush_function) -#undef INVALIDATE_CLOSURE - - if (private->query_function) { - Py_DECREF (private->query_function); - private->query_function = NULL; - } -} - -static PyGstPadPrivate* -pad_private(GstPad *pad) -{ - PyGstPadPrivate *private; - static GQuark padprivate = 0; - - if (!padprivate) - padprivate = g_quark_from_static_string ("PyGst::PadPrivate"); - private = g_object_get_qdata (G_OBJECT (pad), padprivate); - if (private == NULL) { - private = g_new0(PyGstPadPrivate, 1); - private->pad = (PyGObject *) pygobject_new (G_OBJECT (pad)); - Py_DECREF (private->pad); - g_object_set_qdata_full (G_OBJECT (pad), padprivate, private, free_pad_private); - } - return private; -} - -static PyGstPadPrivate* -py_pad_private(PyGObject *pad) -{ - return pad_private ((GstPad *)pygobject_get(pad)); -} - -%% -ignore - gst_pad_select - gst_pad_selectv - gst_pad_new_from_template - gst_pad_load_and_link -%% -override gst_pad_set_getcaps_function kwargs - -static void EXCEPTION_HANDLER -handle_getcaps_function_exception (GValue *ret, guint n, const GValue *params) -{ - g_value_set_boxed (ret, gst_pad_get_pad_template_caps ( - GST_PAD (g_value_get_object (¶ms[0])))); - PyErr_Clear (); -} - -static GstCaps * -call_getcaps_function (GstPad *pad) -{ - GClosure *closure; - GValue ret = { 0, }; - GValue args = { 0, }; - GstCaps *caps; - - g_value_init (&ret, GST_TYPE_CAPS); - g_value_init (&args, GST_TYPE_PAD); - g_value_set_object (&args, pad); - - closure = pad_private(pad)->getcaps_function; - - g_closure_invoke (closure, &ret, 1, &args, NULL); - - caps = g_value_dup_boxed (&ret); - g_value_unset (&ret); - g_value_unset (&args); - return caps; -} - -static PyObject* -_wrap_gst_pad_set_getcaps_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, getcaps_function) -} - -%% -override gst_pad_set_link_function kwargs - -static void EXCEPTION_HANDLER -handle_link_function_exception (GValue *ret, guint n, const GValue *params) -{ - g_value_set_enum (ret, GST_PAD_LINK_REFUSED); - PyErr_Clear (); -} - -static GstPadLinkReturn -call_link_function (GstPad *pad, GstPad *peer) -{ - GClosure *closure; - GValue ret = { 0, }; - GValue args[2] = { { 0, }, {0, } }; - GstPadLinkReturn i; - - g_value_init (&ret, GST_TYPE_PAD_LINK_RETURN); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_init (&args[1], GST_TYPE_PAD); - g_value_set_object (&args[0], pad); - g_value_set_object (&args[1], peer); - - closure = pad_private(pad)->link_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - - i = g_value_get_enum (&ret); - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - return i; -} - -static PyObject* -_wrap_gst_pad_set_link_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, link_function) -} - -%% -override gst_pad_set_chain_function kwargs - -static void EXCEPTION_HANDLER -handle_chain_function_exception (GValue *ret, guint n, const GValue *params) -{ - GstElement *element = GST_ELEMENT (gst_object_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static GstFlowReturn -call_chain_function(GstPad *pad, GstBuffer *buffer) -{ - GClosure *closure; - GValue ret = { 0, }; - GValue args[2] = { { 0, }, { 0, } }; - GstFlowReturn flow; - - g_value_init (&ret, GST_TYPE_FLOW_RETURN); - g_value_set_enum (&ret, GST_FLOW_ERROR); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_init (&args[1], GST_TYPE_BUFFER); - - g_value_set_object (&args[0], pad); - gst_value_set_mini_object (&args[1], GST_MINI_OBJECT (buffer)); - closure = pad_private(pad)->chain_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - flow = g_value_get_enum (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - - /* a chain function takes over the ref of the buffer handed to it; - * so we should unref after calling the pythonic chain func */ - gst_buffer_unref (buffer); - return flow; -} - -static PyObject* -_wrap_gst_pad_set_chain_function(PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, chain_function) -} - -%% -override gst_pad_set_event_function kwargs - -static void EXCEPTION_HANDLER -handle_event_function_exception (GValue *ret, guint n, const GValue *params) -{ - GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static gboolean -call_event_function (GstPad *pad, GstEvent *event) -{ - GClosure *closure; - GValue ret = { 0, }; - GValue args[2] = { { 0, }, { 0, } }; - gboolean bool; - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, FALSE); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_init (&args[1], GST_TYPE_EVENT); - g_value_set_object (&args[0], pad); - gst_value_set_mini_object (&args[1], GST_MINI_OBJECT (event)); - closure = pad_private(pad)->event_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - - bool = g_value_get_boolean (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - return bool; -} - -static PyObject* -_wrap_gst_pad_set_event_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, - kwargs, event_function) -} - -%% -override gst_pad_set_query_function kwargs - -static gboolean -pypad_copy_struct_members (GQuark field_id, const GValue * value, - GstStructure* to_structure) -{ - gst_structure_id_set_value (to_structure, field_id, value); - - return TRUE; -} - -static gboolean -call_query_function (GstPad *pad, GstQuery *query) -{ - PyGILState_STATE __py_state; - PyGObject *py_pad; - PyGstPadPrivate *priv; - - PyObject *py_ret; - PyObject *py_args; - gboolean ret = FALSE; - GstQuery *query_copy; - PyObject *py_query; - - /* Push our GIL state */ - __py_state = pyg_gil_state_ensure(); - - /* Get the python version of the pad */ - py_pad = (PyGObject *) pygobject_new((GObject*) (pad)); - if (!py_pad) { - if (PyErr_Occurred()) - PyErr_Print(); - goto beach; - } - /* Private data, where our callback should be stored */ - priv = py_pad_private(py_pad); - if (priv->query_function == NULL) { - /* FIXME: Generate an error message somewhere? */ - Py_DECREF(py_pad); - goto beach; - } - - /* Create our arguments tuple and populate */ - py_args = PyTuple_New(2); - - /* We copy the query into a new one so that it can have a refcount - * of exactly 1 and be owned by python */ - pyg_begin_allow_threads; - query_copy = gst_query_copy (query); - pyg_end_allow_threads; - py_query = pygstminiobject_new((GstMiniObject *)query_copy); - gst_query_unref (query_copy); - - PyTuple_SetItem(py_args, 0, (PyObject *) (py_pad)); - PyTuple_SetItem(py_args, 1, py_query); - - /* Perform the callback into python, then parse the result */ - py_ret = PyObject_CallObject(priv->query_function, py_args); - if (!py_ret) { - if (PyErr_Occurred()) - PyErr_Print(); - - Py_DECREF(py_args); - goto beach; - } - - ret = (py_ret == Py_True ? TRUE : FALSE); - - /* If the query succeeded, copy the result back into the original query. - * We still have a refcount to it, because we didn't unref the py_query - * wrapper yet. */ - if (ret) { - /* I feel ill violating the poor query like this, but it's the only - * way to transfer data from our copy back to the original query */ - GstStructure *from, *to; - - pyg_begin_allow_threads; - from = GST_QUERY (query_copy)->structure; - to = query->structure; - gst_structure_foreach (from, - (GstStructureForeachFunc) pypad_copy_struct_members, to); - pyg_end_allow_threads; - } - - Py_DECREF(py_args); - Py_DECREF(py_ret); -beach: - pyg_gil_state_release(__py_state); - - return ret; -} - -static PyObject* -_wrap_gst_pad_set_query_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - static char *kwlist[] = { "query_function", NULL }; - PyObject *function; - GstPad *pad; - PyGstPadPrivate *priv; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O:GstPad.set_query_function", - kwlist, - &function)) { - return NULL; - } - - pad = (GstPad*)pygobject_get(self); - priv = py_pad_private(self); - - /* Allow setting query_function to None to clear it to NULL */ - if (function == Py_None) { - if (priv->query_function) { - Py_DECREF (priv->query_function); - priv->query_function = NULL; - } - gst_pad_set_query_function (pad, NULL); - goto out; - } - - if (!PyCallable_Check(function)) { - PyErr_SetString(PyExc_TypeError, "Passed query_function not callable"); - return NULL; - } - - if (priv->query_function) { - Py_DECREF (priv->query_function); - } - - Py_INCREF(function); - priv->query_function = function; - - gst_pad_set_query_function (pad, call_query_function); - -out: - Py_INCREF(Py_None); - return Py_None; -} - -%% -override gst_pad_set_setcaps_function kwargs - -static void EXCEPTION_HANDLER -handle_setcaps_function_exception (GValue *ret, guint n, const GValue *params) -{ - GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static gboolean -call_setcaps_function (GstPad *pad, GstCaps *caps) -{ - GClosure *closure; - GValue ret = { 0, }; - GValue args[2] = { { 0, }, { 0, } }; - gboolean bool; - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, FALSE); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_init (&args[1], GST_TYPE_CAPS); - g_value_set_object (&args[0], pad); - gst_value_set_caps (&args[1], (const GstCaps*) caps); - closure = pad_private(pad)->setcaps_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - - bool = g_value_get_boolean (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - return bool; -} - -static PyObject* -_wrap_gst_pad_set_setcaps_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, - kwargs, setcaps_function) -} -%% -override gst_pad_set_activate_function kwargs - -static void EXCEPTION_HANDLER -handle_activate_function_exception (GValue * ret, guint n, const GValue * params) -{ - GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static gboolean -call_activate_function (GstPad * pad) -{ - GClosure * closure; - GValue ret = { 0, }; - GValue args[1] = { {0, }}; - gboolean bool; - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, FALSE); - g_value_init(&args[0], GST_TYPE_PAD); - g_value_set_object (&args[0], pad); - closure = pad_private(pad)->activate_function; - - g_closure_invoke (closure, &ret, 1, args, NULL); - - bool = g_value_get_boolean (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - - return bool; -} - -static PyObject * -_wrap_gst_pad_set_activate_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, activate_function) -} -%% -override gst_pad_set_activatepull_function kwargs - -static void EXCEPTION_HANDLER -handle_activatepull_function_exception (GValue * ret, guint n, const GValue * params) -{ - GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static gboolean -call_activatepull_function (GstPad * pad, gboolean active) -{ - GClosure * closure; - GValue ret = { 0, }; - GValue args[2] = { {0, }, {0, } }; - gboolean bool; - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, FALSE); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_set_object (&args[0], pad); - g_value_init (&args[1], G_TYPE_BOOLEAN); - g_value_set_boolean (&args[1], active); - closure = pad_private(pad)->activatepull_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - - bool = g_value_get_boolean (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - - return bool; -} - -static PyObject * -_wrap_gst_pad_set_activatepull_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, activatepull_function); -} -%% -override gst_pad_set_activatepush_function kwargs - -static void EXCEPTION_HANDLER -handle_activatepush_function_exception (GValue * ret, guint n, const GValue * params) -{ - GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (¶ms[0]))); - - if (!_pygst_element_check_error (element)) { - g_assert_not_reached (); /* only returns FALSE when there's no error */ - } -} - -static gboolean -call_activatepush_function (GstPad * pad, gboolean active) -{ - GClosure * closure; - GValue ret = { 0, }; - GValue args[2] = { {0, }, {0, }}; - gboolean bool; - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, FALSE); - g_value_init (&args[0], GST_TYPE_PAD); - g_value_set_object (&args[0], pad); - g_value_init (&args[1], G_TYPE_BOOLEAN); - g_value_set_boolean (&args[1], active); - closure = pad_private(pad)->activatepush_function; - - g_closure_invoke (closure, &ret, 2, args, NULL); - - bool = g_value_get_boolean (&ret); - - g_value_unset (&ret); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - - return bool; -} - -static PyObject * -_wrap_gst_pad_set_activatepush_function (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - SET_PAD_CLOSURE (self, args, kwargs, activatepush_function); -} -%% -override-slot GstPad.tp_repr -static PyObject * -_wrap_gst_pad_tp_repr (PyGObject *self) -{ - char *buf; - PyObject *retval; - GstPad *pad; - GstElement *parent; - gchar *padname = NULL; - gchar *elementname = NULL; - - pad = GST_PAD(self->obj); - - pyg_begin_allow_threads; - padname = gst_pad_get_name (pad); - - parent = GST_ELEMENT (gst_pad_get_parent (pad)); - if (parent) - elementname = gst_element_get_name (parent); - - buf = g_strdup_printf ("", - parent ? elementname : "---", - padname, (long) self->obj); - - g_free(padname); - - if (parent) { - gst_object_unref (parent); - g_free(elementname); - } - pyg_end_allow_threads; - - retval = PyString_FromString(buf); - g_free(buf); - - return retval; -} - -%% -override gst_pad_query kwargs -static PyObject * -_wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "query", NULL }; - int ret; - PyGstMiniObject *query; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GstPad.query", kwlist, &PyGstQuery_Type, &query)) - return NULL; - - pyg_begin_allow_threads; - ret = gst_pad_query(GST_PAD(self->obj), GST_QUERY (query->obj)); - pyg_end_allow_threads; - - return PyBool_FromLong(ret); -} -%% -override gst_pad_convert kwargs -static PyObject * -_wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "src_format", "src_value", - "dest_format", NULL }; - GstFormat src_format, dest_format; - PyObject *src_value_obj; - gint64 src_value, dest_value = 0; - gboolean ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "iOi:GstPad.convert", kwlist, - &src_format, &src_value_obj, - &dest_format)) - return NULL; - - src_value = PyLong_AsLongLong(src_value_obj); - - ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value, - &dest_format, &dest_value); - return PyLong_FromLongLong(dest_value); -} -%% -override gst_pad_link kwargs -static PyObject * -_wrap_gst_pad_link(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "sinkpad", NULL }; - PyGObject *sinkpad; - int ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GstPad.link", kwlist, - &PyGstPad_Type, &sinkpad)) - return NULL; - pyg_begin_allow_threads; - ret = gst_pad_link(GST_PAD(self->obj), GST_PAD(sinkpad->obj)); - pyg_end_allow_threads; - if (ret) { - PyObject *exc_val = pyg_enum_from_gtype(GST_TYPE_PAD_LINK_RETURN, ret); - PyErr_SetObject(PyGstExc_LinkError, exc_val); - Py_DECREF(exc_val); - return NULL; - } - return PyBool_FromLong(ret); -} - -%% -override gst_pad_link_filtered kwargs -static PyObject * -_wrap_gst_pad_link_filtered(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "sinkpad", "filtercaps", NULL }; - PyGObject *sinkpad; - PyObject *py_filtercaps; - int ret; - GstCaps *filtercaps = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O:GstPad.link_filtered", - kwlist, &PyGstPad_Type, &sinkpad, - &py_filtercaps)) - return NULL; - if (pyg_boxed_check(py_filtercaps, GST_TYPE_CAPS)) - filtercaps = pyg_boxed_get(py_filtercaps, GstCaps); - else { - PyErr_SetString(PyExc_TypeError, "filtercaps should be a GstCaps"); - return NULL; - } - ret = gst_pad_link_filtered(GST_PAD(self->obj), - GST_PAD(sinkpad->obj), - filtercaps); - if (ret) { - PyObject *exc_val = pyg_enum_from_gtype(GST_TYPE_PAD_LINK_RETURN, ret); - PyErr_SetObject(PyGstExc_LinkError, exc_val); - Py_DECREF(exc_val); - return NULL; - } - return PyBool_FromLong(ret); -} -%% -override gst_pad_get_pad_template_caps noargs -static PyObject * -_wrap_gst_pad_get_pad_template_caps(PyGObject *self) -{ - GstCaps *ret = (GstCaps*)gst_pad_get_pad_template_caps(GST_PAD(self->obj)); - return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE); -} -%% -override gst_pad_template_get_caps noargs -static PyObject * -_wrap_gst_pad_template_get_caps(PyGObject *self) -{ - GstCaps *ret = (GstCaps*)gst_pad_template_get_caps(GST_PAD_TEMPLATE(self->obj)); - return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE); -} -%% -override gst_pad_template_get_caps_by_name kwargs -static PyObject * -_wrap_gst_pad_template_get_caps_by_name(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", NULL }; - char *name; - GstCaps *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GstPadTemplate.get_caps_by_name", kwlist, &name)) - return NULL; - ret = (GstCaps*)gst_pad_template_get_caps_by_name(GST_PAD_TEMPLATE(self->obj), name); - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE); -} -%% -new-constructor GST_TYPE_PAD -%% -override gst_pad_new kwargs -static int -_wrap_gst_pad_new(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", "direction", NULL }; - static char *kwlist2[] = { "template", "name", NULL }; - PyGObject *templ; - char *name = NULL; - PyObject *py_direction = NULL; - GstPadDirection direction; - - if (PyArg_ParseTupleAndKeywords (args, kwargs, "zO:GstPad.__init__", - kwlist, &name, &py_direction)) { - - GST_LOG ("gst.Pad.__init__: using gst_pad_new"); - if (pyg_enum_get_value (GST_TYPE_PAD_DIRECTION, py_direction, - (gint *) &direction)) { - GST_LOG ("gst.Pad.__init__: direction is not valid"); - return -1; - } - - self->obj = (GObject *) gst_pad_new (name, direction); - } else { - PyErr_Clear (); - - GST_LOG ("gst.Pad.__init__: using gst_pad_new_from_template"); - if (PyArg_ParseTupleAndKeywords (args, kwargs, "O!|s:GstPad.__init__", - kwlist2, &PyGstPadTemplate_Type, - &templ, &name)) { - if (name == NULL) - name = GST_PAD_TEMPLATE_NAME_TEMPLATE (GST_PAD_TEMPLATE ( - templ->obj)); - self->obj = (GObject *) gst_pad_new_from_template ( - GST_PAD_TEMPLATE (templ->obj), name); - } - } - if (!self->obj) { - PyErr_SetString (PyExc_RuntimeError, "could not create GstPad object"); - return -1; - } - pygobject_register_wrapper ((PyObject *)self); - return 0; -} -%% -override gst_pad_add_data_probe args - -static void -data_probe_destroy_data (gpointer data) -{ - PyGILState_STATE state; - PyObject *py_data = (PyObject *) data; - - state = pyg_gil_state_ensure(); - - Py_DECREF (py_data); - - pyg_gil_state_release(state); -} - -static gboolean -data_probe_callback_marshal(GstPad *pad, GstMiniObject *obj, gpointer user_data) -{ - PyGILState_STATE state; - PyObject *callback, *args; - PyObject *pret; - PyObject *py_user_data; - gboolean ret; - - g_return_val_if_fail(user_data != NULL, TRUE); - - state = pyg_gil_state_ensure(); - - py_user_data = (PyObject *) user_data; - - callback = PyTuple_GetItem(py_user_data, 0); - args = Py_BuildValue("(NN)", - pygobject_new(G_OBJECT(pad)), - pygstminiobject_new(GST_MINI_OBJECT(obj))); - - { - PyObject *tmp = args; - args = PySequence_Concat(tmp, PyTuple_GetItem(py_user_data, 1)); - Py_DECREF (tmp); - } - - if (args == NULL) { - ret = FALSE; - goto beach; - } - - pret = PyObject_CallObject(callback, args); - Py_DECREF(args); - - if (!pret) { - PyErr_Print(); - ret = TRUE; - } else { - ret = PyObject_IsTrue(pret)? TRUE : FALSE; - Py_DECREF(pret); - } - -beach: - pyg_gil_state_release(state); - return ret; -} - -static PyObject * -_wrap_gst_pad_add_data_probe(PyGObject *self, PyObject *args) -{ - PyObject *callback, *cbargs = NULL, *data; - PyObject *pret; - gulong ret; - gint len; - - len = PyTuple_Size(args); - if (len < 1) { - PyErr_SetString(PyExc_TypeError, "Requires at least 1 arg"); - return NULL; - } - - callback = PyTuple_GetItem(args, 0); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - cbargs = PySequence_GetSlice(args, 1, len); - if (cbargs == NULL) - return NULL; - data = Py_BuildValue("(ON)", callback, cbargs); - if (data == NULL) - return NULL; - - pyg_begin_allow_threads; - ret = gst_pad_add_data_probe_full(GST_PAD(self->obj), - (GCallback) data_probe_callback_marshal, data, - data_probe_destroy_data); - pyg_end_allow_threads; - - pret = PyLong_FromUnsignedLong(ret); - Py_INCREF(pret); - - return pret; -} -%% -override gst_pad_add_event_probe args -static PyObject * -_wrap_gst_pad_add_event_probe(PyGObject *self, PyObject *args) -{ - PyObject *callback, *cbargs = NULL, *data; - PyObject *pret; - gulong ret; - gint len; - - len = PyTuple_Size(args); - if (len < 1) { - PyErr_SetString(PyExc_TypeError, "Requires at least 1 arg"); - return NULL; - } - - callback = PyTuple_GetItem(args, 0); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - cbargs = PySequence_GetSlice(args, 1, len); - if (cbargs == NULL) - return NULL; - data = Py_BuildValue("(ON)", callback, cbargs); - if (data == NULL) - return NULL; - - pyg_begin_allow_threads; - ret = gst_pad_add_event_probe_full(GST_PAD(self->obj), - (GCallback) data_probe_callback_marshal, data, - data_probe_destroy_data); - pyg_end_allow_threads; - - pret = PyLong_FromUnsignedLong(ret); - Py_INCREF(pret); - - return pret; -} -%% -override gst_pad_add_buffer_probe args - -static PyObject * -_wrap_gst_pad_add_buffer_probe(PyGObject *self, PyObject *args) -{ - PyObject *callback, *cbargs = NULL, *data; - PyObject *pret; - gulong ret; - gint len; - - len = PyTuple_Size(args); - if (len < 1) { - PyErr_SetString(PyExc_TypeError, "Requires at least 1 arg"); - return NULL; - } - - callback = PyTuple_GetItem(args, 0); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - cbargs = PySequence_GetSlice(args, 1, len); - if (cbargs == NULL) - return NULL; - data = Py_BuildValue("(ON)", callback, cbargs); - if (data == NULL) - return NULL; - - pyg_begin_allow_threads; - ret = gst_pad_add_buffer_probe_full(GST_PAD(self->obj), - (GCallback) data_probe_callback_marshal, data, - data_probe_destroy_data); - pyg_end_allow_threads; - - pret = PyLong_FromUnsignedLong(ret); - Py_INCREF(pret); - - return pret; -} -%% -override-slot GstPadTemplate.tp_getattr -#define IS_ATTR(name) (strcmp (name, attr) == 0) -static PyObject * -_wrap_gst_pad_template_tp_getattr(PyObject *self, char *attr) -{ - GstPadTemplate *templ = GST_PAD_TEMPLATE (pygobject_get (self)); - - if (IS_ATTR ("__members__")) { - return Py_BuildValue("[ssss]", "name_template", "direction", "presence", "caps" ); - } else if (IS_ATTR ("name_template")) { - return PyString_FromString (GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)); - } else if (IS_ATTR ("direction")) { - return pyg_enum_from_gtype(GST_TYPE_PAD_DIRECTION, GST_PAD_TEMPLATE_DIRECTION(templ)); - } else if (IS_ATTR ("presence")) { - return pyg_enum_from_gtype(GST_TYPE_PAD_PRESENCE, GST_PAD_TEMPLATE_PRESENCE(templ)); - } else if (IS_ATTR ("caps")) { - return pyg_boxed_new (GST_TYPE_CAPS, GST_PAD_TEMPLATE_CAPS(templ), TRUE, TRUE); - } - return Py_FindMethod((PyMethodDef*) _PyGstPadTemplate_methods, self, attr); -} -%% -override gst_pad_query_position args -static PyObject * -_wrap_gst_pad_query_position (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - PyObject *ret; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if ((gst_pad_query_position(GST_PAD (self->obj), (GstFormat*) &format, &cur))) { - ret = Py_BuildValue("(LO)", cur, - pyg_enum_from_gtype (GST_TYPE_FORMAT, format)); - } else { - Py_INCREF(Py_None); - ret = Py_None; - } - - return ret; -} -%% -override gst_pad_query_duration args -static PyObject * -_wrap_gst_pad_query_duration (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - PyObject *ret; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if ((gst_pad_query_duration(GST_PAD (self->obj), (GstFormat*) &format, &cur))) { - ret = Py_BuildValue("(LO)", cur, - pyg_enum_from_gtype (GST_TYPE_FORMAT, format)); - } else { - Py_INCREF(Py_None); - ret = Py_None; - } - - return ret; -} -%% -override gst_pad_query_convert kwargs -static PyObject * -_wrap_gst_pad_query_convert (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "fromformat", "fromvalue", "destformat", NULL }; - PyObject *pfromformat, *pdestformat; - GstFormat srcformat, destformat; - gint64 fromval, dstval; - - /* Input : src_format, src_val, dst_format */ - /* Returns : dst_format, dst_val OR None */ - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "0L0:GstPad.query_convert", - kwlist, &pfromformat, &fromval, &pdestformat)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_FORMAT, pfromformat, (gint *) &srcformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - if (pyg_enum_get_value(GST_TYPE_FORMAT, pdestformat, (gint *) &destformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if (!(gst_pad_query_convert (GST_PAD(self->obj), - srcformat, fromval, - &destformat, &dstval))) { - Py_INCREF(Py_None); - return Py_None; - } - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat), - dstval); -} -%% -override gst_pad_alloc_buffer kwargs -static PyObject * -_wrap_gst_pad_alloc_buffer (PyGObject *self, PyObject * args, PyObject *kwargs) -{ - static char *kwlist[] = {"offset", "size", "caps", NULL}; - guint64 offset; - gint size; - PyObject *pcaps; - GstCaps *caps; - PyObject *ret; - GstBuffer *buf; - GstFlowReturn res; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "KiO:GstPad.alloc_buffer", - kwlist, &offset, &size, &pcaps)) - return NULL; - caps = pyg_boxed_get(pcaps, GstCaps); - res = gst_pad_alloc_buffer (GST_PAD(pygobject_get(self)), - offset, size, caps, &buf); - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); - if (res != GST_FLOW_OK) { - PyList_SetItem(ret, 1, Py_None); - } else { - PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); - /* Bring down the reference count, since we are meant to be the only - * one holding a reference to the newly created buffer. */ - gst_buffer_unref (buf); - } - return ret; -} -%% -override gst_pad_alloc_buffer_and_set_caps kwargs -static PyObject * -_wrap_gst_pad_alloc_buffer_and_set_caps (PyGObject *self, PyObject * args, PyObject *kwargs) -{ - static char *kwlist[] = {"offset", "size", "caps", NULL}; - guint64 offset; - gint size; - PyObject *pcaps; - GstCaps *caps; - PyObject *ret; - GstBuffer *buf; - GstFlowReturn res; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "KiO:GstPad.alloc_buffer_and_set_caps", - kwlist, &offset, &size, &pcaps)) - return NULL; - caps = pyg_boxed_get(pcaps, GstCaps); - res = gst_pad_alloc_buffer_and_set_caps (GST_PAD(pygobject_get(self)), - offset, size, caps, &buf); - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); - if (res != GST_FLOW_OK) { - PyList_SetItem(ret, 1, Py_None); - } else { - PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); - /* Bring down the reference count, since we are meant to be the only - * one holding a reference to the newly created buffer. */ - gst_buffer_unref (buf); - } - return ret; -} -%% -override gst_pad_pull_range kwargs -static PyObject * -_wrap_gst_pad_pull_range (PyGObject *self, PyObject * args, PyObject *kwargs) -{ - static char *kwlist[] = {"offset", "size", NULL}; - guint64 offset; - gint size; - PyObject *ret; - GstBuffer *buf; - GstFlowReturn res; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "Ki:GstPad.pull_range", - kwlist, &offset, &size)) - return NULL; - res = gst_pad_pull_range (GST_PAD(pygobject_get(self)), - offset, size, &buf); - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); - if (res != GST_FLOW_OK) { - PyList_SetItem(ret, 1, Py_None); - } else { - PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); - /* Bring down the reference count, since we are meant to be the only - * one holding a reference to the newly created buffer. */ - gst_buffer_unref (buf); - } - return ret; -} -%% -override gst_pad_get_range kwargs -static PyObject * -_wrap_gst_pad_get_range (PyGObject *self, PyObject * args, PyObject *kwargs) -{ - static char *kwlist[] = {"offset", "size", NULL}; - guint64 offset; - gint size; - PyObject *ret; - GstBuffer *buf; - GstFlowReturn res; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "Ki:GstPad.get_range", - kwlist, &offset, &size)) - return NULL; - res = gst_pad_get_range (GST_PAD(pygobject_get(self)), - offset, size, &buf); - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); - if (res != GST_FLOW_OK) { - PyList_SetItem(ret, 1, Py_None); - } else { - PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); - /* Bring down the reference count, since we are meant to be the only - * one holding a reference to the newly created buffer. */ - gst_buffer_unref (buf); - } - return ret; -} -%% -override gst_pad_get_internal_links noargs -static PyObject * -_wrap_gst_pad_get_internal_links (PyGObject * self) -{ - PyObject *ret; - GList *lst, *tmp; - gint i; - - lst = gst_pad_get_internal_links (GST_PAD (pygobject_get(self))); - - ret = PyList_New(g_list_length(lst)); - for (tmp = lst, i = 0 ; tmp; tmp = g_list_next(tmp), ++i) { - PyList_SetItem(ret, i, pygobject_new(G_OBJECT(tmp->data))); - } - g_list_free(lst); - return ret; -} -%% -override gst_pad_get_internal_links_default noargs -static PyObject * -_wrap_gst_pad_get_internal_links_default (PyGObject * self) -{ - PyObject *ret; - GList *lst, *tmp; - gint i; - - lst = gst_pad_get_internal_links_default (GST_PAD (pygobject_get(self))); - - ret = PyList_New(g_list_length(lst)); - for (tmp = lst, i = 0 ; tmp; tmp = g_list_next(tmp), ++i) { - PyList_SetItem(ret, i, pygobject_new(G_OBJECT(tmp->data))); - } - g_list_free(lst); - return ret; -} -%% -override gst_pad_get_query_types noargs -static PyObject * -_wrap_gst_pad_get_query_types (PyGObject *self) -{ - PyObject *ret; - PyObject *item; - int i; - GstQueryType *tab; - - tab = (GstQueryType*) gst_pad_get_query_types(GST_PAD(self->obj)); - if (tab == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - - ret = PyList_New(0); - for (i = 0; tab[i] != 0; i++) { - item = pyg_enum_from_gtype (GST_TYPE_QUERY_TYPE, tab[i]); - PyList_Append(ret, item); - Py_XDECREF(item); - } - - return ret; -} -%% -override gst_pad_get_query_types_default noargs -static PyObject * -_wrap_gst_pad_get_query_types_default (PyGObject *self) -{ - PyObject *ret; - PyObject *item; - int i; - GstQueryType *tab; - - tab = (GstQueryType*) gst_pad_get_query_types_default(GST_PAD(self->obj)); - if (tab == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - - ret = PyList_New(0); - for (i = 0; tab[i] != 0; i++) { - item = pyg_enum_from_gtype (GST_TYPE_QUERY_TYPE, tab[i]); - PyList_Append(ret, item); - Py_XDECREF(item); - } - - return ret; -} -%% -override gst_pad_set_blocked_async args - -#if HAVE_SET_BLOCKED_ASYNC_FULL -static void -pad_block_destroy_data (gpointer data) -{ - PyGILState_STATE state; - PyObject *py_data = (PyObject *) data; - - state = pyg_gil_state_ensure(); - - Py_DECREF (py_data); - - pyg_gil_state_release(state); -} -#endif - -static void -pad_block_callback_marshal(GstPad *pad, gboolean blocked, gpointer user_data) -{ - PyGILState_STATE state; - PyObject *callback, *args; - PyObject *ret; - PyObject *py_user_data; - - g_return_if_fail(user_data != NULL); - - state = pyg_gil_state_ensure(); - - py_user_data = (PyObject *) user_data; - - callback = PyTuple_GetItem(py_user_data, 0); - args = Py_BuildValue("(NO)", - pygobject_new(G_OBJECT(pad)), - blocked ? Py_True : Py_False); - - { - PyObject *tmp = args; - args = PySequence_Concat(tmp, PyTuple_GetItem(py_user_data, 1)); - Py_DECREF (tmp); - } - - if (args == NULL) - goto beach; - - ret = PyObject_CallObject(callback, args); - - if (!ret) - PyErr_Print(); - else - Py_DECREF(ret); - -beach: - pyg_gil_state_release(state); -} - -static PyObject * -_wrap_gst_pad_set_blocked_async (PyGObject *self, PyObject *args) -{ - PyObject *callback, *cbargs = NULL, *data; - PyObject *pblocked, *pret; - gboolean blocked; - gboolean ret; - gint len; - - len = PyTuple_Size(args); - - if (len < 2) { - PyErr_SetString(PyExc_TypeError, "Requires at least 2 arg"); - return NULL; - } - pblocked = PyTuple_GetItem(args, 0); - blocked = PyObject_IsTrue(pblocked); - - callback = PyTuple_GetItem(args, 1); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - return NULL; - } - cbargs = PySequence_GetSlice(args, 2, len); - if (cbargs == NULL) - return NULL; - data = Py_BuildValue("(ON)", callback, cbargs); - if (data == NULL) - return NULL; - pyg_begin_allow_threads; -#if HAVE_SET_BLOCKED_ASYNC_FULL - ret = gst_pad_set_blocked_async_full (GST_PAD (self->obj), blocked, - (GstPadBlockCallback) pad_block_callback_marshal, data, - pad_block_destroy_data); -#else - ret = gst_pad_set_blocked_async (GST_PAD (self->obj), blocked, - (GstPadBlockCallback) pad_block_callback_marshal, data); -#endif - pyg_end_allow_threads; - if (ret) - pret = Py_True; - else - pret = Py_False; - Py_INCREF(pret); - - return pret; -} -%% -override gst_pad_set_caps kwargs -static PyObject * -_wrap_gst_pad_set_caps(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "caps", NULL }; - PyObject *py_caps; - int ret; - GstCaps *caps; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstPad.set_caps", kwlist, &py_caps)) - return NULL; - if (py_caps == Py_None) { - caps = NULL; - } else { - caps = pygst_caps_from_pyobject (py_caps, NULL); - if (PyErr_Occurred()) - return NULL; - } - pyg_begin_allow_threads; - ret = gst_pad_set_caps(GST_PAD(self->obj), caps); - if (ret && caps) - gst_caps_unref (caps); - pyg_end_allow_threads; - return PyBool_FromLong(ret); - -} -%% -override gst_pad_query_peer_position args -static PyObject * -_wrap_gst_pad_query_peer_position (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - PyObject *ret; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if ((gst_pad_query_peer_position(GST_PAD (self->obj), (GstFormat*) &format, &cur))) { - ret = PyList_New(2); - PyList_SetItem(ret, 0, PyLong_FromLongLong(cur)); - PyList_SetItem(ret, 1, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); - } else { - Py_INCREF(Py_None); - ret = Py_None; - } - - return ret; -} -%% -override gst_pad_query_peer_duration args -static PyObject * -_wrap_gst_pad_query_peer_duration (PyGObject *self, PyObject *args) -{ - gint64 cur; - gint format; - PyObject *pformat; - PyObject *ret; - - pformat = (PyObject*)PyTuple_GetItem(args, 0); - if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if ((gst_pad_query_peer_duration(GST_PAD (self->obj), (GstFormat*) &format, &cur))) { - ret = PyList_New(2); - PyList_SetItem(ret, 0, PyLong_FromLongLong(cur)); - PyList_SetItem(ret, 1, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); - } else { - Py_INCREF(Py_None); - ret = Py_None; - } - - return ret; -} -%% -override gst_pad_query_peer_convert kwargs -static PyObject * -_wrap_gst_pad_query_peer_convert (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "fromformat", "fromvalue", "destformat", NULL }; - PyObject *pfromformat, *pdestformat; - GstFormat srcformat, destformat; - gint64 fromval, dstval; - PyObject *ret; - - /* Input : src_format, src_val, dst_format */ - /* Returns : dst_format, dst_val OR None */ - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "0L0:GstPad.query_peer_convert", - kwlist, &pfromformat, &fromval, &pdestformat)) - return NULL; - if (pyg_enum_get_value(GST_TYPE_FORMAT, pfromformat, (gint *) &srcformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - if (pyg_enum_get_value(GST_TYPE_FORMAT, pdestformat, (gint *) &destformat)) { - PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); - return NULL; - } - - if (!(gst_pad_query_peer_convert (GST_PAD(self->obj), - srcformat, fromval, - &destformat, &dstval))) { - Py_INCREF(Py_None); - return Py_None; - } - - ret = PyList_New(2); - PyList_SetItem(ret, 0, pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat)); - PyList_SetItem(ret, 1, PyLong_FromLongLong(dstval)); - - return ret; -} -%% -override-attr GstStaticPadTemplate.static_caps -static PyObject * -_wrap_gst_static_pad_template__get_static_caps(PyObject *self, void *closure) -{ - GstStaticPadTemplate *templ; - - - templ = pyg_pointer_get(self, GstStaticPadTemplate); - return pyg_pointer_new(GST_TYPE_STATIC_CAPS, &(templ->static_caps)); -} -%% -override gst_pad_start_task args -static void -pad_task_handler(void *data) { - PyGILState_STATE state; - PyObject *callback, *args = NULL; - PyObject *py_user_data; - - if (data == NULL) - return; - - state = pyg_gil_state_ensure(); - py_user_data = (PyObject*) data; - - callback = PyTuple_GetItem(py_user_data, 0); - if (!(PyCallable_Check(callback))) { - PyErr_Print(); - goto beach; - } - if (!(args = PyTuple_GetSlice(py_user_data, 1, PyTuple_Size(py_user_data)))) { - PyErr_Print(); - goto beach; - } - - if (!(PyTuple_Check(args))) { - PyErr_Print(); - goto beach; - } - - PyObject_CallObject(callback, args); - - if(PyErr_Occurred()) - PyErr_Print(); - - Py_DECREF(args); - - beach: - pyg_gil_state_release(state); -} - -static PyObject * -_wrap_gst_pad_start_task(PyGObject *self, PyObject *args) -{ - PyObject *callback, *data, *cbargs, *py_ret; - gboolean ret; - - /* 1st argument must be a callable */ - if (PyTuple_Size(args) < 1) { - PyErr_SetString(PyExc_TypeError, "gst.Pad.start_task() requires at least 1 argument"); - return NULL; - } - - callback = PySequence_GetItem(args, 0); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback must be a function or method"); - Py_DECREF(callback); - return NULL; - } - - if (!(cbargs = PySequence_GetSlice(args, 1, PyTuple_Size(args)))) { - Py_DECREF(callback); - return NULL; - } - - if (!(data = Py_BuildValue("(ON)", callback, cbargs))) { - Py_DECREF(callback); - Py_DECREF(cbargs); - return NULL; - } - - pyg_begin_allow_threads; - ret = gst_pad_start_task(GST_PAD(self->obj), (GstTaskFunction) pad_task_handler, data); - pyg_end_allow_threads; - - if (ret == TRUE) - py_ret = Py_True; - else - py_ret = Py_False; - - Py_INCREF(py_ret); - return py_ret; -} -%% -override gst_static_pad_template_get_caps noargs -static PyObject * -_wrap_gst_static_pad_template_get_caps(PyObject *self) -{ - GstCaps *ret; - - ret = gst_static_pad_template_get_caps(pyg_pointer_get(self, GstStaticPadTemplate)); - /* We take a copy of the caps so they don't disappear */ - ret = gst_caps_copy(ret); - return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE); -} diff --git a/gst/gstquery.override b/gst/gstquery.override deleted file mode 100644 index 9435eeef84..0000000000 --- a/gst/gstquery.override +++ /dev/null @@ -1,324 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Johan Dahlin - */ -%% -ignore - gst_query_set_formatsv -%% -override gst_query_parse_position noargs -static PyObject * -_wrap_gst_query_parse_position (PyGstMiniObject *self) -{ - GstFormat format; - gint64 cur; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_POSITION) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Position' query"); - return NULL; - } - - gst_query_parse_position (GST_QUERY(self->obj), &format, &cur); - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - cur); -} -%% -override gst_query_parse_duration noargs -static PyObject * -_wrap_gst_query_parse_duration (PyGstMiniObject *self) -{ - GstFormat format; - gint64 cur; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_DURATION) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Duration' query"); - return NULL; - } - - gst_query_parse_duration (GST_QUERY(self->obj), &format, &cur); - - return Py_BuildValue("(OL)", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - cur); -} -%% -override gst_query_parse_convert noargs -static PyObject * -_wrap_gst_query_parse_convert (PyGstMiniObject *self) -{ - GstFormat srcformat, destformat; - gint64 srcvalue, destvalue; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_CONVERT) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Convert' query"); - return NULL; - } - - gst_query_parse_convert (GST_QUERY(self->obj), - &srcformat, &srcvalue, - &destformat, &destvalue); - - return Py_BuildValue("(OLOL)", - pyg_enum_from_gtype(GST_TYPE_FORMAT, srcformat), - srcvalue, - pyg_enum_from_gtype(GST_TYPE_FORMAT, destformat), - destvalue); -} -%% -override gst_query_parse_segment noargs -static PyObject * -_wrap_gst_query_parse_segment (PyGstMiniObject *self) -{ - gdouble rate; - GstFormat format; - gint64 start_value; - gint64 stop_value; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_SEGMENT) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Segment' query"); - return NULL; - } - - gst_query_parse_segment (GST_QUERY(self->obj), - &rate, &format, - &start_value, &stop_value); - - return Py_BuildValue("(dOLL)", - rate, - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - start_value, stop_value); -} -%% -override gst_query_parse_seeking noargs -static PyObject * -_wrap_gst_query_parse_seeking (PyGstMiniObject *self) -{ - GstFormat format; - gboolean seekable; - gint64 segment_start, segment_end; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_SEEKING) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Seeking' query"); - return NULL; - } - - gst_query_parse_seeking (GST_QUERY(self->obj), - &format, &seekable, - &segment_start, &segment_end); - - return Py_BuildValue("(OOLL)", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - PyBool_FromLong(seekable), - segment_start, - segment_end); -} -%% -override gst_query_parse_formats_length noargs -static PyObject * -_wrap_gst_query_parse_formats_length (PyGstMiniObject *self) -{ - PyObject *ret; - guint n_formats; - - if (GST_QUERY_TYPE(self->obj) != GST_QUERY_FORMATS) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query"); - return NULL; - } - - gst_query_parse_formats_length (GST_QUERY (self->obj), - &n_formats); - - ret = PyInt_FromLong(n_formats); - - return ret; -} -%% -override gst_query_parse_formats_nth kwargs -static PyObject * -_wrap_gst_query_parse_formats_nth (PyGstMiniObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"nth", NULL}; - guint nth; - GstFormat format; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_FORMATS) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query"); - return NULL; - } - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:GstQuery.parse_formats_nth", kwlist, &nth)) - return NULL; - - gst_query_parse_formats_nth (GST_QUERY (self->obj), - nth, &format); - - return pyg_enum_from_gtype (GST_TYPE_FORMAT, format); -} -%% -override gst_query_set_formats args -static PyObject * -_wrap_gst_query_set_formats (PyGstMiniObject *self, PyObject *args) -{ - PyObject *ret = NULL; - gint len, i; - GstFormat *formats; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_FORMATS) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query"); - return NULL; - } - - if ((len = PyTuple_Size(args)) < 1) { - PyErr_SetString(PyExc_TypeError, "You need to supply at least one gst.Format"); - return NULL; - } - - formats = g_new0(GstFormat, len); - - for (i = 0; i < len; i++) { - if (pyg_enum_get_value(GST_TYPE_FORMAT, - PyTuple_GetItem(args, i), - (gint *) &formats[i])) - goto beach; - } - - gst_query_set_formatsv (GST_QUERY(self->obj), len, formats); - - Py_INCREF(Py_None); - ret = Py_None; - - beach: - g_free(formats); - return ret; -} -%% -override gst_query_get_structure noargs -static PyObject * -_wrap_gst_query_get_structure(PyGstMiniObject *self) -{ - GstStructure *ret; - - pyg_begin_allow_threads; - ret = gst_query_get_structure(GST_QUERY(self->obj)); - pyg_end_allow_threads; - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, FALSE, FALSE); -} -%% -override gst_query_parse_latency noargs -static PyObject * -_wrap_gst_query_parse_latency (PyGstMiniObject * self) -{ - gboolean islive; - GstClockTime minlat, maxlat; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_LATENCY) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'latency' query"); - return NULL; - } - - gst_query_parse_latency (GST_QUERY (self->obj), &islive, &minlat, &maxlat); - - return Py_BuildValue("(OKK)", - PyBool_FromLong(islive), - minlat, maxlat); -} -%% -override gst_query_parse_buffering_percent noargs -static PyObject * -_wrap_gst_query_parse_buffering_percent (PyGstMiniObject * self) -{ - gboolean busy; - gint percent; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_BUFFERING) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'buffering' query"); - return NULL; - } - - gst_query_parse_buffering_percent (GST_QUERY (self->obj), &busy, &percent); - - return Py_BuildValue("(Od)", PyBool_FromLong(busy), percent); -} -%% -override gst_query_parse_buffering_stats noargs -static PyObject * -_wrap_gst_query_parse_buffering_stats (PyGstMiniObject * self) -{ - GstBufferingMode mode; - gint avg_in, avg_out; - gint64 buffering_left; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_BUFFERING) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'buffering' query"); - return NULL; - } - - gst_query_parse_buffering_stats (GST_QUERY (self->obj), &mode, - &avg_in, &avg_out, - &buffering_left); - return Py_BuildValue("OiiL", - pyg_enum_from_gtype (GST_TYPE_BUFFERING_MODE, mode), - avg_in, avg_out, buffering_left); -} -%% -override gst_query_parse_buffering_range noargs -static PyObject * -_wrap_gst_query_parse_buffering_range (PyGstMiniObject * self) -{ - GstFormat format; - gint64 start, stop, estimated_total; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_BUFFERING) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'buffering' query"); - return NULL; - } - - gst_query_parse_buffering_range (GST_QUERY (self->obj), &format, - &start, &stop, &estimated_total); - return Py_BuildValue("OLLL", - pyg_enum_from_gtype (GST_TYPE_FORMAT, format), - start, stop, estimated_total); -} -%% -override gst_query_parse_uri noargs -static PyObject * -_wrap_gst_query_parse_uri (PyGstMiniObject * self) -{ - gchar *uri = NULL; - PyObject *ret; - - if (GST_QUERY_TYPE (self->obj) != GST_QUERY_URI) { - PyErr_SetString(PyExc_TypeError, "Query is not a 'uri' query"); - return NULL; - } - - gst_query_parse_uri (GST_QUERY (self->obj), &uri); - if (uri) { - ret = PyString_FromStringAndSize(uri, strlen (uri)); - g_free(uri); - } else { - Py_INCREF(Py_None); - ret = Py_None; - } - return ret; -} diff --git a/gst/gstreamer.py b/gst/gstreamer.py deleted file mode 100644 index b239ea47a7..0000000000 --- a/gst/gstreamer.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# 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 - -from gst import * diff --git a/gst/gststructure.override b/gst/gststructure.override deleted file mode 100644 index 771f83e6a7..0000000000 --- a/gst/gststructure.override +++ /dev/null @@ -1,348 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2005 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: Johan Dahlin - */ -%% -ignore - gst_structure_get_boolean - gst_structure_get_int - gst_structure_get_fourcc - gst_structure_get_double - gst_structure_get_date - gst_structure_get_clock_time - gst_structure_get_string - gst_structure_get_value - gst_structure_get_enum - gst_structure_get_fraction - gst_structure_set - gst_structure_get_name_id - gst_structure_id_get_value - gst_structure_id_set_value - gst_structure_set_parent_refcount - gst_structure_remove_fields - gst_structure_map_in_place - gst_structure_fixate_field_nearest_fraction -%% -override gst_structure_new kwargs -static int -_wrap_gst_structure_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", NULL }; - char *name; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GstStructure.__init__", kwlist, &name)) - return -1; - - self->gtype = GST_TYPE_STRUCTURE; - self->free_on_dealloc = FALSE; - - self->boxed = gst_structure_new(name, NULL); - - if (!self->boxed) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstStructure object"); - return -1; - } - return 0; -} -%% -override gst_structure_set_value kwargs -static PyObject * -_wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "field", "value", "type_name", NULL }; - char *field; - PyObject *py_value = NULL; - char *type_name = NULL; - GType type; - GValue value = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "sO|s:GstStructure.set_value", - kwlist, &field, &py_value, - &type_name)) { - return NULL; - } - - if (type_name) { - if (strcmp (type_name, "char") == 0) { - type = G_TYPE_CHAR; - } else if (strcmp (type_name, "uchar") == 0) { - type = G_TYPE_UCHAR; - } else if (strcmp (type_name, "boolean") == 0) { - type = G_TYPE_BOOLEAN; - } else if (strcmp (type_name, "int") == 0) { - type = G_TYPE_INT; - } else if (strcmp (type_name, "uint") == 0) { - type = G_TYPE_UINT; - } else if (strcmp (type_name, "long") == 0) { - type = G_TYPE_LONG; - } else if (strcmp (type_name, "ulong") == 0) { - type = G_TYPE_ULONG; - } else if (strcmp (type_name, "int64") == 0) { - type = G_TYPE_INT64; - } else if (strcmp (type_name, "uint64") == 0) { - type = G_TYPE_UINT64; - } else if (strcmp (type_name, "float") == 0) { - type = G_TYPE_FLOAT; - } else if (strcmp (type_name, "double") == 0) { - type = G_TYPE_DOUBLE; - } else if (strcmp (type_name, "string") == 0) { - type = G_TYPE_STRING; - } else { - PyErr_SetString(PyExc_TypeError, - "invalid type name"); - return NULL; - } - } else if (py_value == Py_None) { - PyErr_SetString(PyExc_TypeError, "value can't be None"); - return NULL; - } else { - type = pyg_type_from_object((PyObject *) py_value->ob_type); - } - - if (type != G_TYPE_INVALID) { - g_value_init(&value, type); - } else if (!pygst_value_init_for_pyobject(&value, py_value)) { - return NULL; - } - - if (pygst_value_from_pyobject(&value, py_value) != 0) { - return NULL; - } - gst_structure_set_value(pyg_boxed_get(self, GstStructure), field, - &value); - - Py_INCREF(Py_None); - return Py_None; -} -%% -define GstStructure.has_key args -static PyObject* -_wrap_gst_structure_has_key(PyGObject *self, PyObject *args) -{ - gchar *key; - gboolean has_field; - - if (!PyArg_ParseTuple(args, "s:GstStructure.has_key", &key)) - return NULL; - - has_field = gst_structure_has_field((GstStructure*)self->obj, key); - - return PyBool_FromLong(has_field); -} - -%% -override gst_structure_keys noargs -static PyObject * -_wrap_gst_structure_keys (PyObject *self) -{ - GstStructure *s; - int i, n; - PyObject *ret; - - s = pyg_boxed_get(self, GstStructure); - n = gst_structure_n_fields(s); - ret = PyList_New(n); - - for (i = 0; i < n; ++i) { - const gchar *name = gst_structure_nth_field_name (s, i); - PyList_SetItem(ret, i, PyString_FromString(name)); - } - - return ret; -} - - -%% -override-slot GstStructure.tp_as_mapping -static Py_ssize_t -_wrap_gst_structure_length(PyObject *self) -{ - PyGObject *gself = (PyGObject *)self; - return gst_structure_n_fields((GstStructure*)gself->obj); -} - -static PyObject * -_wrap_gst_structure_subscript(PyGObject *self, PyObject *py_key) -{ - PyObject *v = NULL; - const char *field = PyString_AsString(py_key); - - if (gst_structure_has_field((GstStructure*)self->obj, field)) { - const GValue *gvalue; - gvalue = gst_structure_get_value((GstStructure*)self->obj, field); - g_assert(gvalue != NULL); - v = pygst_value_as_pyobject(gvalue, TRUE); - } else { - PyErr_SetString(PyExc_KeyError, field); - } - - return v; -} - -static int -_wrap_gst_structure_ass_subscript(PyGObject *self, - PyObject *py_key, - PyObject *py_value) -{ - const char *key; - GstStructure* structure; - - structure = (GstStructure*)self->obj; - key = PyString_AsString(py_key); - if (py_value != NULL) { - GValue v = { 0, }; - if (!pygst_value_init_for_pyobject (&v, py_value)) - return -1; - if (pygst_value_from_pyobject(&v, py_value)) - return -1; - gst_structure_set_value(structure, key, &v); - g_value_unset(&v); - } else { - gst_structure_remove_field(structure, key); - } - - return 0; -} - -static PyMappingMethods _wrap_gst_structure_tp_as_mapping = { - _wrap_gst_structure_length, /* mp_length */ - (binaryfunc)_wrap_gst_structure_subscript, /* mp_subscript */ - (objobjargproc)_wrap_gst_structure_ass_subscript /* mp_ass_subscript */ -}; - -%% -override gst_structure_foreach kwargs -static gboolean -pygst_structure_foreach_marshal(GQuark field_id, - const GValue *value, - gpointer user_data) -{ - PyGstCustomNotify *cunote = user_data; - PyObject *py_field, *py_value, *retobj; - gboolean retval = TRUE; - PyGILState_STATE state; - - g_assert(cunote->func); - - state = pyg_gil_state_ensure(); - - py_field = Py_BuildValue("s", g_quark_to_string(field_id)); - py_value = pygst_value_as_pyobject(value, FALSE); - if (cunote->data) - retobj = PyEval_CallFunction(cunote->func, "(NNO)", - py_field, py_value, - cunote->data); - else - retobj = PyEval_CallFunction(cunote->func, "(NN)", - py_field, py_value); - - if (PyErr_Occurred () || (retobj == NULL) || (retobj == Py_None)) { - PyErr_Print (); - retval = FALSE; - } else if (retobj != Py_None) { - retval = PyInt_AsLong(retobj); - } - - Py_XDECREF(retobj); - - pyg_gil_state_release(state); - - return retval; -} - -static PyObject * -_wrap_gst_structure_foreach (PyGObject *self, - PyObject *args, - PyObject *kwargs) -{ - static char *kwlist[] = { "foreach_function", "args", NULL }; - PyObject *pyfunc, *pyarg = NULL; - PyGstCustomNotify cunote; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O|O:GstStructure.foreach", - kwlist, - &pyfunc, &pyarg)) { - return NULL; - } - - if (!PyCallable_Check(pyfunc)) { - PyErr_SetString(PyExc_TypeError, "foreach_function not callable"); - return NULL; - } - - cunote.func = pyfunc; - cunote.data = pyarg; - gst_structure_foreach(pyg_boxed_get(self, GstStructure), - pygst_structure_foreach_marshal, - &cunote); - - Py_INCREF(Py_None); - return Py_None; -} -%% -override-slot GstStructure.tp_repr -static PyObject * -_wrap_gst_structure_tp_repr (PyGObject *self) -{ - char *buf; - PyObject *retval; - - buf = g_strdup_printf("", - gst_structure_get_name((GstStructure*)self->obj), - (long)self->obj); - - retval = PyString_FromString(buf); - g_free(buf); - return retval; -} -%% -override gst_structure_from_string kwargs -static PyObject * -_wrap_gst_structure_from_string(PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "string", NULL }; - char *string; - GstStructure *ret; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:structure_from_string", kwlist, &string)) - return NULL; - - ret = gst_structure_from_string(string, NULL); - - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, FALSE, TRUE); -} -%% -override-slot GstStructure.tp_dealloc -static void -_wrap_gst_structure_tp_dealloc (PyObject *self) -{ - PyGBoxed *boxed = (PyGBoxed *) self; - - if (boxed->free_on_dealloc && boxed->boxed) { - gst_structure_free (boxed->boxed); - } else if (boxed->boxed) { - pygst_caps_map_remove_structure (self); - } - - self->ob_type->tp_free((PyObject *)self); -} diff --git a/gst/gsttaglist.override b/gst/gsttaglist.override deleted file mode 100644 index 37752323da..0000000000 --- a/gst/gsttaglist.override +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2005 Edward Hervey - * - * 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: Edward Hervey - */ - -%% -ignore-glob - gst_tag_list_get_* -%% -ignore - gst_tag_list_add - gst_tag_list_add_values - gst_tag_list_add_valist_values - gst_tag_list_copy_value - gst_tag_list_get - gst_tag_list_remove_tag - gst_tag_list_foreach - gst_is_tag_list -%% -define GstTagList.keys noargs -static void -tag_foreach_func_list (const GstTagList *list, - const gchar *tag, - PyObject *py_list) -{ - int count; - - count = gst_tag_list_get_tag_size(GST_TAG_LIST(list), tag); - if (count == 0) - PyErr_SetString(PyExc_KeyError, tag); - else if (count > 0) - PyList_Append(py_list, PyString_FromString(tag)); -} - -static PyObject* -_wrap_gst_tag_list_keys(PyGObject *self) -{ - PyObject *dict; - - dict = PyList_New(0); - - gst_tag_list_foreach(GST_TAG_LIST(self->obj), - (GstTagForeachFunc)tag_foreach_func_list, - (gpointer)dict); - return dict; -} -%% -override-slot GstTagList.tp_as_mapping -static Py_ssize_t -_wrap_gst_tag_list_length(PyObject *self) -{ - PyGObject *gself = (PyGObject *)self; - return gst_structure_n_fields((GstStructure*)gself->obj); -} - -static PyObject * -_wrap_gst_tag_list_subscript(PyGObject *self, PyObject *py_key) -{ - PyObject *v = NULL; - const char *field = PyString_AsString(py_key); - - if (gst_structure_has_field((GstStructure*)self->obj, field)) { - const GValue *gvalue; - gvalue = gst_structure_get_value((GstStructure*)self->obj, field); - g_assert(gvalue != NULL); - v = pygst_value_as_pyobject(gvalue, TRUE); - } else { - PyErr_SetString(PyExc_KeyError, field); - } - - return v; -} - -static int -_wrap_gst_tag_list_ass_subscript(PyGObject *self, - PyObject *py_key, - PyObject *py_value) -{ - const char *key; - GstStructure* structure; - GType tagtype; - - structure = (GstStructure*)self->obj; - key = PyString_AsString(py_key); - if (py_value != NULL) { - GValue v = { 0, }; - - if (!pygst_value_init_for_pyobject (&v, py_value)) - return -1; - if (pygst_value_from_pyobject(&v, py_value)) - return -1; - - /* some tags are supposed to be uint, but there is no unsigned - * int python type, so convert here if needed */ - if (gst_tag_exists (key)) { - tagtype = gst_tag_get_type (key); - - if (tagtype && tagtype != G_VALUE_TYPE (&v)) { - GValue w = { 0, }; - - g_value_init (&w, tagtype); - g_value_transform (&v, &w); - g_value_unset (&v); - g_value_init (&v, tagtype); - g_value_copy (&w, &v); - } - } - gst_structure_set_value(structure, key, &v); - g_value_unset(&v); - } else { - gst_structure_remove_field(structure, key); - } - - return 0; -} - -static PyMappingMethods _wrap_gst_tag_list_tp_as_mapping = { - _wrap_gst_tag_list_length, /* mp_length */ - (binaryfunc)_wrap_gst_tag_list_subscript, /* mp_subscript */ - (objobjargproc)_wrap_gst_tag_list_ass_subscript /* mp_ass_subscript */ -}; -%% -override-slot GstTagList.tp_as_sequence -static int -_wrap_gst_tag_list_contains(PyGObject *self, PyObject *py_key) -{ - return gst_structure_has_field((GstStructure*)self->obj, - PyString_AsString(py_key)); -} - -static PySequenceMethods _wrap_gst_tag_list_tp_as_sequence = { - (lenfunc)NULL, - (binaryfunc)NULL, - (ssizeargfunc)NULL, - (ssizeargfunc)NULL, - (ssizessizeargfunc)NULL, - (ssizeobjargproc)NULL, - (ssizessizeobjargproc)NULL, - (objobjproc)_wrap_gst_tag_list_contains, - (binaryfunc)NULL, - (ssizeargfunc)NULL, -}; - diff --git a/gst/gstversion.override.in b/gst/gstversion.override.in deleted file mode 100644 index 22d6bb940d..0000000000 --- a/gst/gstversion.override.in +++ /dev/null @@ -1,23 +0,0 @@ -%% -include -@IGNORE_GST_0_10_21@ -@IGNORE_GST_0_10_22@ -@IGNORE_GST_0_10_23@ -@IGNORE_GST_PB_0_10_23@ -@IGNORE_GST_0_10_24@ -@IGNORE_GST_0_10_25@ -@IGNORE_GST_PB_0_10_25@ -@IGNORE_GST_0_10_26@ -@IGNORE_GST_PB_0_10_26@ -@IGNORE_GST_LOADSAVE@ -@IGNORE_GST_0_10_29@ -@IGNORE_GST_PB_0_10_29@ -@IGNORE_GST_0_10_30@ -@IGNORE_GST_PB_0_10_30@ -@IGNORE_GST_0_10_31@ -@IGNORE_GST_PB_0_10_31@ -@IGNORE_GST_0_10_32@ -@IGNORE_GST_PB_0_10_32@ -@IGNORE_GST_0_10_36@ -@IGNORE_GST_PB_0_10_36@ -%% diff --git a/gst/interfaces.defs b/gst/interfaces.defs deleted file mode 100644 index c88d812e11..0000000000 --- a/gst/interfaces.defs +++ /dev/null @@ -1,1255 +0,0 @@ -;; -*- scheme -*- - -(include "xoverlay.defs") - -;; object definitions ... - -;; -;; interface definitions ... -;; - -(define-interface ColorBalance - (in-module "Gst") - (c-name "GstColorBalance") - (gtype-id "GST_TYPE_COLOR_BALANCE") - (vtable "GstColorBalanceClass") -) - -(define-object ColorBalanceChannel - (in-module "Gst") - (parent "GObject") - (c-name "GstColorBalanceChannel") - (gtype-id "GST_TYPE_COLOR_BALANCE_CHANNEL") - (fields - '("gchar*" "label") - '("gint" "min_value") - '("gint" "max_value") - ) -) - -(define-interface Mixer - (in-module "Gst") - (c-name "GstMixer") - (gtype-id "GST_TYPE_MIXER") - (fields - '("GstMixerType" "mixer_type") - ) - (vtable "GstMixerClass") -) - -(define-object MixerTrack - (in-module "Gst") - (parent "GObject") - (c-name "GstMixerTrack") - (gtype-id "GST_TYPE_MIXER_TRACK") - (fields - '("gchar*" "label") - '("GstMixerTrackFlags" "flags") - '("gint" "num_channels") - '("gint" "min_volume") - '("gint" "max_volume") - ) -) - -(define-object MixerOptions - (in-module "Gst") - (parent "GstMixerTrack") - (c-name "GstMixerOptions") - (gtype-id "GST_TYPE_MIXER_OPTIONS") -) - -(define-interface Navigation - (in-module "Gst") - (c-name "GstNavigation") - (gtype-id "GST_TYPE_NAVIGATION") - (vtable "GstNavigationInterface") -) - -(define-interface PropertyProbe - (in-module "Gst") - (c-name "GstPropertyProbe") - (gtype-id "GST_TYPE_PROPERTY_PROBE") - (vtable "GstPropertyProbeInterface") -) - -(define-interface Tuner - (in-module "Gst") - (c-name "GstTuner") - (gtype-id "GST_TYPE_TUNER") - (vtable "GstTunerClass") -) - -(define-object TunerChannel - (in-module "Gst") - (parent "GObject") - (c-name "GstTunerChannel") - (gtype-id "GST_TYPE_TUNER_CHANNEL") - (fields - '("gchar*" "label") - '("GstTunerChannelFlags" "flags") - '("gfloat" "freq_multiplicator") - '("gulong" "min_frequency") - '("gulong" "max_frequency") - '("gint" "min_signal") - '("gint" "max_signal")) -) - -(define-object TunerNorm - (in-module "Gst") - (parent "GObject") - (c-name "GstTunerNorm") - (gtype-id "GST_TYPE_TUNER_NORM") - (fields - '("gchar*" "label") - '("GValue*" "framerate")) -) - -;; Enumerations and flags ... - -(define-enum ColorBalanceType - (in-module "Gst") - (c-name "GstColorBalanceType") - (gtype-id "GST_TYPE_COLOR_BALANCE_TYPE") - (values - '("hardware" "GST_COLOR_BALANCE_HARDWARE") - '("software" "GST_COLOR_BALANCE_SOFTWARE") - ) -) - -(define-enum MixerType - (in-module "Gst") - (c-name "GstMixerType") - (gtype-id "GST_TYPE_MIXER_TYPE") - (values - '("hardware" "GST_MIXER_HARDWARE") - '("software" "GST_MIXER_SOFTWARE") - ) -) - -(define-enum MixerMessageType - (in-module "Gst") - (c-name "GstMixerMessageType") - (gtype-id "GST_TYPE_MIXER_MESSAGE_TYPE") - (values - '("invalid" "GST_MIXER_MESSAGE_INVALID") - '("mute-toggled" "GST_MIXER_MESSAGE_MUTE_TOGGLED") - '("record-toggled" "GST_MIXER_MESSAGE_RECORD_TOGGLED") - '("volume-changed" "GST_MIXER_MESSAGE_VOLUME_CHANGED") - '("option-changed" "GST_MIXER_MESSAGE_OPTION_CHANGED") - ) -) - -(define-flags MixerFlags - (in-module "Gst") - (c-name "GstMixerFlags") - (gtype-id "GST_TYPE_MIXER_FLAGS") - (values - '("none" "GST_MIXER_FLAG_NONE") - '("auto-notifications" "GST_MIXER_FLAG_AUTO_NOTIFICATIONS") - '("has-whitelist" "GST_MIXER_FLAG_HAS_WHITELIST") - '("grouping" "GST_MIXER_FLAG_GROUPING") - ) -) - -(define-flags MixerTrackFlags - (in-module "Gst") - (c-name "GstMixerTrackFlags") - (gtype-id "GST_TYPE_MIXER_TRACK_FLAGS") - (values - '("input" "GST_MIXER_TRACK_INPUT") - '("output" "GST_MIXER_TRACK_OUTPUT") - '("mute" "GST_MIXER_TRACK_MUTE") - '("record" "GST_MIXER_TRACK_RECORD") - '("master" "GST_MIXER_TRACK_MASTER") - '("software" "GST_MIXER_TRACK_SOFTWARE") - '("no-record" "GST_MIXER_TRACK_NO_RECORD") - '("no-mute" "GST_MIXER_TRACK_NO_MUTE") - '("whitelist" "GST_MIXER_TRACK_WHITELIST") - '("readonly" "GST_MIXER_TRACK_READONLY") - '("writeonly" "GST_MIXER_TRACK_WRITEONLY") - ) -) - -(define-enum NavigationCommand - (in-module "Gst") - (c-name "GstNavigationCommand") - (gtype-id "GST_TYPE_NAVIGATION_COMMAND") - (values - '("invalid" "GST_NAVIGATION_COMMAND_INVALID") - '("menu1" "GST_NAVIGATION_COMMAND_MENU1") - '("menu2" "GST_NAVIGATION_COMMAND_MENU2") - '("menu3" "GST_NAVIGATION_COMMAND_MENU3") - '("menu4" "GST_NAVIGATION_COMMAND_MENU4") - '("menu5" "GST_NAVIGATION_COMMAND_MENU5") - '("menu6" "GST_NAVIGATION_COMMAND_MENU6") - '("menu7" "GST_NAVIGATION_COMMAND_MENU7") - '("left" "GST_NAVIGATION_COMMAND_LEFT") - '("right" "GST_NAVIGATION_COMMAND_RIGHT") - '("up" "GST_NAVIGATION_COMMAND_UP") - '("down" "GST_NAVIGATION_COMMAND_DOWN") - '("activate" "GST_NAVIGATION_COMMAND_ACTIVATE") - '("prev-angle" "GST_NAVIGATION_COMMAND_PREV_ANGLE") - '("next-angle" "GST_NAVIGATION_COMMAND_NEXT_ANGLE") - ) -) - -(define-enum NavigationQueryType - (in-module "Gst") - (c-name "GstNavigationQueryType") - (gtype-id "GST_TYPE_NAVIGATION_QUERY_TYPE") - (values - '("invalid" "GST_NAVIGATION_QUERY_INVALID") - '("commands" "GST_NAVIGATION_QUERY_COMMANDS") - '("angles" "GST_NAVIGATION_QUERY_ANGLES") - ) -) - -(define-enum NavigationMessageType - (in-module "Gst") - (c-name "GstNavigationMessageType") - (gtype-id "GST_TYPE_NAVIGATION_MESSAGE_TYPE") - (values - '("invalid" "GST_NAVIGATION_MESSAGE_INVALID") - '("mouse-over" "GST_NAVIGATION_MESSAGE_MOUSE_OVER") - '("commands-changed" "GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED") - '("angles-changed" "GST_NAVIGATION_MESSAGE_ANGLES_CHANGED") - ) -) - -(define-enum NavigationEventType - (in-module "Gst") - (c-name "GstNavigationEventType") - (gtype-id "GST_TYPE_NAVIGATION_EVENT_TYPE") - (values - '("invalid" "GST_NAVIGATION_EVENT_INVALID") - '("key-press" "GST_NAVIGATION_EVENT_KEY_PRESS") - '("key-release" "GST_NAVIGATION_EVENT_KEY_RELEASE") - '("mouse-button-press" "GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS") - '("mouse-button-release" "GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE") - '("mouse-move" "GST_NAVIGATION_EVENT_MOUSE_MOVE") - '("command" "GST_NAVIGATION_EVENT_COMMAND") - ) -) - -(define-enum StreamVolumeFormat - (in-module "Gst") - (c-name "GstStreamVolumeFormat") - (gtype-id "GST_TYPE_STREAM_VOLUME_FORMAT") - (values - '("linear" "GST_STREAM_VOLUME_FORMAT_LINEAR") - '("cubic" "GST_STREAM_VOLUME_FORMAT_CUBIC") - '("db" "GST_STREAM_VOLUME_FORMAT_DB") - ) -) - -(define-flags TunerChannelFlags - (in-module "Gst") - (c-name "GstTunerChannelFlags") - (gtype-id "GST_TYPE_TUNER_CHANNEL_FLAGS") - (values - '("input" "GST_TUNER_CHANNEL_INPUT") - '("output" "GST_TUNER_CHANNEL_OUTPUT") - '("frequency" "GST_TUNER_CHANNEL_FREQUENCY") - '("audio" "GST_TUNER_CHANNEL_AUDIO") - ) -) - -;; From /opt/gnome/include/gstreamer-0.7/gst/colorbalance/colorbalance.h - -(define-function gst_color_balance_get_type - (c-name "gst_color_balance_get_type") - (return-type "GType") -) - -(define-method list_colorbalance_channels - (of-object "GstColorBalance") - (c-name "gst_color_balance_list_channels") - (return-type "const-GList*") -) - -(define-method set_value - (of-object "GstColorBalance") - (c-name "gst_color_balance_set_value") - (return-type "none") - (parameters - '("GstColorBalanceChannel*" "channel") - '("gint" "value") - ) -) - -(define-method get_value - (of-object "GstColorBalance") - (c-name "gst_color_balance_get_value") - (return-type "gint") - (parameters - '("GstColorBalanceChannel*" "channel") - ) -) - -(define-method value_changed - (of-object "GstColorBalance") - (c-name "gst_color_balance_value_changed") - (return-type "none") - (parameters - '("GstColorBalanceChannel*" "channel") - '("gint" "value") - ) -) - -(define-virtual list_channels - (of-object "GstColorBalance") - (return-type "const-GList*") -) - -(define-virtual set_value - (of-object "GstColorBalance") - (return-type "none") - (parameters - '("GstColorBalanceChannel*" "channel") - '("gint" "value") - ) -) - -(define-virtual get_value - (of-object "GstColorBalance") - (return-type "gint") - (parameters - '("GstColorBalanceChannel*" "channel") - ) -) - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/mixer/mixer.h - -(define-function gst_mixer_get_type - (c-name "gst_mixer_get_type") - (return-type "GType") -) - -(define-method list_tracks - (of-object "GstMixer") - (c-name "gst_mixer_list_tracks") - (return-type "const-GList*") -) - -(define-method set_volume - (of-object "GstMixer") - (c-name "gst_mixer_set_volume") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gint*" "volumes") - ) -) - -(define-method get_volume - (of-object "GstMixer") - (c-name "gst_mixer_get_volume") - (return-type "tuple") - (parameters - '("GstMixerTrack*" "track") - ) -) - -(define-method set_mute - (of-object "GstMixer") - (c-name "gst_mixer_set_mute") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "mute") - ) -) - -(define-method set_record - (of-object "GstMixer") - (c-name "gst_mixer_set_record") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "record") - ) -) - -(define-method set_option - (of-object "GstMixer") - (c-name "gst_mixer_set_option") - (return-type "none") - (parameters - '("GstMixerOptions*" "opts") - '("gchar*" "value") - ) -) - -(define-method get_option - (of-object "GstMixer") - (c-name "gst_mixer_get_option") - (return-type "const-gchar*") - (parameters - '("GstMixerOptions*" "opts") - ) -) - -(define-method mute_toggled - (of-object "GstMixer") - (c-name "gst_mixer_mute_toggled") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "mute") - ) -) - -(define-method record_toggled - (of-object "GstMixer") - (c-name "gst_mixer_record_toggled") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "record") - ) -) - -(define-method volume_changed - (of-object "GstMixer") - (c-name "gst_mixer_volume_changed") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gint*" "volumes") - ) -) - -(define-method option_changed - (of-object "GstMixer") - (c-name "gst_mixer_option_changed") - (return-type "none") - (parameters - '("GstMixerOptions*" "opts") - '("gchar*" "value") - ) -) - -(define-method get_mixer_flags - (of-object "GstMixer") - (c-name "gst_mixer_get_mixer_flags") - (return-type "GstMixerFlags") -) - -(define-function mixer_message_get_type - (c-name "gst_mixer_message_get_type") - (return-type "GstMixerMessageType") - (parameters - '("GstMessage*" "message") - ) -) - -(define-function mixer_message_parse_mute_toggled - (c-name "gst_mixer_message_parse_mute_toggled") - (return-type "none") - (parameters - '("GstMessage*" "message") - '("GstMixerTrack**" "track") - '("gboolean*" "mute") - ) -) - -(define-function mixer_message_parse_record_toggled - (c-name "gst_mixer_message_parse_record_toggled") - (return-type "none") - (parameters - '("GstMessage*" "message") - '("GstMixerTrack**" "track") - '("gboolean*" "record") - ) -) - -(define-function mixer_message_parse_volume_changed - (c-name "gst_mixer_message_parse_volume_changed") - (return-type "none") - (parameters - '("GstMessage*" "message") - '("GstMixerTrack**" "track") - '("gint**" "volumes") - '("gint*" "num_channels") - ) -) - -(define-function mixer_message_parse_option_changed - (c-name "gst_mixer_message_parse_option_changed") - (return-type "none") - (parameters - '("GstMessage*" "message") - '("GstMixerOptions**" "options") - '("const-gchar**" "value") - ) -) - -(define-function gst_mixer_message_parse_options_list_changed - (c-name "gst_mixer_message_parse_options_list_changed") - (return-type "none") - (parameters - '("GstMessage*" "message") - '("GstMixerOptions**" "options") - ) -) - -(define-virtual list_tracks - (of-object "GstMixer") - (return-type "const-GList*") -) - -(define-virtual set_volume - (of-object "GstMixer") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gint*" "volumes") - ) -) - -(define-virtual get_volume - (of-object "GstMixer") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gint*" "volumes") - ) -) - -(define-virtual set_mute - (of-object "GstMixer") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "mute") - ) -) - -(define-virtual set_record - (of-object "GstMixer") - (return-type "none") - (parameters - '("GstMixerTrack*" "track") - '("gboolean" "record") - ) -) - - -;; From ../gst-plugins-base/gst-libs/gst/interfaces/mixeroptions.h - -(define-function gst_mixer_options_get_type - (c-name "gst_mixer_options_get_type") - (return-type "GType") -) - -(define-method get_values - (of-object "GstMixerOptions") - (c-name "gst_mixer_options_get_values") - (return-type "GList*") -) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/navigation/navigation.h - -(define-function navigation_get_type - (c-name "gst_navigation_get_type") - (return-type "GType") -) - -(define-function navigation_query_get_type - (c-name "gst_navigation_query_get_type") - (return-type "GstNavigationQueryType") - (parameters - '("GstQuery*" "query") - ) -) - -(define-function navigation_query_new_commands - (c-name "gst_navigation_query_new_commands") - (caller-owns-return #t) - (return-type "GstQuery*") -) - -(define-function navigation_query_set_commands - (c-name "gst_navigation_query_set_commands") - (return-type "none") - (parameters - '("GstQuery*" "query") - '("gint" "n_cmds") - ) - (varargs #t) -) - -(define-function navigation_query_set_commandsv - (c-name "gst_navigation_query_set_commandsv") - (return-type "none") - (parameters - '("GstQuery*" "query") - '("gint" "n_cmds") - '("GstNavigationCommand*" "cmds") - ) -) - -(define-function navigation_query_parse_commands_length - (c-name "gst_navigation_query_parse_commands_length") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - '("guint*" "n_cmds") - ) -) - -(define-function navigation_query_parse_commands_nth - (c-name "gst_navigation_query_parse_commands_nth") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - '("guint" "nth") - '("GstNavigationCommand*" "cmd") - ) -) - -(define-function navigation_query_new_angles - (c-name "gst_navigation_query_new_angles") - (caller-owns-return #t) - (return-type "GstQuery*") -) - -(define-function navigation_query_set_angles - (c-name "gst_navigation_query_set_angles") - (return-type "none") - (parameters - '("GstQuery*" "query") - '("guint" "cur_angle") - '("guint" "n_angles") - ) -) - -(define-function navigation_query_parse_angles - (c-name "gst_navigation_query_parse_angles") - (return-type "gboolean") - (parameters - '("GstQuery*" "query") - '("guint*" "cur_angle") - '("guint*" "n_angles") - ) -) - -(define-function navigation_message_get_type - (c-name "gst_navigation_message_get_type") - (return-type "GstNavigationMessageType") - (parameters - '("GstMessage*" "message") - ) -) - -(define-function navigation_message_new_mouse_over - (c-name "gst_navigation_message_new_mouse_over") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("gboolean" "active") - ) -) - -(define-function navigation_message_parse_mouse_over - (c-name "gst_navigation_message_parse_mouse_over") - (return-type "gboolean") - (parameters - '("GstMessage*" "message") - '("gboolean*" "active") - ) -) - -(define-function navigation_message_new_commands_changed - (c-name "gst_navigation_message_new_commands_changed") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - ) -) - -(define-function navigation_message_new_angles_changed - (c-name "gst_navigation_message_new_angles_changed") - (return-type "GstMessage*") - (caller-owns-return #t) - (parameters - '("GstObject*" "src") - '("guint" "cur_angle") - '("guint" "n_angles") - ) -) - -(define-function navigation_message_parse_angles_changed - (c-name "gst_navigation_message_parse_angles_changed") - (return-type "gboolean") - (parameters - '("GstMessage*" "message") - '("guint*" "cur_angle") - '("guint*" "n_angles") - ) -) - -(define-function navigation_event_get_type - (c-name "gst_navigation_event_get_type") - (return-type "GstNavigationEventType") - (parameters - '("GstEvent*" "event") - ) -) - -(define-function navigation_event_parse_key_event - (c-name "gst_navigation_event_parse_key_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("const-gchar**" "key") - ) -) - -(define-function navigation_event_parse_mouse_button_event - (c-name "gst_navigation_event_parse_mouse_button_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("gint*" "button") - '("gdouble*" "x") - '("gdouble*" "y") - ) -) - -(define-function navigation_event_parse_mouse_move_event - (c-name "gst_navigation_event_parse_mouse_move_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("gdouble*" "x") - '("gdouble*" "y") - ) -) - -(define-function navigation_event_parse_command - (c-name "gst_navigation_event_parse_command") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("GstNavigationCommand*" "command") - ) -) - -(define-method send_event - (of-object "GstNavigation") - (c-name "gst_navigation_send_event") - (return-type "none") - (parameters - '("GstStructure*" "structure") - ) -) - -(define-method send_key_event - (of-object "GstNavigation") - (c-name "gst_navigation_send_key_event") - (return-type "none") - (parameters - '("const-char*" "event") - '("const-char*" "key") - ) -) - -(define-method send_mouse_event - (of-object "GstNavigation") - (c-name "gst_navigation_send_mouse_event") - (return-type "none") - (parameters - '("const-char*" "event") - '("int" "button") - '("double" "x") - '("double" "y") - ) -) - -(define-virtual send_event - (of-object "GstNavigation") - (return-type "none") - (parameters - '("GstStructure*" "structure") - ) -) - -(define-method send_command - (of-object "GstNavigation") - (c-name "gst_navigation_send_command") - (return-type "none") - (parameters - '("GstNavigationCommand" "command") - ) -) - -;; From /opt/gnome/include/gstreamer-0.7/gst/propertyprobe/propertyprobe.h - -(define-function gst_property_probe_get_type - (c-name "gst_property_probe_get_type") - (return-type "GType") -) - -(define-method probe_get_properties - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_get_properties") - (return-type "const-GList*") -) - -(define-method probe_get_property - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_get_property") - (return-type "const-GParamSpec*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method probe_property - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_probe_property") - (return-type "none") - (parameters - '("const-GParamSpec*" "pspec") - ) -) - -(define-method probe_property_name - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_probe_property_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method needs_probe - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_needs_probe") - (return-type "gboolean") - (parameters - '("const-GParamSpec*" "pspec") - ) -) - -(define-method needs_probe_name - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_needs_probe_name") - (return-type "gboolean") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_values - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_get_values") - (return-type "GValueArray*") - (parameters - '("const-GParamSpec*" "pspec") - ) -) - -(define-method probe_get_values_name - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_get_values_name") - (return-type "GValueArray*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method probe_and_get_values - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_probe_and_get_values") - (return-type "GValueArray*") - (parameters - '("const-GParamSpec*" "pspec") - ) -) - -(define-method probe_and_get_values_name - (of-object "GstPropertyProbe") - (c-name "gst_property_probe_probe_and_get_values_name") - (return-type "GValueArray*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-virtual get_properties - (of-object "GstPropertyProbe") - (return-type "const-GList*") -) - -(define-virtual needs_probe - (of-object "GstPropertyProbe") - (return-type "gboolean") - (parameters - '("guint" "prop_id") - '("const-GParamSpec*" "pspec") - ) -) - -(define-virtual probe_property - (of-object "GstPropertyProbe") - (return-type "none") - (parameters - '("guint" "prop_id") - '("const-GParamSpec*" "pspec") - ) -) - -(define-virtual get_values - (of-object "GstPropertyProbe") - (return-type "GValueArray*") - (parameters - '("guint" "prop_id") - '("const-GParamSpec*" "pspec") - ) -) - - -;; From streamvolume.h - -(define-method set_volume - (of-object "GstStreamVolume") - (c-name "gst_stream_volume_set_volume") - (return-type "none") - (parameters - '("GstStreamVolumeFormat" "format") - '("gdouble" "val") - ) -) - -(define-method get_volume - (of-object "GstStreamVolume") - (c-name "gst_stream_volume_get_volume") - (return-type "gdouble") - (parameters - '("GstStreamVolumeFormat" "format") - ) -) - -(define-method set_mute - (of-object "GstStreamVolume") - (c-name "gst_stream_volume_set_mute") - (return-type "none") - (parameters - '("gboolean" "mute") - ) -) - -(define-method get_mute - (of-object "GstStreamVolume") - (c-name "gst_stream_volume_get_mute") - (return-type "gboolean") -) - -(define-function stream_volume_convert_volume - (c-name "gst_stream_volume_convert_volume") - (return-type "gdouble") - (parameters - '("GstStreamVolumeFormat" "from") - '("GstStreamVolumeFormat" "to") - '("gdouble" "val") - ) -) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/tuner/tuner.h - -(define-function gst_tuner_get_type - (c-name "gst_tuner_get_type") - (return-type "GType") -) - -(define-method list_channels - (of-object "GstTuner") - (c-name "gst_tuner_list_channels") - (return-type "const-GList*") -) - -(define-method set_channel - (of-object "GstTuner") - (c-name "gst_tuner_set_channel") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-method get_channel - (of-object "GstTuner") - (c-name "gst_tuner_get_channel") - (return-type "GstTunerChannel*") -) - -(define-method list_norms - (of-object "GstTuner") - (c-name "gst_tuner_list_norms") - (return-type "const-GList*") -) - -(define-method set_norm - (of-object "GstTuner") - (c-name "gst_tuner_set_norm") - (return-type "none") - (parameters - '("GstTunerNorm*" "channel") - ) -) - -(define-method get_norm - (of-object "GstTuner") - (c-name "gst_tuner_get_norm") - (return-type "GstTunerNorm*") -) - -(define-method set_frequency - (of-object "GstTuner") - (c-name "gst_tuner_set_frequency") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - '("gulong" "frequency") - ) -) - -(define-method get_frequency - (of-object "GstTuner") - (c-name "gst_tuner_get_frequency") - (return-type "gulong") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-method signal_strength - (of-object "GstTuner") - (c-name "gst_tuner_signal_strength") - (return-type "gint") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-method find_norm_by_name - (of-object "GstTuner") - (c-name "gst_tuner_find_norm_by_name") - (return-type "GstTunerNorm*") - (parameters - '("gchar*" "norm") - ) -) - -(define-method find_channel_by_name - (of-object "GstTuner") - (c-name "gst_tuner_find_channel_by_name") - (return-type "GstTunerChannel*") - (parameters - '("gchar*" "channel") - ) -) - -(define-method channel_changed - (of-object "GstTuner") - (c-name "gst_tuner_channel_changed") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-method norm_changed - (of-object "GstTuner") - (c-name "gst_tuner_norm_changed") - (return-type "none") - (parameters - '("GstTunerNorm*" "norm") - ) -) - -(define-method frequency_changed - (of-object "GstTuner") - (c-name "gst_tuner_frequency_changed") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - '("gulong" "frequency") - ) -) - -(define-method signal_changed - (of-object "GstTuner") - (c-name "gst_tuner_signal_changed") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - '("gint" "signal") - ) -) - -(define-virtual list_channels - (of-object "GstTuner") - (return-type "const-GList*") -) - -(define-virtual set_channel - (of-object "GstTuner") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-virtual get_channel - (of-object "GstTuner") - (return-type "GstTunerChannel*") -) - -(define-virtual list_norms - (of-object "GstTuner") - (return-type "const-GList*") -) - -(define-virtual set_norm - (of-object "GstTuner") - (return-type "none") - (parameters - '("GstTunerNorm*" "channel") - ) -) - -(define-virtual get_norm - (of-object "GstTuner") - (return-type "GstTunerNorm*") -) - -(define-virtual set_frequency - (of-object "GstTuner") - (return-type "none") - (parameters - '("GstTunerChannel*" "channel") - '("gulong" "frequency") - ) -) - -(define-virtual get_frequency - (of-object "GstTuner") - (return-type "gulong") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -(define-virtual signal_strength - (of-object "GstTuner") - (return-type "gint") - (parameters - '("GstTunerChannel*" "channel") - ) -) - -;; -*- scheme -*- -; object definitions ... -;; Enumerations and flags ... - - -;; From videoorientation.h - -;; -;; interface definitions ... -;; - -(define-interface VideoOrientation - (in-module "Gst") - (c-name "GstVideoOrientation") - (gtype-id "GST_TYPE_VIDEO_ORIENTATION") - (vtable "GstVideoOrientationClass") -) - -(define-function gst_video_orientation_get_type - (c-name "gst_video_orientation_get_type") - (return-type "GType") -) - -(define-method get_hflip - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_get_hflip") - (return-type "gboolean") - (parameters - '("gboolean*" "flip") - ) -) - -(define-method get_vflip - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_get_vflip") - (return-type "gboolean") - (parameters - '("gboolean*" "flip") - ) -) - -(define-method get_hcenter - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_get_hcenter") - (return-type "gboolean") - (parameters - '("gint*" "center") - ) -) - -(define-method get_vcenter - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_get_vcenter") - (return-type "gboolean") - (parameters - '("gint*" "center") - ) -) - -(define-method set_hflip - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_set_hflip") - (return-type "gboolean") - (parameters - '("gboolean" "flip") - ) -) - -(define-method set_vflip - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_set_vflip") - (return-type "gboolean") - (parameters - '("gboolean" "flip") - ) -) - -(define-method set_hcenter - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_set_hcenter") - (return-type "gboolean") - (parameters - '("gint" "center") - ) -) - -(define-method set_vcenter - (of-object "GstVideoOrientation") - (c-name "gst_video_orientation_set_vcenter") - (return-type "gboolean") - (parameters - '("gint" "center") - ) -) - - diff --git a/gst/interfaces.override b/gst/interfaces.override deleted file mode 100644 index ad067389fe..0000000000 --- a/gst/interfaces.override +++ /dev/null @@ -1,486 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2004 David I. Lehn - * - * 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 - */ -%% -headers -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include "common.h" -#include "pygst.h" - -#include - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_STREAM_VOLUME_INTERFACE -#include -#endif - -%% -modulename gst.interfaces -%% -import gobject.GObject as PyGObject_Type -import gst.Object as PyGstObject_Type -import gst.Structure as PyGstStructure_Type -import gst.Element as PyGstElement_Type -import gst.Query as PyGstQuery_Type -%% -include - xoverlay.override - gstversion.override -%% -ignore-glob - _* - gstinterfaces_*init - *_get_type -%% -override gst_tuner_list_channels noargs -static PyObject * -_wrap_gst_tuner_list_channels(PyGObject *self) -{ - const GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_TUNER (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_tuner_list_channels(GST_TUNER(self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - GstTunerChannel *channel = (GstTunerChannel*)l->data; - PyObject *py_channel = pygobject_new(G_OBJECT(channel)); - PyList_Append(py_list, py_channel); - Py_DECREF(py_channel); - } - - return py_list; -} -%% -override gst_tuner_list_norms noargs -static PyObject * -_wrap_gst_tuner_list_norms(PyGObject *self) -{ - const GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_TUNER (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_tuner_list_norms(GST_TUNER(self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - GstTunerNorm *norm = (GstTunerNorm*)l->data; - PyObject *py_norm = pygobject_new(G_OBJECT(norm)); - PyList_Append(py_list, py_norm); - Py_DECREF(py_norm); - } - - return py_list; -} -%% -override gst_mixer_list_tracks noargs -static PyObject * -_wrap_gst_mixer_list_tracks(PyGObject *self) -{ - const GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_MIXER (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_mixer_list_tracks(GST_MIXER(self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - GstMixerTrack *track = (GstMixerTrack*)l->data; - PyObject *py_track = pygobject_new(G_OBJECT(track)); - PyList_Append(py_list, py_track); - Py_DECREF(py_track); - } - - return py_list; -} -%% -override gst_color_balance_list_channels noargs -static PyObject * -_wrap_gst_color_balance_list_channels(PyGObject *self) -{ - const GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_COLOR_BALANCE (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_color_balance_list_channels(GST_COLOR_BALANCE(self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - GstColorBalanceChannel *channel = (GstColorBalanceChannel*)l->data; - PyObject *py_channel = pygobject_new(G_OBJECT(channel)); - PyList_Append(py_list, py_channel); - Py_DECREF(py_channel); - } - - return py_list; -} -%% -override gst_mixer_options_get_values noargs -static PyObject * -_wrap_gst_mixer_options_get_values (PyGObject *self) -{ - GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_MIXER_OPTIONS (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_mixer_options_get_values (GST_MIXER_OPTIONS (self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - gchar *value = (gchar *) l->data; - PyObject *py_string = PyString_FromString(g_strdup(value)); - PyList_Append(py_list, py_string); - Py_DECREF (py_string); - } - - return py_list; -} - -%% -override gst_mixer_set_volume kwargs -static PyObject * -_wrap_gst_mixer_set_volume (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "track", "volumes", NULL }; - PyGObject *track; - PyObject *py_tuple; - gint *volumes = NULL; - gint channels; - int i; - PyObject *ret; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O:GstMixer.set_volume", - kwlist, &PyGstMixerTrack_Type, &track, &py_tuple)) - return NULL; - - g_object_get (GST_MIXER_TRACK (track->obj), "num-channels", &channels, - NULL); - - if (channels != PyTuple_Size (py_tuple)) { - PyErr_Format (PyExc_TypeError, - "Track channel count %d != volume tuple size %d", - channels, (gint) PyTuple_Size (py_tuple)); - return NULL; - } - - Py_INCREF(Py_None); - ret = Py_None; - - if (channels == 0) - return ret; - - volumes = g_malloc (channels * sizeof (gint)); - for (i = 0; i < channels; ++i) { - volumes[i] = PyInt_AsLong (PyTuple_GET_ITEM (py_tuple, i)); - } - - pyg_begin_allow_threads; - gst_mixer_set_volume (GST_MIXER (self->obj), GST_MIXER_TRACK (track->obj), - volumes); - pyg_end_allow_threads; - - g_free (volumes); - - return ret; -} - -%% -override gst_mixer_get_volume kwargs -static PyObject * -_wrap_gst_mixer_get_volume (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "track", NULL }; - PyGObject *track; - PyObject *py_tuple; - gint *volumes = NULL; - gint channels; - int i; - - if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!:GstMixer.get_volume", - kwlist, &PyGstMixerTrack_Type, &track)) - return NULL; - - g_object_get (GST_MIXER_TRACK (track->obj), "num-channels", &channels, - NULL); - - volumes = g_malloc (channels * sizeof (gint)); - /* 0 channels will cause volume to be a NULL pointer, but we still want - * our (empty) tuple */ - if (channels) { - pyg_begin_allow_threads; - gst_mixer_get_volume (GST_MIXER (self->obj), GST_MIXER_TRACK (track->obj), - volumes); - pyg_end_allow_threads; - } - - py_tuple = PyTuple_New (channels); - - for (i = 0; i < channels; ++i) { - PyTuple_SET_ITEM (py_tuple, i, PyInt_FromLong (volumes[i])); - } - g_free (volumes); - - return py_tuple; -} - -%% -override gst_property_probe_get_property args -static PyObject * -_wrap_gst_property_probe_get_property (PyGObject *self, PyObject *args) -{ - const char *name; - const GParamSpec *spec; - - if (!PyArg_ParseTuple(args, "s:ProbeProperty.get_property", &name)) - return NULL; - - pyg_begin_allow_threads; - spec = gst_property_probe_get_property (GST_PROPERTY_PROBE (self->obj), - name); - pyg_end_allow_threads; - - if (!spec) { - PyErr_Format(PyExc_ValueError, "unknown property: %s", name); - return NULL; - } - - return pyg_param_spec_new((GParamSpec*)spec); -} -%% -override gst_property_probe_get_properties noargs -static PyObject * -_wrap_gst_property_probe_get_properties (PyGObject *self) -{ - const GList *l, *list; - PyObject *py_list; - - g_return_val_if_fail (GST_IS_PROPERTY_PROBE (self->obj), PyList_New(0)); - - pyg_begin_allow_threads; - list = gst_property_probe_get_properties (GST_PROPERTY_PROBE (self->obj)); - pyg_end_allow_threads; - - py_list = PyList_New(0); - for (l = list; l; l = l->next) { - GParamSpec *spec = (GParamSpec*)l->data; - PyObject *py_gspec = pyg_param_spec_new((GParamSpec*)spec); - PyList_Append(py_list, py_gspec); - Py_DECREF(py_gspec); - } - - return py_list; -} -%% -override gst_property_probe_get_values_name args -static PyObject * -_wrap_gst_property_probe_get_values_name (PyGObject *self, PyObject *args) -{ - const char *name; - GValueArray *array; - PyObject *py_list; - int i; - - g_return_val_if_fail (GST_IS_PROPERTY_PROBE (self->obj), PyList_New(0)); - - if (!PyArg_ParseTuple(args, "s:ProbeProperty.get_values_name", &name)) - return NULL; - - pyg_begin_allow_threads; - array = gst_property_probe_get_values_name (GST_PROPERTY_PROBE (self->obj), - name); - pyg_end_allow_threads; - - py_list = PyList_New(0); - - if (array) { - for (i = 0; i < array->n_values; i++) { - GValue *value = g_value_array_get_nth(array, i); - PyObject *py_value = pyg_value_as_pyobject(value, TRUE); - PyList_Append(py_list, py_value); - Py_DECREF(py_value); - - } - g_value_array_free(array); - } - - return py_list; -} -%% -override gst_mixer_message_parse_mute_toggled noargs -static PyObject * -_wrap_gst_mixer_message_parse_mute_toggled (PyGstMiniObject * self) -{ - GstMixerTrack *track; - gboolean mute; - - if (GST_MESSAGE(self->obj)->type != GST_MIXER_MESSAGE_MUTE_TOGGLED) { - PyErr_SetString(PyExc_TypeError, "Message is not a mute-toggled message"); - return NULL; - } - gst_mixer_message_parse_mute_toggled (GST_MESSAGE(self->obj), &track, &mute); - - return Py_BuildValue("(OO)", - pygobject_new(G_OBJECT (track)), - PyBool_FromLong(mute)); -} -%% -override gst_mixer_message_parse_record_toggled noargs -static PyObject * -_wrap_gst_mixer_message_parse_record_toggled (PyGstMiniObject * self) -{ - GstMixerTrack *track; - gboolean record; - - if (GST_MESSAGE(self->obj)->type != GST_MIXER_MESSAGE_RECORD_TOGGLED) { - PyErr_SetString(PyExc_TypeError, "Message is not a record-toggled message"); - return NULL; - } - gst_mixer_message_parse_record_toggled (GST_MESSAGE(self->obj), &track, &record); - - return Py_BuildValue("(OO)", - pygobject_new(G_OBJECT (track)), - PyBool_FromLong(record)); -} -%% -override gst_mixer_message_parse_volume_changed noargs -static PyObject * -_wrap_gst_mixer_message_parse_volume_changed (PyGstMiniObject * self) -{ - GstMixerTrack *track; - gint *volumes; - gint num_channels; - PyObject *pvolumes; - int i; - - if (GST_MESSAGE(self->obj)->type != GST_MIXER_MESSAGE_VOLUME_CHANGED) { - PyErr_SetString(PyExc_TypeError, "Message is not a volume-changed message"); - return NULL; - } - gst_mixer_message_parse_volume_changed (GST_MESSAGE(self->obj), &track, &volumes, &num_channels); - - pvolumes = PyList_New (num_channels); - - for (i = 0; i < num_channels; ++i) { - PyList_SET_ITEM (pvolumes, i, PyInt_FromLong (volumes[i])); - } - g_free (volumes); - - return Py_BuildValue("(OOi)", - pygobject_new(G_OBJECT (track)), - pvolumes, num_channels); -} -%% -override gst_mixer_message_parse_option_changed noargs -static PyObject * -_wrap_gst_mixer_message_parse_option_changed (PyGstMiniObject * self) -{ - GstMixerOptions *options; - const gchar *value = NULL; - - if (GST_MESSAGE(self->obj)->type != GST_MIXER_MESSAGE_OPTION_CHANGED) { - PyErr_SetString(PyExc_TypeError, "Message is not a option-changed message"); - return NULL; - } - gst_mixer_message_parse_option_changed (GST_MESSAGE(self->obj), &options, &value); - - return Py_BuildValue("(Os)", - pygobject_new(G_OBJECT (options)), - value); -} -%% -override gst_video_orientation_get_hflip noargs -static PyObject * -_wrap_gst_video_orientation_get_hflip (PyGObject * self) -{ - gboolean flip, res; - - res = gst_video_orientation_get_hflip (GST_VIDEO_ORIENTATION (self->obj), &flip); - - return Py_BuildValue("(OO)", - PyBool_FromLong(res), - PyBool_FromLong(flip)); -} -%% -override gst_video_orientation_get_vflip noargs -static PyObject * -_wrap_gst_video_orientation_get_vflip (PyGObject * self) -{ - gboolean flip, res; - - res = gst_video_orientation_get_vflip (GST_VIDEO_ORIENTATION (self->obj), &flip); - - return Py_BuildValue("(OO)", - PyBool_FromLong(res), - PyBool_FromLong(flip)); -} -%% -override gst_video_orientation_get_hcenter noargs -static PyObject * -_wrap_gst_video_orientation_get_hcenter (PyGObject * self) -{ - gboolean res; - gint center; - - res = gst_video_orientation_get_hcenter (GST_VIDEO_ORIENTATION (self->obj), ¢er); - - return Py_BuildValue("(Oi)", - PyBool_FromLong(res), - center); -} -%% -override gst_video_orientation_get_vcenter noargs -static PyObject * -_wrap_gst_video_orientation_get_vcenter (PyGObject * self) -{ - gboolean res; - gint center; - - res = gst_video_orientation_get_vcenter (GST_VIDEO_ORIENTATION (self->obj), ¢er); - - return Py_BuildValue("(Oi)", - PyBool_FromLong(res), - center); -} diff --git a/gst/interfacesmodule.c b/gst/interfacesmodule.c deleted file mode 100644 index b297db4a9d..0000000000 --- a/gst/interfacesmodule.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2004 David I. Lehn - * - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include "pygst.h" - -void pyinterfaces_register_classes (PyObject * d); -void pyinterfaces_add_constants (PyObject * module, const gchar * strip_prefix); - -extern PyMethodDef pyinterfaces_functions[]; - -DL_EXPORT (void) -initinterfaces (void) -{ - PyObject *m, *d; - - init_pygobject (); - pygst_init (); - - m = Py_InitModule ("interfaces", pyinterfaces_functions); - d = PyModule_GetDict (m); - - pyinterfaces_register_classes (d); - pyinterfaces_add_constants (m, "GST_"); - - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.interfaces"); - } -} diff --git a/gst/libs.defs b/gst/libs.defs deleted file mode 100644 index 17436c9ff4..0000000000 --- a/gst/libs.defs +++ /dev/null @@ -1,684 +0,0 @@ -;; -*- scheme -*- -; object definitions ... - -(define-object ControlSource - (in-module "Gst") - (parent "GObject") - (c-name "GstControlSource") - (gtype-id "GST_TYPE_CONTROL_SOURCE") -) - -(define-object Controller - (in-module "Gst") - (parent "GObject") - (c-name "GstController") - (gtype-id "GST_TYPE_CONTROLLER") -) - -(define-object InterpolationControlSource - (in-module "Gst") - (parent "GstControlSource") - (c-name "GstInterpolationControlSource") - (gtype-id "GST_TYPE_INTERPOLATION_CONTROL_SOURCE") -) - -(define-object LFOControlSource - (in-module "Gst") - (parent "GstControlSource") - (c-name "GstLFOControlSource") - (gtype-id "GST_TYPE_LFO_CONTROL_SOURCE") -) - - -;; Enumerations and flags ... - -(define-enum InterpolateMode - (in-module "Gst") - (c-name "GstInterpolateMode") - (values - '("none" "GST_INTERPOLATE_NONE") - '("trigger" "GST_INTERPOLATE_TRIGGER") - '("linear" "GST_INTERPOLATE_LINEAR") - '("quadratic" "GST_INTERPOLATE_QUADRATIC") - '("cubic" "GST_INTERPOLATE_CUBIC") - '("user" "GST_INTERPOLATE_USER") - ) -) - -(define-enum LFOWaveform - (in-module "Gst") - (c-name "GstLFOWaveform") - (gtype-id "GST_TYPE_LFO_WAVEFORM") - (values - '("sine" "GST_LFO_WAVEFORM_SINE") - '("square" "GST_LFO_WAVEFORM_SQUARE") - '("saw" "GST_LFO_WAVEFORM_SAW") - '("reverse-saw" "GST_LFO_WAVEFORM_REVERSE_SAW") - '("triangle" "GST_LFO_WAVEFORM_TRIANGLE") - ) -) - -(define-enum DPVersion - (in-module "Gst") - (c-name "GstDPVersion") - (gtype-id "GST_TYPE_DP_VERSION") - (values - '("0-2" "GST_DP_VERSION_0_2") - '("1-0" "GST_DP_VERSION_1_0") - ) -) - -(define-flags DPHeaderFlag - (in-module "Gst") - (c-name "GstDPHeaderFlag") - (values - '("none" "GST_DP_HEADER_FLAG_NONE") - '("crc-header" "GST_DP_HEADER_FLAG_CRC_HEADER") - '("crc-payload" "GST_DP_HEADER_FLAG_CRC_PAYLOAD") - '("crc" "GST_DP_HEADER_FLAG_CRC") - ) -) - -(define-enum DPPayloadType - (in-module "Gst") - (c-name "GstDPPayloadType") - (values - '("none" "GST_DP_PAYLOAD_NONE") - '("buffer" "GST_DP_PAYLOAD_BUFFER") - '("caps" "GST_DP_PAYLOAD_CAPS") - '("event-none" "GST_DP_PAYLOAD_EVENT_NONE") - ) -) - -;; From ../gstreamer/libs/gst/controller/gst-controller.h - -(define-function gst_controller_get_type - (c-name "gst_controller_get_type") - (return-type "GType") -) - -(define-function gst_controller_new_valist - (c-name "gst_controller_new_valist") - (return-type "GstController*") - (parameters - '("GObject*" "object") - '("va_list" "var_args") - ) -) - -(define-function gst_controller_new_list - (c-name "gst_controller_new_list") - (is-constructor-of "GstController") - (return-type "GstController*") - (parameters - '("GObject*" "object") - '("GList*" "list") - ) -) - -(define-function gst_controller_new - (c-name "gst_controller_new") - (return-type "GstController*") - (parameters - '("GObject*" "object") - ) - (varargs #t) -) - -(define-method remove_properties_valist - (of-object "GstController") - (c-name "gst_controller_remove_properties_valist") - (return-type "gboolean") - (parameters - '("va_list" "var_args") - ) -) - -(define-method remove_properties - (of-object "GstController") - (c-name "gst_controller_remove_properties") - (return-type "gboolean") - (parameters - ) - (varargs #t) -) - -(define-method remove_properties_list - (of-object "GstController") - (c-name "gst_controller_remove_properties_list") - (return-type "gboolean") - (parameters - '("GList*" "list") - ) -) - -(define-method set_disabled - (of-object "GstController") - (c-name "gst_controller_set_disabled") - (return-type "none") - (parameters - '("gboolean" "disabled") - ) -) - -(define-method set_property_disabled - (of-object "GstController") - (c-name "gst_controller_set_property_disabled") - (return-type "none") - (parameters - '("gchar*" "property_name") - '("gboolean" "disabled") - ) -) - -(define-method set_control_source - (of-object "GstController") - (c-name "gst_controller_set_control_source") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - '("GstControlSource*" "csource") - ) -) - -(define-method get_control_source - (of-object "GstController") - (c-name "gst_controller_get_control_source") - (return-type "GstControlSource*") - (parameters - '("gchar*" "property_name") - ) -) -(define-method set - (of-object "GstController") - (c-name "gst_controller_set") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - '("GstClockTime" "timestamp") - '("GValue*" "value") - ) -) - -(define-method set_from_list - (of-object "GstController") - (c-name "gst_controller_set_from_list") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - '("GSList*" "timedvalues") - ) -) - -(define-method unset - (of-object "GstController") - (c-name "gst_controller_unset") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - '("GstClockTime" "timestamp") - ) -) - -(define-method unset_all - (of-object "GstController") - (c-name "gst_controller_unset_all") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - ) -) - -(define-method get - (of-object "GstController") - (c-name "gst_controller_get") - (return-type "GValue*") - (parameters - '("gchar*" "property_name") - '("GstClockTime" "timestamp") - ) -) - -(define-method get_all - (of-object "GstController") - (c-name "gst_controller_get_all") - (return-type "const-GList*") - (parameters - '("gchar*" "property_name") - ) -) - -(define-method suggest_next_sync - (of-object "GstController") - (c-name "gst_controller_suggest_next_sync") - (return-type "GstClockTime") -) - -(define-method sync_values - (of-object "GstController") - (c-name "gst_controller_sync_values") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - ) -) - -(define-method get_value_arrays - (of-object "GstController") - (c-name "gst_controller_get_value_arrays") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - '("GSList*" "value_arrays") - ) -) - -(define-method get_value_array - (of-object "GstController") - (c-name "gst_controller_get_value_array") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - '("GstValueArray*" "value_array") - ) -) - -(define-method set_interpolation_mode - (of-object "GstController") - (c-name "gst_controller_set_interpolation_mode") - (return-type "gboolean") - (parameters - '("gchar*" "property_name") - '("GstInterpolateMode" "mode") - ) -) - -(define-function object_control_properties - (c-name "gst_object_control_properties") - (return-type "GstController*") - (parameters - '("GObject*" "object")) - (varargs #t) -) - -(define-function object_uncontrol_properties - (c-name "gst_object_uncontrol_properties") - (return-type "gboolean") - (parameters - '("GObject*" "object") - ) - (varargs #t) -) - -(define-function object_get_controller - (c-name "gst_object_get_controller") - (return-type "GstController*") - (parameters - '("GObject*" "object") - ) -) - -(define-function object_set_controller - (c-name "gst_object_set_controller") - (return-type "gboolean") - (parameters - '("GObject*" "object") - '("GstController*" "controller") - ) -) - -(define-function object_suggest_next_sync - (c-name "gst_object_suggest_next_sync") - (return-type "GstClockTime") - (parameters - '("GObject*" "object") - ) -) - -(define-function object_sync_values - (c-name "gst_object_sync_values") - (return-type "gboolean") - (parameters - '("GObject*" "object") - '("GstClockTime" "timestamp") - ) -) - -(define-function gst_object_set_control_source - (c-name "gst_object_set_control_source") - (return-type "gboolean") - (parameters - '("GObject*" "object") - '("gchar*" "property_name") - '("GstControlSource*" "csource") - ) -) - -(define-function gst_object_get_control_source - (c-name "gst_object_get_control_source") - (return-type "GstControlSource*") - (parameters - '("GObject*" "object") - '("gchar*" "property_name") - ) -) - -(define-function object_get_value_arrays - (c-name "gst_object_get_value_arrays") - (return-type "gboolean") - (parameters - '("GObject*" "object") - '("GstClockTime" "timestamp") - '("GSList*" "value_arrays") - ) -) - -(define-function object_get_value_array - (c-name "gst_object_get_value_array") - (return-type "gboolean") - (parameters - '("GObject*" "object") - '("GstClockTime" "timestamp") - '("GstValueArray*" "value_array") - ) -) - -(define-function object_get_control_rate - (c-name "gst_object_get_control_rate") - (return-type "GstClockTime") - (parameters - '("GObject*" "object") - ) -) - -(define-function object_set_control_rate - (c-name "gst_object_set_control_rate") - (return-type "none") - (parameters - '("GObject*" "object") - '("GstClockTime" "control_rate") - ) -) - -(define-function gst_controller_init - (c-name "gst_controller_init") - (return-type "gboolean") - (parameters - '("int*" "argc") - '("char***" "argv") - ) -) - - - -;; From gstcontrolsource.h - -(define-function gst_control_source_get_type - (c-name "gst_control_source_get_type") - (return-type "GType") - (parameters - ) -) - -(define-method get_value - (of-object "GstControlSource") - (c-name "gst_control_source_get_value") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - '("GValue*" "value") - ) -) - -(define-method get_value_array - (of-object "GstControlSource") - (c-name "gst_control_source_get_value_array") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - '("GstValueArray*" "value_array") - ) -) - -(define-method bind - (of-object "GstControlSource") - (c-name "gst_control_source_bind") - (return-type "gboolean") - (parameters - '("GParamSpec*" "pspec") - ) -) - - - -;; From gstinterpolationcontrolsource.h - -(define-function gst_interpolation_control_source_get_type - (c-name "gst_interpolation_control_source_get_type") - (return-type "GType") - (parameters - ) -) - -(define-function gst_interpolation_control_source_new - (c-name "gst_interpolation_control_source_new") - (is-constructor-of "GstInterpolationControlSource") - (return-type "GstInterpolationControlSource*") - (parameters - ) -) - -(define-method set_interpolation_mode - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_set_interpolation_mode") - (return-type "gboolean") - (parameters - '("GstInterpolateMode" "mode") - ) -) - -(define-method set - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_set") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - '("GValue*" "value") - ) -) - -(define-method set_from_list - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_set_from_list") - (return-type "gboolean") - (parameters - '("GSList*" "timedvalues") - ) -) - -(define-method unset - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_unset") - (return-type "gboolean") - (parameters - '("GstClockTime" "timestamp") - ) -) - -(define-method unset_all - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_unset_all") - (return-type "none") -) - -(define-method get_all - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_get_all") - (return-type "GList*") -) - -(define-method get_count - (of-object "GstInterpolationControlSource") - (c-name "gst_interpolation_control_source_get_count") - (return-type "gint") -) - - - -;; From gstlfocontrolsource.h - -(define-function gst_lfo_control_source_get_type - (c-name "gst_lfo_control_source_get_type") - (return-type "GType") - (parameters - ) -) - -(define-function gst_lfo_waveform_get_type - (c-name "gst_lfo_waveform_get_type") - (return-type "GType") - (parameters - ) -) - -(define-function gst_lfo_control_source_new - (c-name "gst_lfo_control_source_new") - (is-constructor-of "GstLfoControlSource") - (return-type "GstLFOControlSource*") - (parameters - ) -) - -;; From ../gstreamer/libs/gst/dataprotocol/dataprotocol.h - -(define-function dp_init - (c-name "gst_dp_init") - (return-type "none") -) - -(define-function dp_packetizer_new - (c-name "gst_dp_packetizer_new") - (is-constructor-of "GstDpPacketizer") - (return-type "GstDPPacketizer*") - (parameters - '("GstDPVersion" "version") - ) -) - -(define-function gst_dp_crc - (c-name "gst_dp_crc") - (return-type "guint16") - (parameters - '("const-guint8*" "buffer") - '("guint" "length") - ) -) - -(define-function dp_header_payload_length - (c-name "gst_dp_header_payload_length") - (return-type "guint32") - (parameters - '("const-gchar*" "header") - ) -) - -(define-function dp_header_payload_type - (c-name "gst_dp_header_payload_type") - (return-type "GstDPPayloadType") - (parameters - '("const-gchar*" "header") - ) -) - -(define-function dp_header_from_buffer - (c-name "gst_dp_header_from_buffer") - (return-type "gboolean") - (parameters - '("const-GstBuffer*" "buffer") - '("GstDPHeaderFlag" "flags") - '("guint*" "length") - '("guint8**" "header") - ) -) - -(define-function dp_packet_from_caps - (c-name "gst_dp_packet_from_caps") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps") - '("GstDPHeaderFlag" "flags") - '("guint*" "length") - '("guint8**" "header") - '("guint8**" "payload") - ) -) - -(define-function dp_packet_from_event - (c-name "gst_dp_packet_from_event") - (return-type "gboolean") - (parameters - '("const-GstEvent*" "event") - '("GstDPHeaderFlag" "flags") - '("guint*" "length") - '("guint8**" "header") - '("guint8**" "payload") - ) -) - -(define-function dp_buffer_from_header - (c-name "gst_dp_buffer_from_header") - (return-type "GstBuffer*") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - ) -) - -(define-function dp_caps_from_packet - (c-name "gst_dp_caps_from_packet") - (return-type "GstCaps*") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - '("const-guint8*" "payload") - ) -) - -(define-function dp_event_from_packet - (c-name "gst_dp_event_from_packet") - (return-type "GstEvent*") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - '("const-guint8*" "payload") - ) -) - -(define-function dp_validate_header - (c-name "gst_dp_validate_header") - (return-type "gboolean") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - ) -) - -(define-function dp_validate_payload - (c-name "gst_dp_validate_payload") - (return-type "gboolean") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - '("const-guint8*" "payload") - ) -) - -(define-function dp_validate_packet - (c-name "gst_dp_validate_packet") - (return-type "gboolean") - (parameters - '("guint" "header_length") - '("const-guint8*" "header") - '("const-guint8*" "payload") - ) -) diff --git a/gst/pbutils.defs b/gst/pbutils.defs deleted file mode 100644 index 4f25dbd020..0000000000 --- a/gst/pbutils.defs +++ /dev/null @@ -1,1056 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -;; Enumerations and flags ... - -(define-boxed InstallPluginsContext - (in-module "Gst") - (c-name "GstInstallPluginsContext") - (gtype-id "GST_TYPE_INSTALL_PLUGINS_CONTEXT") -) - -(define-enum InstallPluginsReturn - (in-module "Gst") - (c-name "GstInstallPluginsReturn") - (gtype-id "GST_TYPE_INSTALL_PLUGINS_RETURN") - (values - '("success" "GST_INSTALL_PLUGINS_SUCCESS") - '("not-found" "GST_INSTALL_PLUGINS_NOT_FOUND") - '("error" "GST_INSTALL_PLUGINS_ERROR") - '("partial-success" "GST_INSTALL_PLUGINS_PARTIAL_SUCCESS") - '("user-abort" "GST_INSTALL_PLUGINS_USER_ABORT") - '("crashed" "GST_INSTALL_PLUGINS_CRASHED") - '("invalid" "GST_INSTALL_PLUGINS_INVALID") - '("started-ok" "GST_INSTALL_PLUGINS_STARTED_OK") - '("internal-failure" "GST_INSTALL_PLUGINS_INTERNAL_FAILURE") - '("helper-missing" "GST_INSTALL_PLUGINS_HELPER_MISSING") - '("install-in-progress" "GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS") - ) -) - -(define-object Discoverer - (in-module "Gst") - (parent "GObject") - (c-name "GstDiscoverer") - (gtype-id "GST_TYPE_DISCOVERER") -) - -(define-enum DiscovererResult - (in-module "Gst") - (c-name "GstDiscovererResult") - (gtype-id "GST_TYPE_DISCOVERER_RESULT") - (values - '("ok" "GST_DISCOVERER_OK") - '("uri-invalid" "GST_DISCOVERER_URI_INVALID") - '("error" "GST_DISCOVERER_ERROR") - '("timeout" "GST_DISCOVERER_TIMEOUT") - '("busy" "GST_DISCOVERER_BUSY") - '("missing-plugins" "GST_DISCOVERER_MISSING_PLUGINS") - ) -) - -(define-miniobject DiscovererInfo - (in-module "Gst") - (c-name "GstDiscovererInfo") - (parent "GstMiniObject") - (gtype-id "GST_TYPE_DISCOVERER_INFO") -) - -(define-miniobject DiscovererStreamInfo - (in-module "Gst") - (c-name "GstDiscovererStreamInfo") - (parent "GstMiniObject") - (gtype-id "GST_TYPE_DISCOVERER_STREAM_INFO") -) - -(define-miniobject DiscovererContainerInfo - (in-module "Gst") - (c-name "GstDiscovererContainerInfo") - (parent "GstDiscovererStreamInfo") - (gtype-id "GST_TYPE_DISCOVERER_CONTAINER_INFO") -) - -(define-miniobject DiscovererAudioInfo - (in-module "Gst") - (c-name "GstDiscovererAudioInfo") - (parent "GstDiscovererStreamInfo") - (gtype-id "GST_TYPE_DISCOVERER_AUDIO_INFO") -) - -(define-miniobject DiscovererVideoInfo - (in-module "Gst") - (c-name "GstDiscovererVideoInfo") - (parent "GstDiscovererStreamInfo") - (gtype-id "GST_TYPE_DISCOVERER_VIDEO_INFO") -) - -(define-miniobject EncodingProfile - (in-module "Gst") - (c-name "GstEncodingProfile") - (parent "GstMiniObject") - (gtype-id "GST_TYPE_ENCODING_PROFILE") -) - -(define-miniobject EncodingContainerProfile - (in-module "Gst") - (c-name "GstEncodingContainerProfile") - (parent "GstEncodingProfile") - (gtype-id "GST_TYPE_ENCODING_CONTAINER_PROFILE") -) - -(define-miniobject EncodingVideoProfile - (in-module "Gst") - (c-name "GstEncodingVideoProfile") - (parent "GstEncodingProfile") - (gtype-id "GST_TYPE_ENCODING_VIDEO_PROFILE") -) - -(define-miniobject EncodingAudioProfile - (in-module "Gst") - (c-name "GstEncodingAudioProfile") - (parent "GstEncodingProfile") - (gtype-id "GST_TYPE_ENCODING_AUDIO_PROFILE") -) - -(define-miniobject EncodingTarget - (in-module "Gst") - (c-name "GstEncodingTarget") - (parent "GstMiniObject") - (gtype-id "GST_TYPE_ENCODING_TARGET") -) - -;; From codec-utils.h - -(define-function codec_utils_aac_get_sample_rate_from_index - (c-name "gst_codec_utils_aac_get_sample_rate_from_index") - (return-type "guint") - (parameters - '("guint" "sr_idx") - ) -) - -(define-function codec_utils_aac_get_profile - (c-name "gst_codec_utils_aac_get_profile") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "audio_config") - '("guint" "len") - ) -) - -(define-function codec_utils_aac_get_level - (c-name "gst_codec_utils_aac_get_level") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "audio_config") - '("guint" "len") - ) -) - -(define-method codec_utils_aac_caps_set_level_and_profile - (of-object "GstCaps") - (c-name "gst_codec_utils_aac_caps_set_level_and_profile") - (return-type "gboolean") - (parameters - '("const-guint8*" "audio_config") - '("guint" "len") - ) -) - -(define-function codec_utils_h264_get_profile - (c-name "gst_codec_utils_h264_get_profile") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "sps") - '("guint" "len") - ) -) - -(define-function codec_utils_h264_get_level - (c-name "gst_codec_utils_h264_get_level") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "sps") - '("guint" "len") - ) -) - -(define-method codec_utils_h264_caps_set_level_and_profile - (of-object "GstCaps") - (c-name "gst_codec_utils_h264_caps_set_level_and_profile") - (return-type "gboolean") - (parameters - '("const-guint8*" "sps") - '("guint" "len") - ) -) - -(define-function codec_utils_mpeg4video_get_profile - (c-name "gst_codec_utils_mpeg4video_get_profile") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "vis_obj_seq") - '("guint" "len") - ) -) - -(define-function codec_utils_mpeg4video_get_level - (c-name "gst_codec_utils_mpeg4video_get_level") - (return-type "const-gchar*") - (parameters - '("const-guint8*" "vis_obj_seq") - '("guint" "len") - ) -) - -(define-method codec_utils_mpeg4video_caps_set_level_and_profile - (of-object "GstCaps") - (c-name "gst_codec_utils_mpeg4video_caps_set_level_and_profile") - (return-type "gboolean") - (parameters - '("const-guint8*" "vis_obj_seq") - '("guint" "len") - ) -) - - -;; From descriptions.h - -(define-function add_codec_description_to_tag_list - (c-name "gst_pb_utils_add_codec_description_to_tag_list") - (return-type "gboolean") - (parameters - '("GstTagList*" "taglist") - '("const-gchar*" "codec_tag") - '("const-GstCaps*" "caps") - ) -) - -(define-function get_codec_description - (c-name "gst_pb_utils_get_codec_description") - (return-type "gchar*") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-function get_source_description - (c-name "gst_pb_utils_get_source_description") - (return-type "gchar*") - (parameters - '("const-gchar*" "protocol") - ) -) - -(define-function get_sink_description - (c-name "gst_pb_utils_get_sink_description") - (return-type "gchar*") - (parameters - '("const-gchar*" "protocol") - ) -) - -(define-function get_decoder_description - (c-name "gst_pb_utils_get_decoder_description") - (return-type "gchar*") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-function get_encoder_description - (c-name "gst_pb_utils_get_encoder_description") - (return-type "gchar*") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-function get_element_description - (c-name "gst_pb_utils_get_element_description") - (return-type "gchar*") - (parameters - '("const-gchar*" "factory_name") - ) -) - - - -;; From install-plugins.h - -(define-function install_plugins_context_new - (c-name "gst_install_plugins_context_new") - (is-constructor-of "GstInstallPluginsContext") - (return-type "GstInstallPluginsContext*") -) - -(define-method free - (of-object "GstInstallPluginsContext") - (c-name "gst_install_plugins_context_free") - (return-type "none") -) - -(define-method set_xid - (of-object "GstInstallPluginsContext") - (c-name "gst_install_plugins_context_set_xid") - (return-type "none") - (parameters - '("guint" "xid") - ) -) - -(define-function install_plugins_async - (c-name "gst_install_plugins_async") - (return-type "GstInstallPluginsReturn") - (parameters - '("gchar**" "details") - '("GstInstallPluginsContext*" "ctx") - '("GstInstallPluginsResultFunc" "func") - '("gpointer" "user_data") - ) -) - -(define-function install_plugins_sync - (c-name "gst_install_plugins_sync") - (return-type "GstInstallPluginsReturn") - (parameters - '("gchar**" "details") - '("GstInstallPluginsContext*" "ctx") - ) -) - -(define-method get_name - (of-object "GstInstallPluginsReturn") - (c-name "gst_install_plugins_return_get_name") - (return-type "const-gchar*") -) - -(define-function install_plugins_installation_in_progress - (c-name "gst_install_plugins_installation_in_progress") - (return-type "gboolean") -) - -(define-function install_plugins_supported - (c-name "gst_install_plugins_supported") - (return-type "gboolean") -) - - -;; From encoding-profile.h - -(define-method get_name - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_name") - (return-type "const-gchar*") -) - -(define-method get_description - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_description") - (return-type "const-gchar*") -) - -(define-method get_format - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_format") - (return-type "const-GstCaps*") -) - -(define-method get_preset - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_preset") - (return-type "const-gchar*") -) - -(define-method get_presence - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_presence") - (return-type "guint") -) - -(define-method get_restriction - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_restriction") - (return-type "const-GstCaps*") -) - -(define-method set_name - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_name") - (return-type "none") - (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) - ) -) - -(define-method set_description - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_description") - (return-type "none") - (parameters - '("const-gchar*" "description" (null-ok) (default "NULL")) - ) -) - -(define-method set_format - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_format") - (return-type "none") - (parameters - '("GstCaps*" "format") - ) -) - -(define-method set_preset - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_preset") - (return-type "none") - (parameters - '("const-gchar*" "preset" (null-ok) (default "NULL")) - ) -) - -(define-method set_restriction - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_restriction") - (return-type "none") - (parameters - '("GstCaps*" "restriction" (null-ok) (default "NULL")) - ) -) - -(define-method set_presence - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_set_presence") - (return-type "none") - (parameters - '("guint" "presence") - ) -) - -(define-method is_equal - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_is_equal") - (return-type "gboolean") - (parameters - '("GstEncodingProfile*" "b") - ) -) - -(define-method get_input_caps - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_input_caps") - (return-type "GstCaps*") -) - -(define-method get_type_nick - (of-object "GstEncodingProfile") - (c-name "gst_encoding_profile_get_type_nick") - (return-type "const-gchar*") -) - -(define-function encoding_profile_find - (c-name "gst_encoding_profile_find") - (return-type "GstEncodingProfile*") - (parameters - '("const-gchar*" "targetname") - '("const-gchar*" "profilename") - '("const-gchar*" "category" (null-ok) (default "NULL")) - ) -) - -(define-method add_profile - (of-object "GstEncodingContainerProfile") - (c-name "gst_encoding_container_profile_add_profile") - (return-type "gboolean") - (parameters - '("GstEncodingProfile*" "profile" (keep-refcount)) - ) -) - -(define-method contains_profile - (of-object "GstEncodingContainerProfile") - (c-name "gst_encoding_container_profile_contains_profile") - (return-type "gboolean") - (parameters - '("GstEncodingProfile*" "profile") - ) -) - -(define-method get_profiles - (of-object "GstEncodingContainerProfile") - (c-name "gst_encoding_container_profile_get_profiles") - (return-type "const-GList*") -) - -(define-function gst_encoding_container_profile_new - (c-name "gst_encoding_container_profile_new") - (is-constructor-of "GstEncodingContainerProfile") - (return-type "GstEncodingContainerProfile*") - (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) - '("const-gchar*" "description" (null-ok) (default "NULL")) - '("GstCaps*" "format") - '("const-gchar*" "preset"(null-ok) (default "NULL")) - ) -) - -(define-function gst_encoding_video_profile_new - (c-name "gst_encoding_video_profile_new") - (is-constructor-of "GstEncodingVideoProfile") - (return-type "GstEncodingVideoProfile*") - (parameters - '("GstCaps*" "format") - '("const-gchar*" "preset" (null-ok) (default "NULL")) - '("GstCaps*" "restriction" (null-ok)) - '("guint" "presence") - ) -) - -(define-function gst_encoding_audio_profile_new - (c-name "gst_encoding_audio_profile_new") - (is-constructor-of "GstEncodingAudioProfile") - (return-type "GstEncodingAudioProfile*") - (parameters - '("GstCaps*" "format") - '("const-gchar*" "preset" (null-ok) (default "NULL")) - '("GstCaps*" "restriction" (null-ok)) - '("guint" "presence") - ) -) - -(define-method get_pass - (of-object "GstEncodingVideoProfile") - (c-name "gst_encoding_video_profile_get_pass") - (return-type "guint") -) - -(define-method get_variableframerate - (of-object "GstEncodingVideoProfile") - (c-name "gst_encoding_video_profile_get_variableframerate") - (return-type "gboolean") -) - -(define-method set_pass - (of-object "GstEncodingVideoProfile") - (c-name "gst_encoding_video_profile_set_pass") - (return-type "none") - (parameters - '("guint" "pass") - ) -) - -(define-method set_variableframerate - (of-object "GstEncodingVideoProfile") - (c-name "gst_encoding_video_profile_set_variableframerate") - (return-type "none") - (parameters - '("gboolean" "variableframerate") - ) -) - - - -;; From encoding-target.h - -(define-function gst_encoding_target_new - (c-name "gst_encoding_target_new") - (is-constructor-of "GstEncodingTarget") - (return-type "GstEncodingTarget*") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "category") - '("const-gchar*" "description") - '("const-GList*" "profiles") - ) -) - -(define-method get_name - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_get_name") - (return-type "const-gchar*") -) - -(define-method get_category - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_get_category") - (return-type "const-gchar*") -) - -(define-method get_description - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_get_description") - (return-type "const-gchar*") -) - -(define-method get_profiles - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_get_profiles") - (return-type "const-GList*") -) - -(define-method add_profile - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_add_profile") - (return-type "gboolean") - (parameters - '("GstEncodingProfile*" "profile") - ) -) - -(define-method save - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_save") - (return-type "gboolean") - (parameters - '("GError**" "error") - ) -) - -(define-method save_to_file - (of-object "GstEncodingTarget") - (c-name "gst_encoding_target_save_to_file") - (return-type "gboolean") - (parameters - '("const-gchar*" "path") - '("GError**" "error") - ) -) - -(define-function encoding_target_load - (c-name "gst_encoding_target_load") - (return-type "GstEncodingTarget*") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "category") - '("GError**" "error") - ) -) - -(define-function encoding_target_load_from_file - (c-name "gst_encoding_target_load_from_file") - (return-type "GstEncodingTarget*") - (parameters - '("const-gchar*" "path") - '("GError**" "error") - ) -) - -(define-function encoding_list_available_categories - (c-name "gst_encoding_list_available_categories") - (return-type "GList*") -) - -(define-function encoding_list_all_targets - (c-name "gst_encoding_list_all_targets") - (return-type "GList*") - (parameters - '("const-gchar*" "categoryname") - ) -) - - - -;; From gstdiscoverer.h - -(define-method get_previous - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_previous") - (return-type "GstDiscovererStreamInfo*") -) - -(define-method get_next - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_next") - (return-type "GstDiscovererStreamInfo*") -) - -(define-method get_caps - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_caps") - (return-type "GstCaps*") -) - -(define-method get_tags - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_tags") - (return-type "const-GstTagList*") -) - -(define-method get_misc - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_misc") - (return-type "const-GstStructure*") -) - -(define-method get_stream_type_nick - (of-object "GstDiscovererStreamInfo") - (c-name "gst_discoverer_stream_info_get_stream_type_nick") - (return-type "const-gchar*") -) - -(define-method get_streams - (of-object "GstDiscovererContainerInfo") - (c-name "gst_discoverer_container_info_get_streams") - (return-type "GList*") -) - -(define-method get_channels - (of-object "GstDiscovererAudioInfo") - (c-name "gst_discoverer_audio_info_get_channels") - (return-type "guint") -) - -(define-method get_sample_rate - (of-object "GstDiscovererAudioInfo") - (c-name "gst_discoverer_audio_info_get_sample_rate") - (return-type "guint") -) - -(define-method get_depth - (of-object "GstDiscovererAudioInfo") - (c-name "gst_discoverer_audio_info_get_depth") - (return-type "guint") -) - -(define-method get_bitrate - (of-object "GstDiscovererAudioInfo") - (c-name "gst_discoverer_audio_info_get_bitrate") - (return-type "guint") -) - -(define-method get_max_bitrate - (of-object "GstDiscovererAudioInfo") - (c-name "gst_discoverer_audio_info_get_max_bitrate") - (return-type "guint") -) - -(define-method get_width - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_width") - (return-type "guint") -) - -(define-method get_height - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_height") - (return-type "guint") -) - -(define-method get_depth - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_depth") - (return-type "guint") -) - -(define-method get_framerate_num - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_framerate_num") - (return-type "guint") -) - -(define-method get_framerate_denom - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_framerate_denom") - (return-type "guint") -) - -(define-method get_par_num - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_par_num") - (return-type "guint") -) - -(define-method get_par_denom - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_par_denom") - (return-type "guint") -) - -(define-method is_interlaced - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_is_interlaced") - (return-type "gboolean") -) - -(define-method get_bitrate - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_bitrate") - (return-type "guint") -) - -(define-method get_max_bitrate - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_get_max_bitrate") - (return-type "guint") -) - -(define-method is_image - (of-object "GstDiscovererVideoInfo") - (c-name "gst_discoverer_video_info_is_image") - (return-type "gboolean") -) - -(define-method copy - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_copy") - (return-type "GstDiscovererInfo*") -) - -(define-method get_uri - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_uri") - (return-type "const-gchar*") -) - -(define-method get_result - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_result") - (return-type "GstDiscovererResult") -) - -(define-method get_stream_info - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_stream_info") - (return-type "GstDiscovererStreamInfo*") -) - -(define-method get_stream_list - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_stream_list") - (return-type "GList*") -) - -(define-method get_duration - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_duration") - (return-type "GstClockTime") -) - -(define-method get_seekable - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_seekable") - (return-type "gboolean") -) - -(define-method get_misc - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_misc") - (return-type "const-GstStructure*") -) - -(define-method get_tags - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_tags") - (return-type "const-GstTagList*") -) - -(define-method get_streams - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_streams") - (return-type "GList*") - (parameters - '("GType" "streamtype") - ) -) - -(define-method get_audio_streams - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_audio_streams") - (return-type "GList*") -) - -(define-method get_video_streams - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_video_streams") - (return-type "GList*") -) - -(define-method get_container_streams - (of-object "GstDiscovererInfo") - (c-name "gst_discoverer_info_get_container_streams") - (return-type "GList*") -) - - -(define-function gst_discoverer_new - (c-name "gst_discoverer_new") - (is-constructor-of "GstDiscoverer") - (return-type "GstDiscoverer*") - (parameters - '("GstClockTime" "timeout") - '("GError**" "err") - ) -) - -(define-method start - (of-object "GstDiscoverer") - (c-name "gst_discoverer_start") - (return-type "none") -) - -(define-method stop - (of-object "GstDiscoverer") - (c-name "gst_discoverer_stop") - (return-type "none") -) - -(define-method discover_uri_async - (of-object "GstDiscoverer") - (c-name "gst_discoverer_discover_uri_async") - (return-type "gboolean") - (parameters - '("const-gchar*" "uri") - ) -) - -(define-method discover_uri - (of-object "GstDiscoverer") - (c-name "gst_discoverer_discover_uri") - (return-type "GstDiscovererInfo*") - (parameters - '("const-gchar*" "uri") - '("GError**" "err") - ) -) - -;; From gstpluginsbaseversion.h - -(define-function plugins_base_version - (c-name "gst_plugins_base_version") - (return-type "none") - (parameters - '("guint*" "major") - '("guint*" "minor") - '("guint*" "micro") - '("guint*" "nano") - ) -) - -(define-function plugins_base_version_string - (c-name "gst_plugins_base_version_string") - (return-type "gchar*") -) - - - -;; From missing-plugins.h - -(define-function missing_uri_source_message_new - (c-name "gst_missing_uri_source_message_new") - (return-type "GstMessage*") - (parameters - '("GstElement*" "element") - '("const-gchar*" "protocol") - ) -) - -(define-function missing_uri_sink_message_new - (c-name "gst_missing_uri_sink_message_new") - (return-type "GstMessage*") - (parameters - '("GstElement*" "element") - '("const-gchar*" "protocol") - ) -) - -(define-function missing_element_message_new - (c-name "gst_missing_element_message_new") - (return-type "GstMessage*") - (parameters - '("GstElement*" "element") - '("const-gchar*" "factory_name") - ) -) - -(define-function missing_decoder_message_new - (c-name "gst_missing_decoder_message_new") - (return-type "GstMessage*") - (parameters - '("GstElement*" "element") - '("const-GstCaps*" "decode_caps") - ) -) - -(define-function missing_encoder_message_new - (c-name "gst_missing_encoder_message_new") - (return-type "GstMessage*") - (parameters - '("GstElement*" "element") - '("const-GstCaps*" "encode_caps") - ) -) - -(define-function missing_plugin_message_get_installer_detail - (c-name "gst_missing_plugin_message_get_installer_detail") - (return-type "gchar*") - (parameters - '("GstMessage*" "msg") - ) -) - -(define-function missing_plugin_message_get_description - (c-name "gst_missing_plugin_message_get_description") - (return-type "gchar*") - (parameters - '("GstMessage*" "msg") - ) -) - -(define-function is_missing_plugin_message - (c-name "gst_is_missing_plugin_message") - (return-type "gboolean") - (parameters - '("GstMessage*" "msg") - ) -) - -(define-function missing_uri_source_installer_detail_new - (c-name "gst_missing_uri_source_installer_detail_new") - (return-type "gchar*") - (parameters - '("const-gchar*" "protocol") - ) -) - -(define-function missing_uri_sink_installer_detail_new - (c-name "gst_missing_uri_sink_installer_detail_new") - (return-type "gchar*") - (parameters - '("const-gchar*" "protocol") - ) -) - -(define-function missing_element_installer_detail_new - (c-name "gst_missing_element_installer_detail_new") - (return-type "gchar*") - (parameters - '("const-gchar*" "factory_name") - ) -) - -(define-function missing_decoder_installer_detail_new - (c-name "gst_missing_decoder_installer_detail_new") - (return-type "gchar*") - (parameters - '("const-GstCaps*" "decode_caps") - ) -) - -(define-function missing_encoder_installer_detail_new - (c-name "gst_missing_encoder_installer_detail_new") - (return-type "gchar*") - (parameters - '("const-GstCaps*" "encode_caps") - ) -) - - - -;; From pbutils.h - -(define-function init - (c-name "gst_pb_utils_init") - (return-type "none") -) - - diff --git a/gst/pbutils.override b/gst/pbutils.override deleted file mode 100644 index cbb3f2fe9a..0000000000 --- a/gst/pbutils.override +++ /dev/null @@ -1,486 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 - * - * 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. - */ -%% -headers - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include "common.h" -#include "pygst.h" - -#include - -#include -#include "pygstminiobject.h" -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/* Boonky define that allows for backwards compatibility with Python 2.4 */ -#if PY_VERSION_HEX < 0x02050000 -#define Py_ssize_t int -#endif - -static void -install_plugins_result_handler(GstInstallPluginsReturn result, gpointer user_data) -{ - PyGILState_STATE state; - PyObject *callback, *args; - PyObject *py_user_data; - PyObject *py_result; - PyObject *ret; - gint i, len; - - if (user_data == NULL) - return; - - state = pyg_gil_state_ensure(); - - py_user_data = (PyObject*) user_data; - py_result = pyg_enum_from_gtype(GST_TYPE_INSTALL_PLUGINS_RETURN, result); - - callback = PyTuple_GetItem(py_user_data, 0); - args = Py_BuildValue("(N)", py_result); - - len = PyTuple_Size(py_user_data); - for (i = 1; i < len; ++i) { - PyObject *tuple = args; - args = PySequence_Concat(tuple, PyTuple_GetItem(py_user_data, i)); - Py_DECREF(tuple); - } - - ret = PyObject_CallObject(callback, args); - - if (PyErr_Occurred()) - PyErr_Print(); - - Py_DECREF(args); - pyg_gil_state_release(state); - -} -%% -modulename gst.pbutils -%% -import gobject.GObject as PyGObject_Type -import gst.Object as PyGstObject_Type -import gst.Structure as PyGstStructure_Type -import gst.Element as PyGstElement_Type -import gst.Message as PyGstMessage_Type -import gst.MiniObject as PyGstMiniObject_Type -%% -include - gstversion.override -%% -ignore-glob - _* - *init - *_free - *_get_type -%% -override gst_install_plugins_sync kwargs -static PyObject * -_wrap_gst_install_plugins_sync(PyGObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "details", "context", NULL }; - PyObject *py_ctx; - GstInstallPluginsContext *ctx; - GstInstallPluginsReturn ret; - gchar **details; - gint len; - PyObject *py_ret; - PyObject *py_details; - Py_ssize_t i; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO:install_plugins_sync", - kwlist, &py_details, &py_ctx)) - return NULL; - - if (!pyg_boxed_check(py_ctx, GST_TYPE_INSTALL_PLUGINS_CONTEXT)) { - PyErr_SetString(PyExc_TypeError, "Argument 2 must be a gst.pbutils.InstallPluginsContext"); - return NULL; - } - - len = PySequence_Size(py_details); - if ((!PySequence_Check(py_details)) || (len < 1)) { - PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings"); - Py_DECREF(py_details); - return NULL; - } - - details = g_new0(gchar*, len+1); - - /* Check all items in py_details are strings */ - for (i = 0; i < len; i++) { - PyObject *py_str = PySequence_GetItem(py_details, i); - gchar *str; - - if (!PyString_Check(py_str)) { - PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings"); - Py_DECREF(py_str); - Py_DECREF(py_details); - g_strfreev(details); - return NULL; - } - if (!(str = PyString_AsString(py_str))) { - Py_DECREF(py_str); - Py_DECREF(py_details); - g_strfreev(details); - return NULL; - } - details[i] = g_strdup(str); - Py_DECREF(py_str); - } - - ctx = (GstInstallPluginsContext *) pyg_boxed_get(py_ctx, GstInstallPluginsContext); - - pyg_begin_allow_threads; - ret = gst_install_plugins_sync(details, ctx); - pyg_end_allow_threads; - - g_strfreev(details); - - py_ret = pyg_enum_from_gtype(GST_TYPE_INSTALL_PLUGINS_RETURN, ret); - return py_ret; -} -%% -override gst_install_plugins_async args -static PyObject * -_wrap_gst_install_plugins_async(PyGObject *self, PyObject *args) -{ - PyObject *py_ctx, *py_ret, *py_details, *callback, *cbargs, *data; - GstInstallPluginsContext *ctx; - GstInstallPluginsReturn ret; - gchar **details; - gint len; - Py_ssize_t i; - - if (PyTuple_Size(args) < 3) { - PyErr_SetString(PyExc_TypeError, "install_plugins_async requires at least 3 arguments"); - return NULL; - } - - py_ctx = PySequence_GetItem(args, 1); - - if (!pyg_boxed_check(py_ctx, GST_TYPE_INSTALL_PLUGINS_CONTEXT)) { - PyErr_SetString(PyExc_TypeError, "Argument 2 must be a gst.pbutils.InstallPluginsContext"); - Py_DECREF(py_ctx); - return NULL; - } - - py_details = PySequence_GetItem(args, 0); - if ((!PySequence_Check(py_details)) || (PySequence_Size(py_details) < 1)) { - PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings"); - Py_DECREF(py_ctx); - Py_DECREF(py_details); - return NULL; - } - - len = PySequence_Size(py_details); - details = g_new0(gchar*, len+1); - - /* Check all items in py_details are strings */ - for (i = 0; i < len; i++) { - PyObject *py_str = PySequence_GetItem(py_details, i); - gchar *str; - - if (!PyString_Check(py_str)) { - PyErr_SetString(PyExc_TypeError, "Details need to be a non-empty list or tuple of strings"); - Py_DECREF(py_str); - Py_DECREF(py_ctx); - Py_DECREF(py_details); - g_strfreev(details); - return NULL; - } - if (!(str = PyString_AsString(py_str))) { - Py_DECREF(py_str); - Py_DECREF(py_ctx); - Py_DECREF(py_details); - g_strfreev(details); - return NULL; - } - details[i] = g_strdup(str); - Py_DECREF(py_str); - } - - callback = PySequence_GetItem(args, 2); - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "callback is not callable"); - Py_DECREF(callback); - Py_DECREF(py_ctx); - Py_DECREF(py_details); - g_strfreev(details); - } - - if (!(cbargs = PySequence_GetSlice(args, 3, PyTuple_Size(args)))) { - Py_DECREF(callback); - Py_DECREF(py_ctx); - Py_DECREF(py_details); - g_strfreev(details); - return NULL; - } - if (!(data = Py_BuildValue("(ON)", callback, cbargs))) { - Py_DECREF(py_details); - Py_DECREF(py_ctx); - Py_DECREF(callback); - Py_DECREF(cbargs); - } - - ctx = (GstInstallPluginsContext *) pyg_boxed_get(py_ctx, GstInstallPluginsContext); - pyg_begin_allow_threads; - ret = gst_install_plugins_async(details, ctx, - (GstInstallPluginsResultFunc) install_plugins_result_handler, - data); - pyg_end_allow_threads; - - g_strfreev(details); - - py_ret = pyg_enum_from_gtype(GST_TYPE_INSTALL_PLUGINS_RETURN, ret); - return py_ret; -} -%% -override gst_plugins_base_version noargs -static PyObject * -_wrap_gst_plugins_base_version (PyObject *self) -{ - guint major, minor, micro, nano; - PyObject *py_tuple; - - gst_plugins_base_version (&major, &minor, µ, &nano); - py_tuple = PyTuple_New(4); - PyTuple_SetItem(py_tuple, 0, PyInt_FromLong(major)); - PyTuple_SetItem(py_tuple, 1, PyInt_FromLong(minor)); - PyTuple_SetItem(py_tuple, 2, PyInt_FromLong(micro)); - PyTuple_SetItem(py_tuple, 3, PyInt_FromLong(nano)); - - return py_tuple; -} -%% -override gst_discoverer_info_get_stream_list noargs -static PyObject * -_wrap_gst_discoverer_info_get_stream_list(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = gst_discoverer_info_get_stream_list(GST_DISCOVERER_INFO (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_discoverer_info_get_streams kwargs -static PyObject * -_wrap_gst_discoverer_info_get_streams(PyGstMiniObject * self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "type", NULL }; - GList *res, *tmp; - PyObject *pyres, *py_type; - GType ftype; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GstDiscovererInfo.get_streams", kwlist, &py_type)) - return NULL; - if ((ftype = pyg_type_from_object(py_type)) == 0) - return NULL; - res = gst_discoverer_info_get_streams(GST_DISCOVERER_INFO (self->obj), ftype); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_discoverer_info_get_audio_streams noargs -static PyObject * -_wrap_gst_discoverer_info_get_audio_streams(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = gst_discoverer_info_get_audio_streams(GST_DISCOVERER_INFO (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_discoverer_info_get_video_streams noargs -static PyObject * -_wrap_gst_discoverer_info_get_video_streams(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = gst_discoverer_info_get_video_streams(GST_DISCOVERER_INFO (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_discoverer_info_get_container_streams noargs -static PyObject * -_wrap_gst_discoverer_info_get_container_streams(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = gst_discoverer_info_get_container_streams(GST_DISCOVERER_INFO (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_discoverer_container_info_get_streams noargs -static PyObject * -_wrap_gst_discoverer_container_info_get_streams(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = gst_discoverer_container_info_get_streams(GST_DISCOVERER_CONTAINER_INFO (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - gst_discoverer_stream_info_list_free(res); - return pyres; -} -%% -override gst_encoding_container_profile_get_profiles noargs -static PyObject * -_wrap_gst_encoding_container_profile_get_profiles(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = (GList*) gst_encoding_container_profile_get_profiles(GST_ENCODING_CONTAINER_PROFILE (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - g_list_free (res); - return pyres; -} -%% -override gst_encoding_target_get_profiles noargs -static PyObject * -_wrap_gst_encoding_target_get_profiles(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = (GList*) gst_encoding_target_get_profiles(GST_ENCODING_TARGET (self->obj)); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - g_list_free (res); - return pyres; -} -%% -override gst_encoding_list_all_targets kwargs -static PyObject * -_wrap_gst_encoding_list_all_targets(PyGstMiniObject * self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "categoryname", NULL }; - GList *res, *tmp; - const gchar *categoryname = NULL; - PyObject *pyres; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"s:GstEncoding.list_all_targets", kwlist, &categoryname)) - return NULL; - res = (GList*) gst_encoding_list_all_targets(categoryname); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, pygstminiobject_new((GstMiniObject*) tmp->data)); - } - if (res) - g_list_free (res); - return pyres; -} -%% -override gst_encoding_list_available_categories noargs -static PyObject * -_wrap_gst_encoding_list_available_categories(PyGstMiniObject * self) -{ - GList *res, *tmp; - PyObject *pyres; - - res = (GList*) gst_encoding_list_available_categories(); - - pyres = PyList_New(0); - for (tmp = res; tmp; tmp = tmp->next) { - PyList_Append(pyres, PyString_FromString((const gchar*) tmp->data)); - g_free (tmp->data); - } - if (res) - g_list_free (res); - return pyres; -} -%% -override gst_encoding_target_new kwargs -static int -_wrap_gst_encoding_target_new(PyGstMiniObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "name", "category", "description", NULL }; - char *name, *description, *category; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sss:GstEncodingContainerProfile.__init__", kwlist, &name, &category, &description)) - return -1; - - self->obj = (GstMiniObject *)gst_encoding_target_new(name, category, description, NULL); - - if (!self->obj) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstEncodingTarget miniobject"); - return -1; - } - pygstminiobject_register_wrapper((PyObject *)self); - return 0; -} diff --git a/gst/pbutilsmodule.c b/gst/pbutilsmodule.c deleted file mode 100644 index d76ba8af13..0000000000 --- a/gst/pbutilsmodule.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 Edward Hervey - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include -#include "pygst.h" - -void pypbutils_register_classes (PyObject * d); -void pypbutils_add_constants (PyObject * module, const gchar * strip_prefix); - -extern PyMethodDef pypbutils_functions[]; - -GST_DEBUG_CATEGORY (pygst_debug); /* for python code */ - -DL_EXPORT (void) -initpbutils (void) -{ - PyObject *m, *d; - PyObject *gst G_GNUC_UNUSED; - - init_pygobject (); - - /* Make sure gst module is loaded and ready */ - gst = pygst_init (); - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.pbutils"); - } - - gst_pb_utils_init (); - - m = Py_InitModule ("pbutils", pypbutils_functions); - d = PyModule_GetDict (m); - - pypbutils_register_classes (d); - pypbutils_add_constants (m, "GST_"); - - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.pbutils"); - } -} diff --git a/gst/pygst-private.h b/gst/pygst-private.h deleted file mode 100644 index cb7c6bef5f..0000000000 --- a/gst/pygst-private.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2010 Edward Hervey - * - * 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. - */ - -#ifndef _PYGST_PRIVATE_H_ -#define _PYGST_PRIVATE_H_ - -#ifdef _PYGST_H_ -# error "include pygst.h or pygst-private.h but not both" -#endif - -#define _INSIDE_PYGST_ -#include "pygst.h" -#include "common.h" - -extern PyTypeObject PyGstMiniObject_Type; - -/* from gst-types.c */ -GstCaps *pygst_caps_from_pyobject (PyObject *object, gboolean *copy); -PyObject* pygst_iterator_new(GstIterator *iter); - -/* from pygstminiobject.c */ -PyObject * -pygstminiobject_new(GstMiniObject *obj); - - - -#endif /* _PYGST_PRIVATE_H_ */ diff --git a/gst/pygst.h b/gst/pygst.h deleted file mode 100644 index 23b4b8a49c..0000000000 --- a/gst/pygst.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "python" -*- */ -/* gst-python - * Copyright (C) 2010 Edward Hervey - * - * 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. - */ - -#ifndef _PYGST_H_ -#define _PYGST_H_ - -#include - -#include -#include -#include - -G_BEGIN_DECLS - -struct _PyGst_Functions { - GstCaps* (*caps_from_pyobject) (PyObject *object, gboolean *copy); - PyObject* (*iterator_new) (GstIterator *iter); - PyObject* (*miniobject_new) (GstMiniObject *obj); -}; - -#define pygstminiobject_get(v) (((PyGstMiniObject *)(v))->obj) -#define pygstminiobject_check(v,base) (PyObject_TypeCheck(v,base)) - -typedef struct { - PyObject_HEAD - GstMiniObject *obj; - PyObject *inst_dict; /* the instance dictionary -- must be last */ - PyObject *weakreflist; /* list of weak references */ -} PyGstMiniObject; - -#ifndef _INSIDE_PYGST_ - -#if defined(NO_IMPORT_PYGOBJECT) -extern struct _PyGst_Functions *_PyGst_API; -#else -struct _PyGst_Functions *_PyGst_API; -#endif - -#define pygst_caps_from_pyobject (_PyGst_API->caps_from_pyobject) -#define pygst_iterator_new (_PyGst_API->iterator_new) -#define pygstminiobject_new (_PyGst_API->miniobject_new) - -static inline PyObject * -pygst_init(void) -{ - PyObject *gstobject, *cobject; - - gstobject = PyImport_ImportModule("gst._gst"); - if (!gstobject) { - if (PyErr_Occurred()) - { - PyObject *type, *value, *traceback; - PyObject *py_orig_exc; - PyErr_Fetch(&type, &value, &traceback); - py_orig_exc = PyObject_Repr(value); - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); - PyErr_Format(PyExc_ImportError, - "could not import gst (error was: %s)", - PyString_AsString(py_orig_exc)); - Py_DECREF(py_orig_exc); - } else { - PyErr_SetString(PyExc_ImportError, - "could not import gst (no error given)"); - } - return NULL; - } - - cobject = PyObject_GetAttrString(gstobject, "_PyGst_API"); - if (!cobject) { - PyErr_SetString(PyExc_ImportError, - "could not import gst (getting _PyGst_API)"); - return NULL; - } - _PyGst_API = (struct _PyGst_Functions *) PyCObject_AsVoidPtr(cobject); - - return gstobject; -} - -#endif /* _INSIDE_PYGST_ */ - -G_END_DECLS - -#endif /* !_PYGST_H_ */ diff --git a/gst/pygstexception.c b/gst/pygstexception.c deleted file mode 100644 index 9e60b16be4..0000000000 --- a/gst/pygstexception.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * pygstexception.c - gst-python exceptions - * Copyright (C) 2005 Alessandro Decina - * - * Authors: - * Alessandro Decina - * - * 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. - */ - -#include -#include "structmember.h" - -PyObject *PyGstExc_LinkError = NULL; -PyObject *PyGstExc_AddError = NULL; -PyObject *PyGstExc_QueryError = NULL; -PyObject *PyGstExc_RemoveError = NULL; -PyObject *PyGstExc_PluginNotFoundError = NULL; -PyObject *PyGstExc_ElementNotFoundError = NULL; - - -static PyObject * -call_exception_init (PyObject * args) -{ - PyObject *parent_init = NULL; - PyObject *res = NULL; - - /* get Exception.__init__ */ - parent_init = PyObject_GetAttrString (PyExc_Exception, "__init__"); - if (parent_init == NULL) - goto exception; - - /* call Exception.__init__. This will set self.args */ - res = PyObject_CallObject (parent_init, args); - if (res == NULL) - goto exception; - - Py_DECREF (parent_init); - - return res; - -exception: - Py_XDECREF (parent_init); - Py_XDECREF (res); - - return NULL; -} - -static int -add_method (PyObject * klass, PyObject * dict, PyMethodDef * method) -{ - PyObject *module = NULL; - PyObject *func = NULL; - PyObject *meth = NULL; - - module = PyString_FromString ("gst"); - if (module == NULL) - goto exception; - - func = PyCFunction_NewEx (method, NULL, module); - if (func == NULL) - goto exception; - Py_DECREF (module); - - meth = PyMethod_New (func, NULL, klass); - if (meth == NULL) - goto exception; - Py_DECREF (func); - - if (PyDict_SetItemString (dict, method->ml_name, meth) < 0) - goto exception; - Py_DECREF (meth); - - return 0; - -exception: - Py_XDECREF (module); - Py_XDECREF (func); - Py_XDECREF (meth); - - return -1; -} - -static PyObject * -link_error_init (PyObject * self, PyObject * args) -{ - PyObject *err_type = NULL; - int status; - - if (!PyArg_ParseTuple (args, "O|O:__init__", &self, &err_type)) - return NULL; - - if (err_type == NULL) - err_type = Py_None; - Py_INCREF (err_type); - - /* set self.error */ - status = PyObject_SetAttrString (self, "error", err_type); - Py_DECREF (err_type); - if (status < 0) - return NULL; - - return call_exception_init (args); -} - -static PyObject * -element_not_found_error_init (PyObject * self, PyObject * args) -{ - PyObject *element_name = NULL; - int status; - - if (!PyArg_ParseTuple (args, "O|O:__init__", &self, &element_name)) - return NULL; - - if (element_name == NULL) - element_name = Py_None; - Py_INCREF (element_name); - - /* set self.name */ - status = PyObject_SetAttrString (self, "name", element_name); - Py_DECREF (element_name); - if (status < 0) - return NULL; - - return call_exception_init (args); -} - -static PyMethodDef link_error_init_method = { "__init__", - link_error_init, METH_VARARGS -}; - -static PyMethodDef element_not_found_error_init_method = { "__init__", - element_not_found_error_init, METH_VARARGS -}; - -void -pygst_exceptions_register_classes (PyObject * d) -{ - PyObject *dict = NULL; - - /* register gst.LinkError */ - dict = PyDict_New (); - if (dict == NULL) - goto exception; - - PyGstExc_LinkError = PyErr_NewException ("gst.LinkError", - PyExc_Exception, dict); - if (PyGstExc_LinkError == NULL) - goto exception; - - if (add_method (PyGstExc_LinkError, dict, &link_error_init_method) < 0) - goto exception; - - Py_DECREF (dict); - - if (PyDict_SetItemString (d, "LinkError", PyGstExc_LinkError) < 0) - goto exception; - - Py_DECREF (PyGstExc_LinkError); - - /* register gst.AddError */ - PyGstExc_AddError = PyErr_NewException ("gst.AddError", - PyExc_Exception, NULL); - if (PyGstExc_AddError == NULL) - goto exception; - - if (PyDict_SetItemString (d, "AddError", PyGstExc_AddError) < 0) - goto exception; - - Py_DECREF (PyGstExc_AddError); - - /* register gst.RemoveError */ - PyGstExc_RemoveError = PyErr_NewException ("gst.RemoveError", - PyExc_Exception, NULL); - if (PyGstExc_RemoveError == NULL) - goto exception; - - if (PyDict_SetItemString (d, "RemoveError", PyGstExc_RemoveError) < 0) - goto exception; - - Py_DECREF (PyGstExc_RemoveError); - - /* register gst.QueryError */ - PyGstExc_QueryError = PyErr_NewException ("gst.QueryError", - PyExc_Exception, NULL); - if (PyGstExc_QueryError == NULL) - goto exception; - - if (PyDict_SetItemString (d, "QueryError", PyGstExc_QueryError) < 0) - goto exception; - - Py_DECREF (PyGstExc_QueryError); - -/* FIXME: remove this method in 0.11; element_factory_make deals with element - factories, not plug-ins */ - - /* register gst.PluginNotFoundError */ - dict = PyDict_New (); - if (dict == NULL) - goto exception; - - PyGstExc_PluginNotFoundError = - PyErr_NewException ("gst.PluginNotFoundError", PyExc_Exception, dict); - if (PyGstExc_PluginNotFoundError == NULL) - goto exception; - - if (add_method (PyGstExc_PluginNotFoundError, - dict, &element_not_found_error_init_method) < 0) - goto exception; - - Py_DECREF (dict); - - if (PyDict_SetItemString (d, "PluginNotFoundError", - PyGstExc_PluginNotFoundError) < 0) - goto exception; - - Py_DECREF (PyGstExc_PluginNotFoundError); - - /* register gst.ElementNotFoundError */ - dict = PyDict_New (); - if (dict == NULL) - goto exception; - - PyGstExc_ElementNotFoundError = - PyErr_NewException ("gst.ElementNotFoundError", - PyGstExc_PluginNotFoundError, dict); - if (PyGstExc_ElementNotFoundError == NULL) - goto exception; - - if (add_method (PyGstExc_ElementNotFoundError, - dict, &element_not_found_error_init_method) < 0) - goto exception; - - Py_DECREF (dict); - - if (PyDict_SetItemString (d, "ElementNotFoundError", - PyGstExc_ElementNotFoundError) < 0) - goto exception; - - Py_DECREF (PyGstExc_ElementNotFoundError); - - return; - - return; - -exception: - Py_XDECREF (dict); - Py_XDECREF (PyGstExc_LinkError); - Py_XDECREF (PyGstExc_AddError); - Py_XDECREF (PyGstExc_RemoveError); - Py_XDECREF (PyGstExc_QueryError); - Py_XDECREF (PyGstExc_PluginNotFoundError); - Py_XDECREF (PyGstExc_ElementNotFoundError); - - return; -} diff --git a/gst/pygstexception.h b/gst/pygstexception.h deleted file mode 100644 index f6d2297550..0000000000 --- a/gst/pygstexception.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * pygstexception.h - gst-python exceptions - * Copyright (C) 2005 Alessandro Decina - * - * Authors: - * Alessandro Decina - * - * 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. - */ - -#ifndef _PYGSTEXCEPTION_H_ -#define _PYGSTEXCEPTION_H_ - -extern PyObject *PyGstExc_LinkError; -extern PyObject *PyGstExc_AddError; -extern PyObject *PyGstExc_RemoveError; -extern PyObject *PyGstExc_QueryError; -extern PyObject *PyGstExc_PluginNotFoundError; -extern PyObject *PyGstExc_ElementNotFoundError; - -void pygst_exceptions_register_classes(PyObject *d); - -#endif /* _PYGSTEXCEPTION_H_ */ diff --git a/gst/pygstiterator.c b/gst/pygstiterator.c deleted file mode 100644 index ba009a970d..0000000000 --- a/gst/pygstiterator.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2005 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: Johan Dahlin - */ -/* define this for all source files that don't run init_pygobject() - * before including pygobject.h */ -#define NO_IMPORT_PYGOBJECT - -#include "pygst-private.h" - -static void -pygst_iterator_dealloc (PyGstIterator * self) -{ - gst_iterator_free (self->iter); - PyObject_Del ((PyObject *) self); -} - -static PyObject * -pygst_iterator_iter_next (PyGstIterator * self) -{ - gpointer element; - PyObject *retval = NULL; - GstIteratorResult result; - - result = gst_iterator_next (self->iter, &element); - switch (result) { - case GST_ITERATOR_DONE: - PyErr_SetNone (PyExc_StopIteration); - break; - case GST_ITERATOR_OK: - if (g_type_is_a (self->iter->type, G_TYPE_OBJECT)) { - retval = pygobject_new (G_OBJECT (element)); - g_object_unref (element); - } else if (g_type_is_a (self->iter->type, GST_TYPE_MINI_OBJECT)) { - retval = pygstminiobject_new (GST_MINI_OBJECT (element)); - gst_mini_object_unref (element); - } else { - const gchar *type_name; - - type_name = g_type_name (self->iter->type); - PyErr_Format (PyExc_TypeError, "Unsupported child type: %s", - type_name ? type_name : "unknown"); - } - break; - case GST_ITERATOR_RESYNC: - /* XXX: add/raise gst.IteratorResync */ - PyErr_SetString (PyExc_TypeError, "Resync"); - break; - case GST_ITERATOR_ERROR: - PyErr_SetString (PyExc_TypeError, "Error"); - break; - default: - g_assert_not_reached (); - break; - } - return retval; -} - -static PyObject * -pygst_iterator_next (PyGstIterator * self) -{ - /* Be compatible with Pythons API rather than GStreamers */ - return pygst_iterator_iter_next (self); -} - -static PyObject * -pygst_iterator_push (PyGstIterator * self, PyObject * args) -{ - PyGstIterator *other; - - if (!PyArg_ParseTuple (args, "O!:push", &PyGstIterator_Type, &other)) - return NULL; - - gst_iterator_push (self->iter, other->iter); - - Py_INCREF (Py_None); - return Py_None; -} - -static PyObject * -pygst_iterator_resync (PyGstIterator * self) -{ - gst_iterator_resync (self->iter); - - Py_INCREF (Py_None); - return Py_None; -} - -static PyMethodDef _PyGstIterator_methods[] = { - {"next", (PyCFunction) pygst_iterator_next, METH_NOARGS}, - {"push", (PyCFunction) pygst_iterator_push, METH_VARARGS}, - {"resync", (PyCFunction) pygst_iterator_resync, METH_NOARGS}, - {NULL, NULL, 0} -}; - -PyTypeObject PyGstIterator_Type = { - PyObject_HEAD_INIT (NULL) - 0, /* ob_size */ - "gst.Iterator", /* tp_name */ - sizeof (PyGstIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) pygst_iterator_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "GstIterator wrapper", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc) pygst_iterator_iter_next, /* tp_iternext */ - _PyGstIterator_methods, /* tp_methods */ -}; - -PyObject * -pygst_iterator_new (GstIterator * iter) -{ - PyGstIterator *self; - - if (iter == NULL) { - PyErr_SetString (PyExc_TypeError, "Invalid GstIterator (NULL)"); - return NULL; - } - - self = PyObject_NEW (PyGstIterator, &PyGstIterator_Type); - self->iter = iter; - GST_DEBUG ("self:%p , iterator:%p, type:%lu", - self, self->iter, self->iter->type); - return (PyObject *) self; -} diff --git a/gst/pygstminiobject-private.h b/gst/pygstminiobject-private.h deleted file mode 100644 index c5852e8461..0000000000 --- a/gst/pygstminiobject-private.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef _PYGOBJECT_PRIVATE_H_ -#define _PYGOBJECT_PRIVATE_H_ - -#ifdef _PYGOBJECT_H_ -# error "include pygobject.h or pygobject-private.h, but not both" -#endif - -#define _INSIDE_PYGOBJECT_ -#include "pygobject.h" - -/* from gobjectmodule.c */ -extern struct _PyGObject_Functions pygobject_api_functions; -#define pyg_block_threads() G_STMT_START { \ - if (pygobject_api_functions.block_threads != NULL) \ - (* pygobject_api_functions.block_threads)(); \ - } G_STMT_END -#define pyg_unblock_threads() G_STMT_START { \ - if (pygobject_api_functions.unblock_threads != NULL) \ - (* pygobject_api_functions.unblock_threads)(); \ - } G_STMT_END - -#define pyg_threads_enabled (pygobject_api_functions.threads_enabled) - - -#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (pygobject_api_functions.gil_state_ensure()) : 0) -#define pyg_gil_state_release(state) G_STMT_START { \ - if (pygobject_api_functions.threads_enabled) \ - pygobject_api_functions.gil_state_release(state); \ - } G_STMT_END - -#define pyg_begin_allow_threads \ - G_STMT_START { \ - PyThreadState *_save = NULL; \ - if (pygobject_api_functions.threads_enabled) \ - _save = PyEval_SaveThread(); -#define pyg_end_allow_threads \ - if (pygobject_api_functions.threads_enabled) \ - PyEval_RestoreThread(_save); \ - } G_STMT_END - - -extern GType PY_TYPE_OBJECT; - -void pyg_destroy_notify (gpointer user_data); - -/* from pygtype.h */ -extern PyTypeObject PyGTypeWrapper_Type; - -PyObject *pyg_type_wrapper_new (GType type); -GType pyg_type_from_object (PyObject *obj); - -gint pyg_enum_get_value (GType enum_type, PyObject *obj, gint *val); -gint pyg_flags_get_value (GType flag_type, PyObject *obj, gint *val); -int pyg_pyobj_to_unichar_conv (PyObject* py_obj, void* ptr); - -typedef PyObject *(* fromvaluefunc)(const GValue *value); -typedef int (*tovaluefunc)(GValue *value, PyObject *obj); - -void pyg_register_boxed_custom(GType boxed_type, - fromvaluefunc from_func, - tovaluefunc to_func); -int pyg_value_from_pyobject(GValue *value, PyObject *obj); -PyObject *pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed); -int pyg_param_gvalue_from_pyobject(GValue* value, - PyObject* py_obj, - const GParamSpec* pspec); -PyObject *pyg_param_gvalue_as_pyobject(const GValue* gvalue, - gboolean copy_boxed, - const GParamSpec* pspec); - -GClosure *pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data); -GClosure *pyg_signal_class_closure_get(void); - -PyObject *pyg_object_descr_doc_get(void); - - -/* from pygobject.h */ -extern PyTypeObject PyGObject_Type; -extern PyTypeObject PyGInterface_Type; -extern GQuark pyginterface_type_key; - -void pygobject_register_class (PyObject *dict, - const gchar *type_name, - GType gtype, PyTypeObject *type, - PyObject *bases); -void pygobject_register_wrapper (PyObject *self); -PyObject * pygobject_new (GObject *obj); -PyTypeObject *pygobject_lookup_class (GType gtype); -void pygobject_watch_closure (PyObject *self, GClosure *closure); -void pygobject_register_sinkfunc(GType type, - void (* sinkfunc)(GObject *object)); - -/* from pygboxed.c */ -extern PyTypeObject PyGBoxed_Type; - -void pyg_register_boxed (PyObject *dict, const gchar *class_name, - GType boxed_type, PyTypeObject *type); -PyObject * pyg_boxed_new (GType boxed_type, gpointer boxed, - gboolean copy_boxed, gboolean own_ref); - -extern PyTypeObject PyGPointer_Type; - -void pyg_register_pointer (PyObject *dict, const gchar *class_name, - GType pointer_type, PyTypeObject *type); -PyObject * pyg_pointer_new (GType pointer_type, gpointer pointer); - -extern char * pyg_constant_strip_prefix(gchar *name, const gchar *strip_prefix); - -/* pygflags */ -typedef struct { - PyIntObject parent; - GType gtype; -} PyGFlags; - -extern PyTypeObject PyGFlags_Type; - -#define PyGFlags_Check(x) (g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_FLAGS)) - -extern PyObject * pyg_flags_add (PyObject * module, - const char * typename, - const char * strip_prefix, - GType gtype); -extern PyObject * pyg_flags_from_gtype (GType gtype, - int value); - -/* pygenum */ -#define PyGEnum_Check(x) (g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_ENUM)) - -typedef struct { - PyIntObject parent; - GType gtype; -} PyGEnum; - -extern PyTypeObject PyGEnum_Type; - -extern PyObject * pyg_enum_add (PyObject * module, - const char * typename, - const char * strip_prefix, - GType gtype); -extern PyObject * pyg_enum_from_gtype (GType gtype, - int value); - -/* pygmainloop */ - -typedef struct { - PyObject_HEAD - GMainLoop *loop; - GSource *signal_source; -} PyGMainLoop; - -extern PyTypeObject PyGMainLoop_Type; - -/* pygmaincontext */ - -typedef struct { - PyObject_HEAD - GMainContext *context; -} PyGMainContext; - -extern PyTypeObject PyGMainContext_Type; - -/* pygparamspec */ - -extern PyTypeObject PyGParamSpec_Type; -PyObject * pyg_param_spec_new (GParamSpec *pspec); - - - -#endif diff --git a/gst/pygstminiobject.c b/gst/pygstminiobject.c deleted file mode 100644 index 443d245b6c..0000000000 --- a/gst/pygstminiobject.c +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * - * pygobject.c: wrapper for the GObject type. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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 - */ - -#define NO_IMPORT_PYGOBJECT -#define _INSIDE_PYGST_ -#include "common.h" -#include "pygstminiobject.h" -#include "pygst.h" -#include - -static const gchar pygstminiobject_class_id[] = "PyGstMiniObject::class"; -static GQuark pygstminiobject_class_key = 0; -/* static const gchar pygstminiobject_wrapper_id[] = "PyGstMiniObject::wrapper"; */ -/* static GQuark pygstminiobject_wrapper_key = 0; */ - -static void pygstminiobject_dealloc (PyGstMiniObject * self); -/* static int pygstminiobject_traverse(PyGstMiniObject *self, visitproc visit, void *arg); */ -/* static int pygstminiobject_clear(PyGstMiniObject *self); */ - -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/** - * pygstminiobject_lookup_class: - * @gtype: the GType of the GstMiniObject subclass. - * - * This function looks up the wrapper class used to represent - * instances of a GstMiniObject represented by @gtype. If no wrapper class - * or interface has been registered for the given GType, then a new - * type will be created. - * - * Returns: The wrapper class for the GstMiniObject or NULL if the - * GType has no registered type and a new type couldn't be created - */ -PyTypeObject * -pygstminiobject_lookup_class (GType gtype) -{ - PyTypeObject *py_type = NULL; - GType ctype = gtype; - - while (!py_type && ctype) { - py_type = g_type_get_qdata (ctype, pygstminiobject_class_key); - ctype = g_type_parent (ctype); - } - if (!ctype) - g_error ("Couldn't find a good base type!!"); - - return py_type; -} - -/** - * pygstminiobject_register_class: - * @dict: the module dictionary. A reference to the type will be stored here. - * @type_name: not used ? - * @gtype: the GType of the Gstminiobject subclass. - * @type: the Python type object for this wrapper. - * @bases: a tuple of Python type objects that are the bases of this type. - * - * This function is used to register a Python type as the wrapper for - * a particular Gstminiobject subclass. It will also insert a reference to - * the wrapper class into the module dictionary passed as a reference, - * which simplifies initialisation. - */ -void -pygstminiobject_register_class (PyObject * dict, const gchar * type_name, - GType gtype, PyTypeObject * type, PyObject * bases) -{ - PyObject *o; - const char *class_name, *s; - - if (!pygstminiobject_class_key) - pygstminiobject_class_key = - g_quark_from_static_string (pygstminiobject_class_id); - - class_name = type->tp_name; - s = strrchr (class_name, '.'); - if (s != NULL) - class_name = s + 1; - - type->ob_type = &PyType_Type; - type->tp_alloc = PyType_GenericAlloc; - type->tp_new = PyType_GenericNew; - if (bases) { - type->tp_bases = bases; - type->tp_base = (PyTypeObject *) PyTuple_GetItem (bases, 0); - } - - if (PyType_Ready (type) < 0) { - g_warning ("couldn't make the type `%s' ready", type->tp_name); - return; - } - - if (gtype) { - o = pyg_type_wrapper_new (gtype); - PyDict_SetItemString (type->tp_dict, "__gtype__", o); - Py_DECREF (o); - - /* stash a pointer to the python class with the GType */ - Py_INCREF (type); - g_type_set_qdata (gtype, pygstminiobject_class_key, type); - } - - PyDict_SetItemString (dict, (char *) class_name, (PyObject *) type); -} - -void -pygstminiobject_register_wrapper (PyObject * self) -{ -} - - -/** - * pygstminiobject_new: - * @obj: a GstMiniObject instance. - * - * This function gets a reference to a wrapper for the given GstMiniObject - * instance. A new wrapper will always be created. - * - * Returns: a reference to the wrapper for the GstMiniObject. - */ -PyObject * -pygstminiobject_new (GstMiniObject * obj) -{ - PyGstMiniObject *self = NULL; - PyGILState_STATE state; - PyTypeObject *tp = NULL; - - if (obj == NULL) { - Py_INCREF (Py_None); - return Py_None; - } - - /* since mini objects cannot notify us when they get destroyed, we - * can't use a global hash to map GMO to PyO, and have to create a new - * Python object every time we see it */ - tp = pygstminiobject_lookup_class (G_OBJECT_TYPE (obj)); - GST_DEBUG ("have to create wrapper for object %p", obj); - if (!tp) - g_warning ("Couldn't get class for type object : %p", obj); - if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) { - GST_INFO ("Increment refcount %p", tp); - Py_INCREF (tp); - } - state = pyg_gil_state_ensure (); - self = PyObject_New (PyGstMiniObject, tp); - pyg_gil_state_release (state); - - if (self == NULL) - return NULL; - self->obj = gst_mini_object_ref (obj); - - self->inst_dict = NULL; - self->weakreflist = NULL; - - GST_DEBUG ("created Python object %p for GstMiniObject %p [ref:%d]", - self, obj, GST_MINI_OBJECT_REFCOUNT_VALUE (obj)); - return (PyObject *) self; -} - -static void -pygstminiobject_dealloc (PyGstMiniObject * self) -{ - PyGILState_STATE state; - - g_return_if_fail (self != NULL); - - GST_DEBUG ("At the beginning %p", self); - state = pyg_gil_state_ensure (); - - if (self->obj) { - GST_DEBUG ("PyO %p unreffing GstMiniObject %p [ref:%d]", self, - self->obj, GST_MINI_OBJECT_REFCOUNT_VALUE (self->obj)); - gst_mini_object_unref (self->obj); - GST_DEBUG ("setting self %p -> obj to NULL", self); - self->obj = NULL; - } - - if (self->inst_dict) { - Py_DECREF (self->inst_dict); - self->inst_dict = NULL; - } - - self->ob_type->tp_free ((PyObject *) self); - pyg_gil_state_release (state); - GST_DEBUG ("At the end %p", self); -} - -static int -pygstminiobject_compare (PyGstMiniObject * self, PyGstMiniObject * v) -{ - if (self->obj == v->obj) - return 0; - if (self->obj > v->obj) - return -1; - return 1; -} - -static long -pygstminiobject_hash (PyGstMiniObject * self) -{ - return (long) self->obj; -} - -static PyObject * -pygstminiobject_repr (PyGstMiniObject * self) -{ - gchar buf[256]; - - g_snprintf (buf, sizeof (buf), - "<%s mini-object (%s) at 0x%lx>", - self->ob_type->tp_name, - self->obj ? G_OBJECT_TYPE_NAME (self->obj) : "uninitialized", - (long) self); - return PyString_FromString (buf); -} - - -static void -pygstminiobject_free (PyObject * op) -{ - PyObject_FREE (op); -} - - -/* ---------------- PyGstMiniObject methods ----------------- */ - -static int -pygstminiobject_init (PyGstMiniObject * self, PyObject * args, - PyObject * kwargs) -{ - GType object_type; - GstMiniObjectClass *class; - - if (!PyArg_ParseTuple (args, ":GstMiniObject.__init__", &object_type)) - return -1; - - object_type = pyg_type_from_object ((PyObject *) self); - if (!object_type) - return -1; - - if (G_TYPE_IS_ABSTRACT (object_type)) { - PyErr_Format (PyExc_TypeError, "cannot create instance of abstract " - "(non-instantiable) type `%s'", g_type_name (object_type)); - return -1; - } - - if ((class = g_type_class_ref (object_type)) == NULL) { - PyErr_SetString (PyExc_TypeError, - "could not get a reference to type class"); - return -1; - } - - self->obj = gst_mini_object_new (object_type); - if (self->obj == NULL) - PyErr_SetString (PyExc_RuntimeError, "could not create object"); - - g_type_class_unref (class); - - return (self->obj) ? 0 : -1; -} - -static PyObject * -pygstminiobject__gstminiobject_init__ (PyGstMiniObject * self, PyObject * args, - PyObject * kwargs) -{ - if (pygstminiobject_init (self, args, kwargs) < 0) - return NULL; - Py_INCREF (Py_None); - return Py_None; -} - -static PyObject * -pygstminiobject_copy (PyGstMiniObject * self, PyObject * args) -{ - return pygstminiobject_new (gst_mini_object_copy (self->obj)); -} - -static PyMethodDef pygstminiobject_methods[] = { - {"__gstminiobject_init__", - (PyCFunction) pygstminiobject__gstminiobject_init__, - METH_VARARGS | METH_KEYWORDS}, - {"copy", (PyCFunction) pygstminiobject_copy, METH_VARARGS, - "Copies the miniobject"}, - {NULL, NULL, 0} -}; - -static PyObject * -pygstminiobject_get_dict (PyGstMiniObject * self, void *closure) -{ - if (self->inst_dict == NULL) { - self->inst_dict = PyDict_New (); - if (self->inst_dict == NULL) - return NULL; - } - Py_INCREF (self->inst_dict); - return self->inst_dict; -} - -static PyObject * -pygstminiobject_get_refcount (PyGstMiniObject * self, void *closure) -{ - return PyInt_FromLong (GST_MINI_OBJECT_REFCOUNT_VALUE (self->obj)); -} - -static PyObject * -pygstminiobject_get_flags (PyGstMiniObject * self, void *closure) -{ - return PyInt_FromLong (GST_MINI_OBJECT_FLAGS (self->obj)); -} - -static PyGetSetDef pygstminiobject_getsets[] = { - {"__dict__", (getter) pygstminiobject_get_dict, (setter) 0}, - {"__grefcount__", (getter) pygstminiobject_get_refcount, (setter) 0,}, - {"flags", (getter) pygstminiobject_get_flags, (setter) 0,}, - {NULL, 0, 0} -}; - -PyTypeObject PyGstMiniObject_Type = { - PyObject_HEAD_INIT (NULL) - 0, /* ob_size */ - "gst.MiniObject", /* tp_name */ - sizeof (PyGstMiniObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor) pygstminiobject_dealloc, /* tp_dealloc */ - (printfunc) 0, /* tp_print */ - (getattrfunc) 0, /* tp_getattr */ - (setattrfunc) 0, /* tp_setattr */ - (cmpfunc) pygstminiobject_compare, /* tp_compare */ - (reprfunc) pygstminiobject_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc) pygstminiobject_hash, /* tp_hash */ - (ternaryfunc) 0, /* tp_call */ - (reprfunc) 0, /* tp_str */ - (getattrofunc) 0, /* tp_getattro */ - (setattrofunc) 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc) 0, /* tp_traverse */ - (inquiry) 0, /* tp_clear */ - (richcmpfunc) 0, /* tp_richcompare */ - offsetof (PyGstMiniObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc) 0, /* tp_iter */ - (iternextfunc) 0, /* tp_iternext */ - pygstminiobject_methods, /* tp_methods */ - 0, /* tp_members */ - pygstminiobject_getsets, /* tp_getset */ - (PyTypeObject *) 0, /* tp_base */ - (PyObject *) 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof (PyGstMiniObject, inst_dict), /* tp_dictoffset */ - (initproc) pygstminiobject_init, /* tp_init */ - (allocfunc) 0, /* tp_alloc */ - (newfunc) 0, /* tp_new */ - (freefunc) pygstminiobject_free, /* tp_free */ - (inquiry) 0, /* tp_is_gc */ - (PyObject *) 0, /* tp_bases */ -}; diff --git a/gst/pygstminiobject.h b/gst/pygstminiobject.h deleted file mode 100644 index 08a5304fce..0000000000 --- a/gst/pygstminiobject.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ - -#ifndef _PYGSTMINIOBJECT_H_ -#define _PYGSTMINIOBJECT_H_ - -#include - -#include -#include - -G_BEGIN_DECLS - -/* Work around bugs in PyGILState api fixed in 2.4.0a4 */ -#undef PYGIL_API_IS_BUGGY -#if PY_VERSION_HEX < 0x020400A4 -#define PYGIL_API_IS_BUGGY TRUE -#else -#define PYGIL_API_IS_BUGGY FALSE -#endif - - -void -pygstminiobject_register_class(PyObject *dict, const gchar *type_name, - GType gtype, PyTypeObject *type, - PyObject *bases); -void -pygstminiobject_register_wrapper(PyObject *self); - -void -pygst_miniobject_init(); - -#ifndef _INSIDE_PYGSTMINIOBJECT_ - - -#endif /* !_INSIDE_PYGSTMINIOBJECT_ */ - -G_END_DECLS - -#endif /* !_PYGSTMINIOBJECT_H_ */ diff --git a/gst/pygstvalue.c b/gst/pygstvalue.c deleted file mode 100644 index 60fff3afab..0000000000 --- a/gst/pygstvalue.c +++ /dev/null @@ -1,414 +0,0 @@ -/* gst-python - * Copyright (C) 2004 Andy Wingo - * - * 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: Andy Wingo - */ - -/* define this for all source files that don't run init_pygobject() - * before including pygobject.h */ -#define NO_IMPORT_PYGOBJECT - -#include "pygst-private.h" -#include "pygstvalue.h" - -static PyObject *gstvalue_class = NULL; -static PyObject *gstfourcc_class = NULL; -static PyObject *gstintrange_class = NULL; -static PyObject *gstdoublerange_class = NULL; -static PyObject *gstfraction_class = NULL; -static PyObject *gstfractionrange_class = NULL; - -/* helper function */ - -/* Finds the greatest common divisor. - * Returns 1 if none other found. - * This is Euclid's algorithm. */ -static long -my_gcd (long num, long denom) -{ - while (denom != 0) { - long temp = num; - - num = denom; - denom = temp % denom; - } - - return ABS (num); -} - -/** - * pygst_value_as_pyobject: - * @value: the GValue object. - * @copy_boxed: true if boxed values should be copied. - * - * This function creates/returns a Python wrapper object that - * represents the GValue passed as an argument. - * - * Returns: a PyObject representing the value. - */ -PyObject * -pygst_value_as_pyobject (const GValue * value, gboolean copy_boxed) -{ - PyObject *ret = pyg_value_as_pyobject (value, copy_boxed); - if (!ret) { - PyErr_Clear (); - if (GST_VALUE_HOLDS_FOURCC (value)) { - gchar str[5]; - g_snprintf (str, 5, "%" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (gst_value_get_fourcc (value))); - ret = PyObject_Call (gstfourcc_class, Py_BuildValue ("(s)", str), NULL); - } else if (GST_VALUE_HOLDS_INT_RANGE (value)) { - ret = PyObject_Call - (gstintrange_class, - Py_BuildValue ("ii", - gst_value_get_int_range_min (value), - gst_value_get_int_range_max (value)), NULL); - } else if (GST_VALUE_HOLDS_DOUBLE_RANGE (value)) { - ret = PyObject_Call - (gstdoublerange_class, - Py_BuildValue ("dd", - gst_value_get_double_range_min (value), - gst_value_get_double_range_max (value)), NULL); - } else if (GST_VALUE_HOLDS_LIST (value)) { - int i, len; - len = gst_value_list_get_size (value); - ret = PyList_New (len); - for (i = 0; i < len; i++) { - PyList_SetItem (ret, i, - pygst_value_as_pyobject - (gst_value_list_get_value (value, i), copy_boxed)); - } - } else if (GST_VALUE_HOLDS_ARRAY (value)) { - int i, len; - len = gst_value_array_get_size (value); - ret = PyTuple_New (len); - for (i = 0; i < len; i++) { - PyTuple_SetItem (ret, i, - pygst_value_as_pyobject - (gst_value_array_get_value (value, i), copy_boxed)); - } - } else if (GST_VALUE_HOLDS_FRACTION (value)) { - ret = PyObject_Call - (gstfraction_class, - Py_BuildValue ("ii", - gst_value_get_fraction_numerator (value), - gst_value_get_fraction_denominator (value)), NULL); - } else if (GST_VALUE_HOLDS_FRACTION_RANGE (value)) { - const GValue *min, *max; - min = gst_value_get_fraction_range_min (value); - max = gst_value_get_fraction_range_max (value); - ret = PyObject_Call - (gstfractionrange_class, - Py_BuildValue ("OO", - pygst_value_as_pyobject (min, copy_boxed), - pygst_value_as_pyobject (max, copy_boxed)), NULL); - } else if (GST_VALUE_HOLDS_BUFFER (value)) { - return pygstminiobject_new (gst_value_get_mini_object (value)); - } else { - gchar buf[256]; - g_snprintf (buf, 256, "unknown type: %s", - g_type_name (G_VALUE_TYPE (value))); - PyErr_SetString (PyExc_TypeError, buf); - } - } - - if (G_VALUE_TYPE (value) == G_TYPE_STRING) { - PyObject *u = NULL; - - /* FIXME: docs are not clear on whether this sets a python - exception when it fails */ - u = PyUnicode_FromEncodedObject (ret, "utf-8", NULL); - Py_DECREF (ret); - ret = u; - } - - return ret; -} - -#define VALUE_TYPE_CHECK(v, t) \ -G_STMT_START{\ -if (!G_VALUE_HOLDS (v, t)) {\ - gchar errbuf[256];\ - g_snprintf (errbuf, 256, "Could not convert %s to %s",\ - g_type_name (t), g_type_name (G_VALUE_TYPE (v)));\ - PyErr_SetString (PyExc_TypeError, errbuf);\ - return -1;\ -}}G_STMT_END - -gboolean -pygst_value_init_for_pyobject (GValue * value, PyObject * obj) -{ - GType t; - - if (obj == Py_None) { - PyErr_SetString (PyExc_TypeError, "value can't be None"); - return FALSE; - } - - if (!(t = pyg_type_from_object ((PyObject *) obj->ob_type))) { - if (PyObject_IsInstance (obj, gstvalue_class)) { - PyErr_Clear (); - if (PyObject_IsInstance (obj, gstfourcc_class)) - t = GST_TYPE_FOURCC; - else if (PyObject_IsInstance (obj, gstintrange_class)) - t = GST_TYPE_INT_RANGE; - else if (PyObject_IsInstance (obj, gstdoublerange_class)) - t = GST_TYPE_DOUBLE_RANGE; - else if (PyObject_IsInstance (obj, gstfraction_class)) - t = GST_TYPE_FRACTION; - else if (PyObject_IsInstance (obj, gstfractionrange_class)) - t = GST_TYPE_FRACTION_RANGE; - else { - PyErr_SetString (PyExc_TypeError, "Unexpected gst.Value instance"); - return FALSE; - } - } else if (PyObject_IsInstance (obj, (PyObject *) & PyGstMiniObject_Type)) { - PyErr_Clear (); - t = GST_TYPE_MINI_OBJECT; - } else if (PyTuple_Check (obj)) { - PyErr_Clear (); - t = GST_TYPE_ARRAY; - } else if (PyList_Check (obj)) { - PyErr_Clear (); - t = GST_TYPE_LIST; - } else if (PyUnicode_Check (obj)) { - /* unicode strings should be converted to UTF-8 */ - PyErr_Clear (); - t = G_TYPE_STRING; - } else { - /* pyg_type_from_object already set the error */ - return FALSE; - } - } - g_value_init (value, t); - return TRUE; -} - -static int -pygst_value_from_pyobject_internal (GValue * value, PyObject * obj) -{ - GType f = g_type_fundamental (G_VALUE_TYPE (value)); - - /* work around a bug in pygtk whereby pyg_value_from_pyobject claims success - for unknown fundamental types without actually doing anything */ - if (f < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST) - && pyg_value_from_pyobject (value, obj) == 0) { - return 0; - } else if (PyObject_IsInstance (obj, gstvalue_class)) { - PyErr_Clear (); - - if (PyObject_IsInstance (obj, gstfourcc_class)) { - PyObject *pystr; - gchar *str; - VALUE_TYPE_CHECK (value, GST_TYPE_FOURCC); - if (!(pystr = PyObject_GetAttrString (obj, "fourcc"))) - return -1; - if (!(str = PyString_AsString (pystr))) - return -1; - g_assert (strlen (str) == 4); - gst_value_set_fourcc (value, GST_STR_FOURCC (str)); - } else if (PyObject_IsInstance (obj, gstintrange_class)) { - PyObject *pyval; - long low, high; - VALUE_TYPE_CHECK (value, GST_TYPE_INT_RANGE); - if (!(pyval = PyObject_GetAttrString (obj, "low"))) - return -1; - low = PyInt_AsLong (pyval); - g_assert (G_MININT <= low && low <= G_MAXINT); - if (!(pyval = PyObject_GetAttrString (obj, "high"))) - return -1; - high = PyInt_AsLong (pyval); - g_assert (G_MININT <= high && high <= G_MAXINT); - gst_value_set_int_range (value, (int) low, (int) high); - } else if (PyObject_IsInstance (obj, gstdoublerange_class)) { - PyObject *pyval; - double low, high; - VALUE_TYPE_CHECK (value, GST_TYPE_DOUBLE_RANGE); - if (!(pyval = PyObject_GetAttrString (obj, "low"))) - return -1; - low = PyFloat_AsDouble (pyval); - if (!(pyval = PyObject_GetAttrString (obj, "high"))) - return -1; - high = PyFloat_AsDouble (pyval); - gst_value_set_double_range (value, low, high); - } else if (PyObject_IsInstance (obj, gstfraction_class)) { - PyObject *pyval; - long num, denom; - long gcd = 0; - VALUE_TYPE_CHECK (value, GST_TYPE_FRACTION); - if (!(pyval = PyObject_GetAttrString (obj, "num"))) - return -1; - num = PyInt_AsLong (pyval); - if ((num == -1) && PyErr_Occurred ()) - return -1; - g_assert (G_MININT <= num && num <= G_MAXINT); - if (!(pyval = PyObject_GetAttrString (obj, "denom"))) - return -1; - denom = PyInt_AsLong (pyval); - if ((denom == -1) && PyErr_Occurred ()) - return -1; - /* we need to reduce the values to be smaller than MAXINT */ - if ((gcd = my_gcd (num, denom))) { - num /= gcd; - denom /= gcd; - } - g_assert (G_MININT <= denom && denom <= G_MAXINT); - gst_value_set_fraction (value, (int) num, (int) denom); - } else if (PyObject_IsInstance (obj, gstfractionrange_class)) { - GValue low = { 0, }; - GValue high = { 0, }; - PyObject *pylow, *pyhigh; - - VALUE_TYPE_CHECK (value, GST_TYPE_FRACTION_RANGE); - if (!(pylow = PyObject_GetAttrString (obj, "low"))) - return -1; - if (!pygst_value_init_for_pyobject (&low, pylow)) - return -1; - if (pygst_value_from_pyobject (&low, pylow) != 0) - return -1; - - if (!(pyhigh = PyObject_GetAttrString (obj, "high"))) - return -1; - if (!pygst_value_init_for_pyobject (&high, pyhigh)) - return -1; - if (pygst_value_from_pyobject (&high, pyhigh) != 0) - return -1; - - gst_value_set_fraction_range (value, &low, &high); - } else { - gchar buf[256]; - gchar *str = PyString_AsString (PyObject_Repr (obj)); - g_snprintf (buf, 256, "Unknown gst.Value type: %s", str); - PyErr_SetString (PyExc_TypeError, buf); - return -1; - } - return 0; - } else if (PyObject_IsInstance (obj, (PyObject *) & PyGstMiniObject_Type)) { - VALUE_TYPE_CHECK (value, GST_TYPE_MINI_OBJECT); - gst_value_set_mini_object (value, pygstminiobject_get (obj)); - return 0; - } else if (PyTuple_Check (obj)) { - gint i, len; - PyErr_Clear (); - VALUE_TYPE_CHECK (value, GST_TYPE_ARRAY); - len = PyTuple_Size (obj); - for (i = 0; i < len; i++) { - PyObject *o; - GValue new = { 0, }; - o = PyTuple_GetItem (obj, i); - if (!pygst_value_init_for_pyobject (&new, o)) - return -1; - if (pygst_value_from_pyobject (&new, o) != 0) { - g_value_unset (&new); - return -1; - } - gst_value_array_append_value (value, &new); - g_value_unset (&new); - } - return 0; - } else if (PyList_Check (obj)) { - gint i, len; - PyErr_Clear (); - VALUE_TYPE_CHECK (value, GST_TYPE_LIST); - len = PyList_Size (obj); - for (i = 0; i < len; i++) { - PyObject *o; - GValue new = { 0, }; - o = PyList_GetItem (obj, i); - if (!pygst_value_init_for_pyobject (&new, o)) - return -1; - if (pygst_value_from_pyobject (&new, o) != 0) { - g_value_unset (&new); - return -1; - } - gst_value_list_append_value (value, &new); - g_value_unset (&new); - } - return 0; - } else { - return -1; - } -} - -/** - * pygst_value_from_pyobject: - * @value: the GValue object to store the converted value in. - * @obj: the Python object to convert. - * - * This function converts a Python object and stores the result in a - * GValue. The GValue must be initialised in advance with - * g_value_init(). If the Python object can't be converted to the - * type of the GValue, then an error is returned. - * - * Returns: 0 on success, -1 on error. - */ -int -pygst_value_from_pyobject (GValue * value, PyObject * obj) -{ - PyObject *v = NULL; - int res; - - /* Unicode objects should be converted to utf-8 strings */ - if (PyObject_TypeCheck (obj, &PyUnicode_Type)) { - - v = PyUnicode_AsUTF8String (obj); - obj = v; - } - - res = pygst_value_from_pyobject_internal (value, obj); - - if (v) { - Py_DECREF (obj); - } - - return res; -} - -#define NULL_CHECK(o) if (!o) goto err - -gboolean -pygst_value_init (void) -{ - PyObject *module, *dict; - - if ((module = PyImport_ImportModule ("gst")) == NULL) - return FALSE; - - dict = PyModule_GetDict (module); - - gstvalue_class = (PyObject *) PyDict_GetItemString (dict, "Value"); - NULL_CHECK (gstvalue_class); - gstfourcc_class = (PyObject *) PyDict_GetItemString (dict, "Fourcc"); - NULL_CHECK (gstfourcc_class); - gstintrange_class = (PyObject *) PyDict_GetItemString (dict, "IntRange"); - NULL_CHECK (gstintrange_class); - gstdoublerange_class = - (PyObject *) PyDict_GetItemString (dict, "DoubleRange"); - NULL_CHECK (gstdoublerange_class); - gstfraction_class = (PyObject *) PyDict_GetItemString (dict, "Fraction"); - NULL_CHECK (gstfraction_class); - gstfractionrange_class = - (PyObject *) PyDict_GetItemString (dict, "FractionRange"); - NULL_CHECK (gstfractionrange_class); - return TRUE; - -err: - PyErr_SetString (PyExc_ImportError, - "Failed to get GstValue classes from gst module"); - return FALSE; -} diff --git a/gst/pygstvalue.h b/gst/pygstvalue.h deleted file mode 100644 index a65f00be7d..0000000000 --- a/gst/pygstvalue.h +++ /dev/null @@ -1,29 +0,0 @@ -/* gst-python - * Copyright (C) 2004 Andy Wingo - * - * 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: Andy Wingo - */ - -#include -#include - - -PyObject *pygst_value_as_pyobject(const GValue *value, gboolean copy_boxed); -gboolean pygst_value_init_for_pyobject (GValue *value, PyObject *obj); -int pygst_value_from_pyobject(GValue *value, PyObject *obj); -gboolean pygst_value_init(void); diff --git a/gst/tag.defs b/gst/tag.defs deleted file mode 100644 index a9f492712e..0000000000 --- a/gst/tag.defs +++ /dev/null @@ -1,306 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object TagDemux - (in-module "Gst") - (parent "GstElement") - (c-name "GstTagDemux") - (gtype-id "GST_TYPE_TAG_DEMUX") -) - -;; Enumerations and flags ... - -(define-enum TagDemuxResult - (in-module "Gst") - (c-name "GstTagDemuxResult") - (gtype-id "GST_TYPE_TAG_DEMUX_RESULT") - (values - '("broken-tag" "GST_TAG_DEMUX_RESULT_BROKEN_TAG") - '("again" "GST_TAG_DEMUX_RESULT_AGAIN") - '("ok" "GST_TAG_DEMUX_RESULT_OK") - ) -) - -(define-enum TagImageType - (in-module "Gst") - (c-name "GstTagImageType") - (gtype-id "GST_TYPE_TAG_IMAGE_TYPE") - (values - '("none" "GST_TAG_IMAGE_TYPE_NONE") - '("undefined" "GST_TAG_IMAGE_TYPE_UNDEFINED") - '("front-cover" "GST_TAG_IMAGE_TYPE_FRONT_COVER") - '("back-cover" "GST_TAG_IMAGE_TYPE_BACK_COVER") - '("leaflet-page" "GST_TAG_IMAGE_TYPE_LEAFLET_PAGE") - '("medium" "GST_TAG_IMAGE_TYPE_MEDIUM") - '("lead-artist" "GST_TAG_IMAGE_TYPE_LEAD_ARTIST") - '("artist" "GST_TAG_IMAGE_TYPE_ARTIST") - '("conductor" "GST_TAG_IMAGE_TYPE_CONDUCTOR") - '("band-orchestra" "GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA") - '("composer" "GST_TAG_IMAGE_TYPE_COMPOSER") - '("lyricist" "GST_TAG_IMAGE_TYPE_LYRICIST") - '("recording-location" "GST_TAG_IMAGE_TYPE_RECORDING_LOCATION") - '("during-recording" "GST_TAG_IMAGE_TYPE_DURING_RECORDING") - '("during-performance" "GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE") - '("video-capture" "GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE") - '("fish" "GST_TAG_IMAGE_TYPE_FISH") - '("illustration" "GST_TAG_IMAGE_TYPE_ILLUSTRATION") - '("band-artist-logo" "GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO") - '("publisher-studio-logo" "GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO") - ) -) - - -;; From gsttagdemux.h - -(define-function demux_get_type - (c-name "gst_tag_demux_get_type") - (return-type "GType") -) - - - -;; From tag.h - -(define-function image_type_get_type - (c-name "gst_tag_image_type_get_type") - (return-type "GType") -) - -(define-function from_vorbis_tag - (c-name "gst_tag_from_vorbis_tag") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "vorbis_tag") - ) -) - -(define-function to_vorbis_tag - (c-name "gst_tag_to_vorbis_tag") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "gst_tag") - ) -) - -(define-function gst_vorbis_tag_add - (c-name "gst_vorbis_tag_add") - (return-type "none") - (parameters - '("GstTagList*" "list") - '("const-gchar*" "tag") - '("const-gchar*" "value") - ) -) - -(define-function to_vorbis_comments - (c-name "gst_tag_to_vorbis_comments") - (return-type "GList*") - (parameters - '("const-GstTagList*" "list") - '("const-gchar*" "tag") - ) -) - -(define-function list_from_vorbiscomment_buffer - (c-name "gst_tag_list_from_vorbiscomment_buffer") - (return-type "GstTagList*") - (parameters - '("const-GstBuffer*" "buffer") - '("const-guint8*" "id_data") - '("const-guint" "id_data_length") - '("gchar**" "vendor_string") - ) -) - -(define-method to_vorbiscomment_buffer - (of-object "GstTagList") - (c-name "gst_tag_list_to_vorbiscomment_buffer") - (return-type "GstBuffer*") - (parameters - '("const-guint8*" "id_data") - '("const-guint" "id_data_length") - '("const-gchar*" "vendor_string") - ) -) - -(define-function id3_genre_count - (c-name "gst_tag_id3_genre_count") - (return-type "guint") -) - -(define-function id3_genre_get - (c-name "gst_tag_id3_genre_get") - (return-type "const-gchar*") - (parameters - '("const-guint" "id") - ) -) - -(define-function list_new_from_id3v1 - (c-name "gst_tag_list_new_from_id3v1") - (return-type "GstTagList*") - (parameters - '("const-guint8*" "data") - ) -) - -(define-function from_id3_tag - (c-name "gst_tag_from_id3_tag") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "id3_tag") - ) -) - -(define-function from_id3_user_tag - (c-name "gst_tag_from_id3_user_tag") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "type") - '("const-gchar*" "id3_user_tag") - ) -) - -(define-function to_id3_tag - (c-name "gst_tag_to_id3_tag") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "gst_tag") - ) -) - -(define-method add_id3_image - (of-object "GstTagList") - (c-name "gst_tag_list_add_id3_image") - (return-type "gboolean") - (parameters - '("const-guint8*" "image_data") - '("guint" "image_data_len") - '("guint" "id3_picture_type") - ) -) - -(define-method to_exif_buffer - (of-object "GstTagList") - (c-name "gst_tag_list_to_exif_buffer") - (return-type "GstBuffer*") - (parameters - '("gint" "byte_order") - '("guint32" "base_offset") - ) -) - -(define-method to_exif_buffer_with_tiff_header - (of-object "GstTagList") - (c-name "gst_tag_list_to_exif_buffer_with_tiff_header") - (return-type "GstBuffer*") -) - -(define-function tag_list_from_exif_buffer - (c-name "gst_tag_list_from_exif_buffer") - (return-type "GstTagList*") - (parameters - '("const-GstBuffer*" "buffer") - '("gint" "byte_order") - '("guint32" "base_offset") - ) -) - -(define-function tag_list_from_exif_buffer_with_tiff_header - (c-name "gst_tag_list_from_exif_buffer_with_tiff_header") - (return-type "GstTagList*") - (parameters - '("const-GstBuffer*" "buffer") - ) -) - -(define-function parse_extended_comment - (c-name "gst_tag_parse_extended_comment") - (return-type "gboolean") - (parameters - '("const-gchar*" "ext_comment") - '("gchar**" "key") - '("gchar**" "lang") - '("gchar**" "value") - '("gboolean" "fail_if_no_key") - ) -) - -(define-function freeform_string_to_utf8 - (c-name "gst_tag_freeform_string_to_utf8") - (return-type "gchar*") - (parameters - '("const-gchar*" "data") - '("gint" "size") - '("const-gchar**" "env_vars") - ) -) - -(define-function image_data_to_image_buffer - (c-name "gst_tag_image_data_to_image_buffer") - (return-type "GstBuffer*") - (parameters - '("const-guint8*" "image_data") - '("guint" "image_data_len") - '("GstTagImageType" "image_type") - ) -) - -(define-function register_musicbrainz_tags - (c-name "gst_tag_register_musicbrainz_tags") - (return-type "none") -) - -(define-function get_language_codes - (c-name "gst_tag_get_language_codes") - (return-type "gchar**") -) - -(define-function get_language_name - (c-name "gst_tag_get_language_name") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "language_code") - ) -) - -(define-function get_language_code_iso_639_1 - (c-name "gst_tag_get_language_code_iso_639_1") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "lang_code") - ) -) - -(define-function get_language_code_iso_639_2B - (c-name "gst_tag_get_language_code_iso_639_2B") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "lang_code") - ) -) - -(define-function get_language_code_iso_639_2T - (c-name "gst_tag_get_language_code_iso_639_2T") - (return-type "const-gchar*") - (parameters - '("const-gchar*" "lang_code") - ) -) - -(define-function tag_list_from_xmp_buffer - (c-name "gst_tag_list_from_xmp_buffer") - (return-type "GstTagList*") - (parameters - '("const-GstBuffer*" "buffer") - ) -) - -(define-function tag_list_to_xmp_buffer - (c-name "gst_tag_list_to_xmp_buffer") - (return-type "GstBuffer*") - (parameters - '("const-GstTagList*" "taglist") - '("gboolean" "readonly") - ) -) - diff --git a/gst/tag.override b/gst/tag.override deleted file mode 100644 index 813c44d24a..0000000000 --- a/gst/tag.override +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 - * - * 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. - */ -%% -headers - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include "common.h" -#include "pygst.h" - -#include - -#include -#include -#include "pygstminiobject.h" -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/* Boonky define that allows for backwards compatibility with Python 2.4 */ -#if PY_VERSION_HEX < 0x02050000 -#define Py_ssize_t int -#endif - -%% -modulename gst.tag -%% -import gobject.GObject as PyGObject_Type -import gst.Object as PyGstObject_Type -import gst.Structure as PyGstStructure_Type -import gst.Element as PyGstElement_Type -import gst.Pad as PyGstPad_Type -import gst.Buffer as PyGstBuffer_Type -import gst.Message as PyGstMessage_Type -import gst.SystemClock as PyGstSystemClock_Type -import gst.BaseTransform as PyGstBaseTransform_Type -import gst.BaseSink as PyGstBaseSink_Type -%% -include - gstversion.override -%% -ignore-glob - _* - *init - *_free - *_get_type - -%% -override gst_tag_to_vorbis_comments -static PyObject * -_wrap_gst_tag_to_vorbis_comments(PyObject *self, PyObject *args, PyObject *kwargs) -{ - PyObject *py_taglist; - const GstTagList *taglist; - const gchar *tag; - - const GList *list; - const GList *l; - PyObject *py_list; - - if (!PyArg_ParseTuple(args, "Os", &py_taglist, &tag)) - return NULL; - - if (pyg_boxed_check(py_taglist, GST_TYPE_TAG_LIST)) - taglist = pyg_boxed_get(py_taglist, GstTagList); - else { - PyErr_SetString(PyExc_TypeError, "list should be a GstTagList"); - return NULL; - } - - - pyg_begin_allow_threads; - list = gst_tag_to_vorbis_comments (taglist, tag); - pyg_end_allow_threads; - - py_list = PyList_New(0); - - for (l = list; l; l = l->next) { - gchar *pair = (gchar *)l->data; - PyObject *py_pair = PyString_FromString(pair); - PyList_Append(py_list, py_pair); - Py_DECREF(py_pair); - } - return py_list; - -} diff --git a/gst/tagmodule.c b/gst/tagmodule.c deleted file mode 100644 index ec303fc1d5..0000000000 --- a/gst/tagmodule.c +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 Edward Hervey - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include -#include "pygst.h" - -void pytag_register_classes (PyObject * d); -void pytag_add_constants (PyObject * module, const gchar * strip_prefix); - -extern PyMethodDef pytag_functions[]; - -GST_DEBUG_CATEGORY (pygst_debug); /* for python code */ - -DL_EXPORT (void) -inittag (void) -{ - PyObject *m, *d; - - init_pygobject (); - pygst_init (); - /* Initialize tag library */ - gst_tag_register_musicbrainz_tags (); - - m = Py_InitModule ("tag", pytag_functions); - d = PyModule_GetDict (m); - - pytag_register_classes (d); - pytag_add_constants (m, "GST_"); - - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.tag"); - } -} diff --git a/gst/video.defs b/gst/video.defs deleted file mode 100644 index b4cf2fd808..0000000000 --- a/gst/video.defs +++ /dev/null @@ -1,425 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -(define-object VideoFilter - (in-module "Gst") - (parent "GstBaseTransform") - (c-name "GstVideoFilter") - (gtype-id "GST_TYPE_VIDEO_FILTER") -) - -(define-object VideoSink - (in-module "Gst") - (parent "GstBaseSink") - (c-name "GstVideoSink") - (gtype-id "GST_TYPE_VIDEO_SINK") -) - -;; Enumerations and flags ... - -(define-enum VideoFormat - (in-module "Gst") - (c-name "GstVideoFormat") - (gtype-id "GST_TYPE_VIDEO_FORMAT") - (values - '("unknown" "GST_VIDEO_FORMAT_UNKNOWN") - '("i420" "GST_VIDEO_FORMAT_I420") - '("yv12" "GST_VIDEO_FORMAT_YV12") - '("yuy2" "GST_VIDEO_FORMAT_YUY2") - '("uyvy" "GST_VIDEO_FORMAT_UYVY") - '("ayuv" "GST_VIDEO_FORMAT_AYUV") - '("rgbx" "GST_VIDEO_FORMAT_RGBx") - '("bgrx" "GST_VIDEO_FORMAT_BGRx") - '("xrgb" "GST_VIDEO_FORMAT_xRGB") - '("xbgr" "GST_VIDEO_FORMAT_xBGR") - '("rgba" "GST_VIDEO_FORMAT_RGBA") - '("bgra" "GST_VIDEO_FORMAT_BGRA") - '("argb" "GST_VIDEO_FORMAT_ARGB") - '("abgr" "GST_VIDEO_FORMAT_ABGR") - '("rgb" "GST_VIDEO_FORMAT_RGB") - '("bgr" "GST_VIDEO_FORMAT_BGR") - '("y41b" "GST_VIDEO_FORMAT_Y41B") - '("y42b" "GST_VIDEO_FORMAT_Y42B") - '("yvyu" "GST_VIDEO_FORMAT_YVYU") - '("y444" "GST_VIDEO_FORMAT_Y444") - '("v210" "GST_VIDEO_FORMAT_v210") - '("v216" "GST_VIDEO_FORMAT_v216") - '("nv12" "GST_VIDEO_FORMAT_NV12") - '("nv21" "GST_VIDEO_FORMAT_NV21") - '("gray8" "GST_VIDEO_FORMAT_GRAY8") - '("gray16-be" "GST_VIDEO_FORMAT_GRAY16_BE") - '("gray16-le" "GST_VIDEO_FORMAT_GRAY16_LE") - '("v308" "GST_VIDEO_FORMAT_v308") - '("y800" "GST_VIDEO_FORMAT_Y800") - '("y16" "GST_VIDEO_FORMAT_Y16") - '("rgb16" "GST_VIDEO_FORMAT_RGB16") - '("bgr16" "GST_VIDEO_FORMAT_BGR16") - '("rgb15" "GST_VIDEO_FORMAT_RGB15") - '("bgr15" "GST_VIDEO_FORMAT_BGR15") - '("uyvp" "GST_VIDEO_FORMAT_UYVP") - '("a420" "GST_VIDEO_FORMAT_A420") - '("rgb8-paletted" "GST_VIDEO_FORMAT_RGB8_PALETTED") - '("yuv9" "GST_VIDEO_FORMAT_YUV9") - '("yvu9" "GST_VIDEO_FORMAT_YVU9") - '("iyu1" "GST_VIDEO_FORMAT_IYU1") - ) -) - - -;; From gstvideofilter.h - -(define-function gst_video_filter_get_type - (c-name "gst_video_filter_get_type") - (return-type "GType") -) - - - -;; From gstvideosink.h - -(define-function gst_video_sink_get_type - (c-name "gst_video_sink_get_type") - (return-type "GType") -) - -(define-function video_sink_center_rect - (c-name "gst_video_sink_center_rect") - (return-type "none") - (parameters - '("GstVideoRectangle" "src") - '("GstVideoRectangle" "dst") - '("GstVideoRectangle*" "result") - '("gboolean" "scaling") - ) -) - - - -;; From video.h - -(define-function get_size - (c-name "gst_video_get_size") - (return-type "gboolean") - (parameters - '("GstPad*" "pad") - '("gint*" "width") - '("gint*" "height") - ) -) - -(define-function calculate_display_ratio - (c-name "gst_video_calculate_display_ratio") - (return-type "gboolean") - (parameters - '("guint*" "dar_n") - '("guint*" "dar_d") - '("guint" "video_width") - '("guint" "video_height") - '("guint" "video_par_n") - '("guint" "video_par_d") - '("guint" "display_par_n") - '("guint" "display_par_d") - ) -) - -(define-function format_parse_caps - (c-name "gst_video_format_parse_caps") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("GstVideoFormat*" "format") - '("int*" "width") - '("int*" "height") - ) -) - -(define-function format_parse_caps_interlaced - (c-name "gst_video_format_parse_caps_interlaced") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("gboolean*" "interlaced") - ) -) - -(define-function parse_caps_framerate - (c-name "gst_video_parse_caps_framerate") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("int*" "fps_n") - '("int*" "fps_d") - ) -) - -(define-function parse_caps_pixel_aspect_ratio - (c-name "gst_video_parse_caps_pixel_aspect_ratio") - (return-type "gboolean") - (parameters - '("GstCaps*" "caps") - '("int*" "par_n") - '("int*" "par_d") - ) -) - -(define-function parse_caps_color_matrix - (c-name "gst_video_parse_caps_color_matrix") - (return-type "const-char*") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-function parse_caps_chroma_site - (c-name "gst_video_parse_caps_chroma_site") - (return-type "const-char*") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-function video_parse_caps_palette - (c-name "gst_video_parse_caps_palette") - (return-type "GstBuffer*") - (parameters - '("GstCaps*" "caps") - ) -) - -(define-method new_caps - (of-object "GstVideoFormat") - (c-name "gst_video_format_new_caps") - (caller-owns-return #t) - (return-type "GstCaps*") - (parameters - '("int" "width") - '("int" "height") - '("int" "framerate_n") - '("int" "framerate_d") - '("int" "par_n") - '("int" "par_d") - ) -) - -(define-method new_caps_interlaced - (of-object "GstVideoFormat") - (c-name "gst_video_format_new_caps_interlaced") - (caller-owns-return #t) - (return-type "GstCaps*") - (parameters - '("int" "width") - '("int" "height") - '("int" "framerate_n") - '("int" "framerate_d") - '("int" "par_n") - '("int" "par_d") - '("gboolean" "interlaced") - ) -) - -(define-function format_from_fourcc - (c-name "gst_video_format_from_fourcc") - (return-type "GstVideoFormat") - (parameters - '("guint32" "fourcc") - ) -) - -(define-method to_fourcc - (of-object "GstVideoFormat") - (c-name "gst_video_format_to_fourcc") - (return-type "guint32") -) - -(define-method is_rgb - (of-object "GstVideoFormat") - (c-name "gst_video_format_is_rgb") - (return-type "gboolean") -) - -(define-method is_yuv - (of-object "GstVideoFormat") - (c-name "gst_video_format_is_yuv") - (return-type "gboolean") -) - -(define-method is_gray - (of-object "GstVideoFormat") - (c-name "gst_video_format_is_gray") - (return-type "gboolean") -) - -(define-method has_alpha - (of-object "GstVideoFormat") - (c-name "gst_video_format_has_alpha") - (return-type "gboolean") -) - -(define-method get_row_stride - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_row_stride") - (return-type "int") - (parameters - '("int" "component") - '("int" "width") - ) -) - -(define-method get_pixel_stride - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_pixel_stride") - (return-type "int") - (parameters - '("int" "component") - ) -) - -(define-method get_component_width - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_component_width") - (return-type "int") - (parameters - '("int" "component") - '("int" "width") - ) -) - -(define-method get_component_height - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_component_height") - (return-type "int") - (parameters - '("int" "component") - '("int" "height") - ) -) - -(define-method get_component_offset - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_component_offset") - (return-type "int") - (parameters - '("int" "component") - '("int" "width") - '("int" "height") - ) -) - -(define-method get_size - (of-object "GstVideoFormat") - (c-name "gst_video_format_get_size") - (return-type "int") - (parameters - '("int" "width") - '("int" "height") - ) -) - -(define-method convert - (of-object "GstVideoFormat") - (c-name "gst_video_format_convert") - (return-type "gboolean") - (parameters - '("int" "width") - '("int" "height") - '("int" "fps_n") - '("int" "fps_d") - '("GstFormat" "src_format") - '("gint64" "src_value") - '("GstFormat" "dest_format") - '("gint64*" "dest_value") - ) -) - -(define-function event_new_still_frame - (c-name "gst_video_event_new_still_frame") - (return-type "GstEvent*") - (parameters - '("gboolean" "in_still") - ) -) - -(define-function event_parse_still_frame - (c-name "gst_video_event_parse_still_frame") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("gboolean*" "in_still") - ) -) -(define-function video_convert_frame - (c-name "gst_video_convert_frame") - (return-type "GstBuffer*") - (parameters - '("GstBuffer*" "buf") - '("const-GstCaps*" "to_caps") - '("GstClockTime" "timeout") - '("GError**" "error") - ) -) - -(define-function video_convert_frame_async - (c-name "gst_video_convert_frame_async") - (return-type "none") - (parameters - '("GstBuffer*" "buf") - '("const-GstCaps*" "to_caps") - '("GstClockTime" "timeout") - '("GstVideoConvertFrameCallback" "callback") - '("gpointer" "user_data") - '("GDestroyNotify" "destroy_notify") - ) -) - -(define-function event_new_downstream_force_key_unit - (c-name "gst_video_event_new_downstream_force_key_unit") - (return-type "GstEvent*") - (parameters - '("GstClockTime" "timestamp") - '("GstClockTime" "streamtime") - '("GstClockTime" "runningtime") - '("gboolean" "all_headers") - '("guint" "count") - ) -) - -(define-function event_parse_downstream_force_key_unit - (c-name "gst_video_event_parse_downstream_force_key_unit") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("GstClockTime*" "timestamp") - '("GstClockTime*" "streamtime") - '("GstClockTime*" "runningtime") - '("gboolean*" "all_headers") - '("guint*" "count") - ) -) - -(define-function event_new_upstream_force_key_unit - (c-name "gst_video_event_new_upstream_force_key_unit") - (return-type "GstEvent*") - (parameters - '("GstClockTime" "running_time") - '("gboolean" "all_headers") - '("guint" "count") - ) -) - -(define-function event_parse_upstream_force_key_unit - (c-name "gst_video_event_parse_upstream_force_key_unit") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - '("GstClockTime*" "running_time") - '("gboolean*" "all_headers") - '("guint*" "count") - ) -) - -(define-function event_is_force_key_unit - (c-name "gst_video_event_is_force_key_unit") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) -) diff --git a/gst/video.override b/gst/video.override deleted file mode 100644 index d59d6a78fa..0000000000 --- a/gst/video.override +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 - * - * 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. - */ -%% -headers - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include "common.h" -#include "pygst.h" - -#include - -#include -#include -#include -#include "pygstminiobject.h" -GST_DEBUG_CATEGORY_EXTERN (pygst_debug); -#define GST_CAT_DEFAULT pygst_debug - -/* Boonky define that allows for backwards compatibility with Python 2.4 */ -#if PY_VERSION_HEX < 0x02050000 -#define Py_ssize_t int -#endif - -%% -modulename gst.video -%% -import gobject.GObject as PyGObject_Type -import gst.Object as PyGstObject_Type -import gst.Structure as PyGstStructure_Type -import gst.Element as PyGstElement_Type -import gst.Pad as PyGstPad_Type -import gst.Buffer as PyGstBuffer_Type -import gst.Message as PyGstMessage_Type -import gst.SystemClock as PyGstSystemClock_Type -import gst.BaseTransform as PyGstBaseTransform_Type -import gst.BaseSink as PyGstBaseSink_Type -import gst.Event as PyGstEvent_Type -%% -include - gstversion.override -%% -ignore-glob - _* - *init - *_free - *_get_type diff --git a/gst/videomodule.c b/gst/videomodule.c deleted file mode 100644 index ebf677fa99..0000000000 --- a/gst/videomodule.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2008 Edward Hervey - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include -#include -#include -#include "pygst.h" - -void pyvideo_register_classes (PyObject * d); -void pyvideo_add_constants (PyObject * module, const gchar * strip_prefix); - -extern PyMethodDef pyvideo_functions[]; - -GST_DEBUG_CATEGORY (pygst_debug); /* for python code */ - -DL_EXPORT (void) -initvideo (void) -{ - PyObject *gst G_GNUC_UNUSED; - PyObject *m, *d; - - init_pygobject (); - gst = pygst_init (); - - m = Py_InitModule ("video", pyvideo_functions); - d = PyModule_GetDict (m); - - pyvideo_register_classes (d); - pyvideo_add_constants (m, "GST_"); - - if (PyErr_Occurred ()) { - PyErr_Print (); - Py_FatalError ("can't initialize module gst.video"); - } -} diff --git a/gst/xoverlay.defs b/gst/xoverlay.defs deleted file mode 100644 index db7072d323..0000000000 --- a/gst/xoverlay.defs +++ /dev/null @@ -1,53 +0,0 @@ -;; -*- scheme -*- -; object definitions ... -;; Enumerations and flags ... - -(define-interface XOverlay - (in-module "Gst") - (c-name "GstXOverlay") - (gtype-id "GST_TYPE_X_OVERLAY") -) - -;; From /opt/gnome/include/gstreamer-0.7/gst/xoverlay/xoverlay.h - -(define-method set_xwindow_id - (of-object "GstXOverlay") - (c-name "gst_x_overlay_set_xwindow_id") - (return-type "none") - (parameters - '("gulong" "xwindow_id") - ) -) - -(define-method set_render_rectangle - (of-object "GstXOverlay") - (c-name "gst_x_overlay_set_render_rectangle") - (return-type "gboolean") - (parameters - '("gint" "x") - '("gint" "y") - '("gint" "width") - '("gint" "height") - ) -) - -(define-method expose - (of-object "GstXOverlay") - (c-name "gst_x_overlay_expose") - (return-type "none") -) - -(define-method got_xwindow_id - (of-object "GstXOverlay") - (c-name "gst_x_overlay_got_xwindow_id") - (return-type "none") - (parameters - '("gulong" "xwindow_id") - ) -) - -(define-method prepare_xwindow_id - (of-object "GstXOverlay") - (c-name "gst_x_overlay_prepare_xwindow_id") - (return-type "none") -) \ No newline at end of file diff --git a/gst/xoverlay.override b/gst/xoverlay.override deleted file mode 100644 index dd382e7655..0000000000 --- a/gst/xoverlay.override +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 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. - * - */ -%% -headers - -#include diff --git a/gstlibtoolimporter.py b/gstlibtoolimporter.py deleted file mode 100644 index 4b08de4804..0000000000 --- a/gstlibtoolimporter.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- Mode: Python -*- -# vi:si:et:sw=4:sts=4:ts=4 -# -# gst-python -# Copyright (C) 2009 Alessandro Decina -# -# 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: Alessandro Decina - -# importer for uninstalled setup, see PEP -# http://www.python.org/dev/peps/pep-0302/ - -import os -import sys -import imp - -class Loader(object): - def __init__(self, fileobj, filename, description): - self.fileobj = fileobj - self.filename = filename - self.description = description - - def find_real_filename(self): - dlname = None - installed = False - for line in self.fileobj: - if len(line) > 7 and line[:7] == 'dlname=': - dlname = line[8:-2] - elif len(line) > 10 and line[:10] == 'installed=': - installed = line[10:-1] == 'yes' - - if not dlname: - return None - - if installed or os.path.dirname(self.filename).endswith('.libs'): - filename = os.path.join(os.path.dirname(self.filename), dlname) - else: - filename = os.path.join(os.path.dirname(self.filename), '.libs', dlname) - - return filename - - def load_module(self, name): - try: - module = sys.modules[name] - self.fileobj.close() - - return module - except KeyError: - pass - - filename = self.find_real_filename() - self.fileobj.close() - if filename is None: - raise ImportError("No module named %s" % name) - - fileobj = file(filename, 'rb') - - module = imp.new_module(name) - sys.modules[name] = module - - imp.load_module(name, fileobj, filename, self.description) - fileobj.close() - - return module - -class Importer(object): - def find_module(self, name, path=None): - if path is None: - path = sys.path - - for directory in path: - fileobj, filename, description = self.find_libtool_module(name, directory) - if fileobj is not None: - return Loader(fileobj, filename, description) - - return None - - def find_libtool_module(self, name, directory): - name = name.split(".")[-1] - absname = os.path.join(directory, name) - for suffix in ('.la', '.module.la'): - filename = absname + suffix - try: - fileobj = file(filename, 'rb') - except IOError: - continue - - return fileobj, filename, (suffix, 'rb', imp.C_EXTENSION) - - return None, None, None - -importer = Importer() - -def install(): - sys.meta_path.append(importer) - -def uninstall(): - sys.meta_path.remove(importer) diff --git a/gstltihooks.py b/gstltihooks.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/gstoptionmodule.c b/gstoptionmodule.c deleted file mode 100644 index 2e9009bfb4..0000000000 --- a/gstoptionmodule.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; ; c-file-style: "k&r"; c-basic-offset: 4 -*- */ -/* gst-python - * Copyright (C) 2007 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: Johan Dahlin - */ - -#include -#include -#include - -static PyObject * -_wrap_gstoption_get_group (PyObject *self) -{ - GOptionGroup *option_group; - - option_group = gst_init_get_option_group(); - return pyg_option_group_new(option_group); -} - -static PyMethodDef pygstoption_functions[] = { - { "get_group", (PyCFunction)_wrap_gstoption_get_group, METH_NOARGS, NULL }, - { NULL, NULL, 0, NULL } -}; - -DL_EXPORT(void) -initgstoption (void) -{ - init_pygobject (); - - if (!g_thread_supported ()) - g_thread_init (NULL); - - Py_InitModule ("gstoption", pygstoption_functions); -} diff --git a/pkgconfig/.gitignore b/pkgconfig/.gitignore deleted file mode 100644 index 2f7735b5e6..0000000000 --- a/pkgconfig/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -*.pc diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am deleted file mode 100644 index e11e4cdc8c..0000000000 --- a/pkgconfig/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -### all of the standard pc files we need to generate -pcfiles = \ - gst-python-@GST_MAJORMINOR@.pc - -pcfiles_uninstalled = \ - gst-python-@GST_MAJORMINOR@-uninstalled.pc - -all-local: $(pcfiles) $(pcfiles_uninstalled) - -cp_verbose = $(cp_verbose_$(V)) -cp_verbose_ = $(cp_verbose_$(AM_DEFAULT_VERBOSITY)) -cp_verbose_0 = @echo " CP $@"; - -### how to generate pc files -$(pcfiles): %-@GST_MAJORMINOR@.pc: %.pc - $(cp_verbose_0)cp $< $@ -$(pcfiles_uninstalled): %-@GST_MAJORMINOR@-uninstalled.pc: %-uninstalled.pc - $(cp_verbose_0)cp $< $@ - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(pcfiles) - -EXTRA_DIST = \ - gst-python.pc.in \ - gst-python-uninstalled.pc.in - -CLEANFILES = $(pcfiles) $(pcfiles_uninstalled) diff --git a/pkgconfig/gst-python-uninstalled.pc.in b/pkgconfig/gst-python-uninstalled.pc.in deleted file mode 100644 index 13168b2713..0000000000 --- a/pkgconfig/gst-python-uninstalled.pc.in +++ /dev/null @@ -1,16 +0,0 @@ -# the standard variables don't make sense for an uninstalled copy -#prefix= -#exec_prefix= -#datadir=${pcfiledir}/.. -pyexecdir=${pcfiledir}/.. - -# same here. Useful when calling the code generator in addon packages. -pygstincludedir=@abs_top_builddir@ -#defsdir=${datadir}/gst-python/@GST_MAJORMINOR@/defs -#codegendir=${datadir}/pygst/0.10/codegen - -Name: gst-python uninstalled -Description: Python bindings for GStreamer, not installed -Requires: pygobject-2.0, gstreamer-@GST_MAJORMINOR@ -Version: @VERSION@ -Cflags: -I${pygstincludedir} diff --git a/pkgconfig/gst-python.pc.in b/pkgconfig/gst-python.pc.in deleted file mode 100644 index 4c5e1f11d6..0000000000 --- a/pkgconfig/gst-python.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -datadir=@datadir@ -pyexecdir=@pyexecdir@ - -# same here. Useful when calling the code generator in addon packages. -pygstincludedir=@includedir@/gstreamer-@GST_MAJORMINOR@ -defsdir=${datadir}/gst-python/@GST_MAJORMINOR@/defs -codegendir=${datadir}/pygst/0.10/codegen - -Name: gst-python -Description: Python bindings for GStreamer -Requires: pygobject-2.0, gstreamer-@GST_MAJORMINOR@ -Version: @VERSION@ -Cflags: -I${pygstincludedir} diff --git a/plugin/Makefile.am b/plugin/Makefile.am deleted file mode 100644 index d4a42c0bda..0000000000 --- a/plugin/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -plugin_LTLIBRARIES = libgstpython.la - -INCLUDES = $(PYGOBJECT_CFLAGS) $(GST_CFLAGS)\ - -DPYTHON_VERSION=\"$(PYTHON_VERSION)\" \ - -DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" \ - -DPY_LIB_SUFFIX=$(PYTHON_LIB_SUFFIX) \ - $(PYTHON_INCLUDES) - -libgstpython_la_SOURCES = gstpythonplugin.c -libgstpython_la_LDFLAGS = -module -avoid-version -libgstpython_la_LIBADD = $(GST_LIBS) diff --git a/plugin/gstpythonplugin.c b/plugin/gstpythonplugin.c deleted file mode 100644 index 2a08d193d4..0000000000 --- a/plugin/gstpythonplugin.c +++ /dev/null @@ -1,426 +0,0 @@ -/* gst-python - * Copyright (C) 2009 Edward Hervey - * 2005 Benjamin Otte - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* include this first, before NO_IMPORT_PYGOBJECT is defined */ -#include -#include -#include - -void *_PyGstElement_Type; - -GST_DEBUG_CATEGORY_STATIC (pyplugindebug); -#define GST_CAT_DEFAULT pyplugindebug - -#define GST_ORIGIN "http://gstreamer.freedesktop.org" - -static PyObject *element; - -static inline gboolean -np_init_pygobject (void) -{ - gboolean res = FALSE; - PyObject *gobject = NULL; - PyObject *main_module = NULL; - PyObject *mdict = NULL; - PyObject *pygtk = NULL; - PyObject *cobject; - - pygtk = PyImport_ImportModule ("pygtk"); - if (pygtk == NULL) { - PyErr_Print (); - GST_WARNING ("could not import pygtk"); - goto beach; - } - - if (!(PyObject_CallMethod (pygtk, "require", "s", "2.0"))) { - GST_WARNING ("could not run pygtk.require"); - PyErr_Print (); - goto beach; - } - - gobject = PyImport_ImportModule ("gobject"); - if (gobject == NULL) { - PyErr_Print (); - GST_WARNING ("could not import gobject"); - goto beach; - } - - main_module = PyImport_AddModule ("__main__"); - mdict = PyModule_GetDict (gobject); - - cobject = PyMapping_GetItemString (mdict, "_PyGObject_API"); - if (cobject == NULL) { - GST_WARNING ("could not find _PyGObject_API"); - goto beach; - } - - _PyGObject_API = - (struct _PyGObject_Functions *) PyCObject_AsVoidPtr (cobject); - if (_PyGObject_API == NULL) { - PyErr_Print (); - GST_WARNING ("_PyGObject_API is not a valid CObject"); - goto beach; - } - - if (!(PyObject_CallMethod (gobject, "threads_init", NULL, NULL))) { - PyErr_Print (); - GST_WARNING ("could not initialize threads"); - goto beach; - } - - res = TRUE; - -beach: - Py_XDECREF (pygtk); - Py_XDECREF (gobject); - - return res; -} - -static gboolean -gst_python_plugin_load_file (GstPlugin * plugin, const char *name) -{ - PyObject *main_module, *main_locals; - PyObject *elementfactory; - int pos = 0; - GType gtype; - PyObject *module; - const gchar *facname; - guint rank; - PyObject *class; - - GST_DEBUG ("loading plugin %s", name); - - main_module = PyImport_AddModule ("__main__"); - if (main_module == NULL) { - GST_WARNING ("Could not get __main__, ignoring plugin %s", name); - PyErr_Print (); - PyErr_Clear (); - return FALSE; - } - - main_locals = PyModule_GetDict (main_module); - module = - PyImport_ImportModuleEx ((char *) name, main_locals, main_locals, NULL); - if (!module) { - GST_DEBUG ("Could not load module, ignoring plugin %s", name); - PyErr_Print (); - PyErr_Clear (); - return FALSE; - } - - /* Get __gstelementfactory__ from file */ - elementfactory = PyObject_GetAttrString (module, "__gstelementfactory__"); - if (!elementfactory) { - GST_DEBUG ("python file doesn't contain __gstelementfactory__"); - PyErr_Clear (); - return FALSE; - } - - /* parse tuple : name, rank, gst.ElementClass */ - if (!PyArg_ParseTuple (elementfactory, "sIO", &facname, &rank, &class)) { - GST_WARNING ("__gstelementfactory__ isn't correctly formatted"); - PyErr_Print (); - PyErr_Clear (); - Py_DECREF (elementfactory); - return FALSE; - } - - if (!(PyObject_IsSubclass (class, (PyObject *) _PyGstElement_Type))) { - GST_WARNING ("the class provided isn't a subclass of gst.Element"); - PyErr_Print (); - PyErr_Clear (); - Py_DECREF (elementfactory); - Py_DECREF (class); - return FALSE; - } - - GST_LOG ("Valid plugin"); - Py_DECREF (elementfactory); - - return gst_element_register (plugin, facname, rank, - pyg_type_from_object (class)); -} - -static gboolean -gst_python_load_directory (GstPlugin * plugin, gchar * path) -{ - GST_LOG ("Checking for python plugins in %s", path); - GDir *dir; - const gchar *file; - GError *error = NULL; - gboolean ret = TRUE; - - dir = g_dir_open (path, 0, &error); - if (!dir) { - /*retval should probably be depending on error, but since we ignore it... */ - GST_WARNING ("Couldn't open Python plugin dir: %s", error->message); - g_error_free (error); - return FALSE; - } - while ((file = g_dir_read_name (dir))) { - /* FIXME : go down in subdirectories */ - if (g_str_has_suffix (file, ".py")) { - gsize len = strlen (file) - 3; - gchar *name = g_strndup (file, len); - ret &= gst_python_plugin_load_file (plugin, name); - g_free (name); - } - } - return TRUE; -} - -static gboolean -gst_python_plugin_load (GstPlugin * plugin) -{ - PyObject *sys_path; - const gchar *plugin_path; - gboolean ret = TRUE; - - sys_path = PySys_GetObject ("path"); - - /* Mimic the order in which the registry is checked in core */ - - /* 1. check env_variable GST_PLUGIN_PATH */ - plugin_path = g_getenv ("GST_PLUGIN_PATH"); - if (plugin_path) { - char **list; - int i; - - GST_DEBUG ("GST_PLUGIN_PATH set to %s", plugin_path); - list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); - for (i = 0; list[i]; i++) { - gchar *sysdir = g_build_filename (list[i], "python", NULL); - PyList_Insert (sys_path, 0, PyString_FromString (sysdir)); - gst_python_load_directory (plugin, sysdir); - g_free (sysdir); - } - - g_strfreev (list); - } - - /* 2. Check for GST_PLUGIN_SYSTEM_PATH */ - plugin_path = g_getenv ("GST_PLUGIN_SYSTEM_PATH"); - if (plugin_path == NULL) { - char *home_plugins; - - /* 2.a. Scan user and system-wide plugin directory */ - GST_DEBUG ("GST_PLUGIN_SYSTEM_PATH not set"); - - /* plugins in the user's home directory take precedence over - * system-installed ones */ - home_plugins = g_build_filename (g_get_home_dir (), - ".gstreamer-" GST_MAJORMINOR, "plugins", "python", NULL); - PyList_Insert (sys_path, 0, PyString_FromString (home_plugins)); - gst_python_load_directory (plugin, home_plugins); - g_free (home_plugins); - - /* add the main (installed) library path */ - PyList_Insert (sys_path, 0, PyString_FromString (PLUGINDIR "/python")); - gst_python_load_directory (plugin, PLUGINDIR "/python"); - } else { - gchar **list; - gint i; - - /* 2.b. Scan GST_PLUGIN_SYSTEM_PATH */ - GST_DEBUG ("GST_PLUGIN_SYSTEM_PATH set to %s", plugin_path, plugin_path); - list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); - for (i = 0; list[i]; i++) { - gchar *sysdir; - - sysdir = g_build_filename (list[i], "python", NULL); - - PyList_Insert (sys_path, 0, PyString_FromString (sysdir)); - gst_python_load_directory (plugin, sysdir); - g_free (sysdir); - } - g_strfreev (list); - } - - - return ret; -} - -/** - *pygst_require: - * @version: the version required - * - * Checks if the pygst/gst python modules are available. - * Requests the specified version. - * - * Returns: the gst-python module, or NULL if there was an error. - */ - -static PyObject * -pygst_require (gchar * version) -{ - PyObject *pygst, *gst; - PyObject *require; - PyObject *modules; - gboolean doupdate = TRUE; - const gchar *regupd; - - modules = PySys_GetObject ("modules"); - /* Try to see if 'gst' is already imported */ - if (!(gst = PyMapping_GetItemString (modules, "gst"))) { - PyErr_Clear (); - - /* if not, see if 'pygst' was already imported. If so, we assume that - * 'pygst.require' has already been called. */ - if (!(pygst = PyMapping_GetItemString (modules, "pygst"))) { - PyErr_Clear (); - - if (!(pygst = PyImport_ImportModule ("pygst"))) { - GST_ERROR ("the pygst module is not available!"); - goto error; - } - - if (!(PyObject_CallMethod (pygst, "require", "s", version))) { - GST_ERROR ("the required version, %s, of gst-python is not available!", - version); - Py_DECREF (pygst); - goto error; - } - } - - /* We don't want the registry to be loaded when we import gst */ - if ((regupd = g_getenv ("GST_REGISTRY_UPDATE")) - && (!strcmp (regupd, "no"))) - doupdate = FALSE; - g_setenv ("GST_REGISTRY_UPDATE", "no", TRUE); - - if (!(gst = PyImport_ImportModule ("gst"))) { - GST_ERROR ("couldn't import the gst module"); - Py_DECREF (pygst); - if (doupdate) - g_unsetenv ("GST_REGISTRY_UPDATE"); - goto error; - } - } - - if (doupdate) - g_unsetenv ("GST_REGISTRY_UPDATE"); - -#define IMPORT(x, y) \ - _PyGst##x##_Type = (void *)PyObject_GetAttrString(gst, y); \ - if (_PyGst##x##_Type == NULL) { \ - PyErr_Print(); \ - return NULL; \ - } - IMPORT (Element, "Element"); - - return gst; - -error: - { - PyErr_Print (); - PyErr_Clear (); - return NULL; - } -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - PyGILState_STATE state; - PyObject *gst, *dict, *pyplugin; - gboolean we_initialized = FALSE; - GModule *libpython; - gpointer has_python = NULL; - - GST_DEBUG_CATEGORY_INIT (pyplugindebug, "pyplugin", 0, - "Python plugin loader"); - - gst_plugin_add_dependency_simple (plugin, - "HOME/.gstreamer-0.10/plugins/python:GST_PLUGIN_SYSTEM_PATH/python:GST_PLUGIN_PATH/python", - PLUGINDIR "/python:HOME/.gstreamer-0.10/plugins/python:" - "GST_PLUGIN_SYSTEM_PATH/python:GST_PLUGIN_PATH/python", NULL, - GST_PLUGIN_DEPENDENCY_FLAG_NONE); - - GST_LOG ("Checking to see if libpython is already loaded"); - g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LOCAL), "_Py_NoneStruct", - &has_python); - if (has_python) { - GST_LOG ("libpython is already loaded"); - } else { - GST_LOG ("loading libpython"); - libpython = - g_module_open (PY_LIB_LOC "/libpython" PYTHON_VERSION "." - PY_LIB_SUFFIX, 0); - if (!libpython) { - GST_WARNING ("Couldn't g_module_open libpython. Reason: %s", - g_module_error ()); - return FALSE; - } - } - - if (!Py_IsInitialized ()) { - GST_LOG ("python wasn't initialized"); - /* set the correct plugin for registering stuff */ - Py_Initialize (); - we_initialized = TRUE; - } else { - GST_LOG ("python was already initialized"); - state = PyGILState_Ensure (); - } - - GST_LOG ("initializing pygobject"); - if (!np_init_pygobject ()) { - GST_WARNING ("pygobject initialization failed"); - return FALSE; - } - - if (!(gst = pygst_require ("0.10"))) { - return FALSE; - } - - if (we_initialized) { - pyplugin = pygobject_new (G_OBJECT (plugin)); - if (!pyplugin || PyModule_AddObject (gst, "__plugin__", pyplugin) != 0) { - g_warning ("Couldn't set plugin"); - Py_DECREF (pyplugin); - } - } - - dict = PyModule_GetDict (gst); - if (!dict) { - GST_ERROR ("no dict?!"); - return FALSE; - } - - gst_python_plugin_load (plugin); - - if (we_initialized) { - /* We need to release the GIL since we're going back to C land */ - PyEval_SaveThread (); - } else - PyGILState_Release (state); - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "python", - "loader for plugins written in python", - plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_ORIGIN) diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 0ab63775e8..17f12aed79 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,23 +1,4 @@ -INCLUDES = \ - $(PYTHON_INCLUDES) \ - $(PYGOBJET_CFLAGS) \ - $(PYGST_CFLAGS) \ - $(GST_CFLAGS) - -noinst_LTLIBRARIES = testhelper.la -linked_LIBS = testhelper.la - -testhelper_la_LDFLAGS = -module -avoid-version -testhelper_la_LIBADD = $(GLIB_LIBS) -testhelper_la_CFLAGS = $(PYGOBJECT_CFLAGS) -testhelper_la_SOURCES = \ - testhelpermodule.c \ - test-object.c - # This is a hack to make sure a shared library is built -testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) - tests = \ test_adapter.py \ test_audio.py \ @@ -39,16 +20,6 @@ tests = \ test_pbutils.py \ test_gst.py -check-local: testhelper.la - @PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py - @PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py - @rm -fr *.pyc - -check-verbose: testhelper.la - @VERBOSE=yes PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py - @VERBOSE=yes PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py - @rm -fr *.pyc - EXTRA_DIST = $(tests) common.py cleanup.py runtests.py test-object.h python.supp gstpython.supp if HAVE_VALGRIND @@ -63,7 +34,7 @@ endif GSTSUPP = $(top_srcdir)/common/gst.supp PYTHONSUPP = $(top_srcdir)/testsuite/python.supp GSTPYTHONSUPP = $(top_srcdir)/testsuite/gstpython.supp -TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) LC_ALL=C +TESTS_ENVIRONMENT = LC_ALL=C # gdb any given test_x.py by running make test_x.py.gdb %.gdb: % @@ -110,14 +81,13 @@ TESTS_ENVIRONMENT = PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$ @rm valgrind.log %.check: % - @PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py - @PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py $* + $(PYTHON) $(srcdir)/cleanup.py + $(PYTHON) $(srcdir)/runtests.py $* @rm -fr *.pyc %.forever: % - @PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/cleanup.py + $(srcdir)/cleanup.py @while true; do \ - PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) \ $(PYTHON) $(srcdir)/runtests.py $* || break; done @rm -fr *.pyc