From: David I. L. <dl...@us...> - 2003-10-10 04:21:37
|
CVS Root: /cvsroot/gstreamer Module: gst-python Changes by: dlehn Date: Thu Oct 09 2003 21:21:34 PDT Log message: Mass change to support compiling for both 0.6 and 0.7. Common support is now in common.{defs,override,c,h}. Specific version support is in {0.6,0.7}.{defs,override,c,h}. The common and version specific files are merged and/or used as needed. common.override: add gst_version Modified files: . : configure.ac gstreamer : Makefile.am Added files: gstreamer : 0.6.c 0.6.defs 0.6.h 0.6.override 0.7.c 0.7.defs 0.7.h 0.7.override arg-types.py common.c common.defs common.h common.override Removed files: gstreamer : gstreamer-arg-types.py gstreamer-extra.defs gstreamer-fixes.c gstreamer-fixes.h gstreamer.override Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/configure.ac.diff?r1=1.18&r2=1.19 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.6.c?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.6.defs?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.6.h?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.6.override?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.7.c?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.7.defs?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.7.h?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/0.7.override?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/Makefile.am.diff?r1=1.10&r2=1.11 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/arg-types.py?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/common.c?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/common.defs?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/common.h?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/common.override?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/gstreamer-arg-types.py http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/gstreamer-extra.defs http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/gstreamer-fixes.c http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/gstreamer-fixes.h http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gstreamer/gstreamer.override ====Begin Diffs==== Index: configure.ac =================================================================== RCS file: /cvsroot/gstreamer/gst-python/configure.ac,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- configure.ac 9 Oct 2003 19:59:23 -0000 1.18 +++ configure.ac 10 Oct 2003 04:21:21 -0000 1.19 @@ -40,23 +40,18 @@ fi AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) -dnl Only support 0.6 in 0.1.0. Remove this and enable code below for 0.7. -GST_MAJORMINOR=0.6 +dnl check for GStreamer +dnl start with 0.7 +GST_MAJORMINOR=0.7 PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ, HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) -dnl check for GStreamer -dnl start with 0.7 -dnl GST_MAJORMINOR=0.7 -dnl PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ, -dnl HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) -dnl dnl try 0.6 -dnl if test "x$HAVE_GSTREAMER" = "xno"; then -dnl GST_MAJORMINOR=0.6 -dnl PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ, -dnl HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) -dnl fi +if test "x$HAVE_GSTREAMER" = "xno"; then + GST_MAJORMINOR=0.6 + PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ, + HAVE_GSTREAMER=yes,HAVE_GSTREAMER=no) +fi dnl Give error and exit if we don't have gstreamer if test "x$HAVE_GSTREAMER" = "xno"; then @@ -66,6 +61,8 @@ AC_SUBST(GST_LIBS) AC_SUBST(GST_CFLAGS) AC_SUBST(GST_MAJORMINOR) +AM_CONDITIONAL(GST_0_6, test $GST_MAJORMINOR = 0.6) +AM_CONDITIONAL(GST_0_7, test $GST_MAJORMINOR = 0.7) dnl check for pygtk PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= $PYGTK_REQ) --- NEW FILE: 0.6.c --- /* 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 <dl...@us...> */ #include "pygobject.h" #include <gst/gst.h> #include "0.6.h" GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry) { return gst_props_entry_get_type(entry); } --- NEW FILE: 0.6.defs --- ;; ;; Override normal *_get_type handling via rename ;; (define-method get_props_type (of-object "GstPropsEntry") (c-name "gst_props_entry_get_props_type") (return-type "GstPropsType") ) --- NEW FILE: 0.6.h --- /* 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 <dl...@us...> */ #include <gst/gst.h> GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry); --- NEW FILE: 0.6.override --- /* -*- Mode: C; 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 <dl...@us...> */ %% headers #include <Python.h> #include "pygobject.h" #include <gst/gst.h> #include "0.6.h" --- NEW FILE: 0.7.c --- /* 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 <dl...@us...> */ #include "pygobject.h" #include <gst/gst.h> #include "0.7.h" --- NEW FILE: 0.7.defs --- --- NEW FILE: 0.7.h --- /* 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 <dl...@us...> */ --- NEW FILE: 0.7.override --- /* -*- Mode: C; 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 <dl...@us...> */ %% headers #include <Python.h> #include "pygobject.h" #include <gst/gst.h> #include "0.7.h" Index: Makefile.am =================================================================== RCS file: /cvsroot/gstreamer/gst-python/gstreamer/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.am 9 Oct 2003 20:01:30 -0000 1.10 +++ Makefile.am 10 Oct 2003 04:21:21 -0000 1.11 @@ -6,40 +6,61 @@ pygstreamerexecdir = $(pyexecdir)/gstreamer -# gstreamer binding -OVERRIDES = gstreamer.override +GST_OVERRIDES = common.override \ + 0.6.override \ + 0.7.override +GST_DEFS = common.defs \ + 0.6.defs \ + 0.7.defs +GST_CODE = common.c common.h \ + 0.6.c 0.6.h \ + 0.7.c 0.7.h + +# Ugly hack to pick the proper version code. +# Just setting to $(GST_MAJORMINOR).{ch} will not work +if GST_0_6 +VERSOURCES = 0.6.c 0.6.h +endif +if GST_0_7 +VERSOURCES = 0.7.c 0.7.h +endif pyexec_LTLIBRARIES = _gstreamermodule.la -_gstreamermodule_la_SOURCES = gstreamermodule.c gstreamer-fixes.c gstreamer-fixes.h +_gstreamermodule_la_SOURCES = \ + gstreamermodule.c \ + common.c common.h \ + $(VERSOURCES) _gstreamermodule_la_CFLAGS = $(GST_CFLAGS) _gstreamermodule_la_LIBADD = $(GST_LIBS) _gstreamermodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gstreamer nodist__gstreamermodule_la_SOURCES = gstreamer.c -CLEANFILES = gstreamer.c gstreamer-base.defs gstreamer.defs -EXTRA_DIST = gstreamer-extra.defs $(OVERRIDES) gstreamer-arg-types.py -gstreamer.c: gstreamer.defs $(OVERRIDES) + +CLEANFILES = gstreamer.c core.defs gstreamer.defs gstreamer.override +EXTRA_DIST = $(GST_OVERRIDES) $(GST_DEFS) $(GST_CODE) arg-types.py + +gstreamer.c: gstreamer.defs gstreamer.override GST_EXCLUDE_INCLUDES=\ $(GST_INCLUDEDIR)/gst/gstatomic_impl.h \ $(GST_INCLUDEDIR)/gst/gstcompat.h GST_INCLUDES=$(filter-out $(GST_EXCLUDE_INCLUDES),$(wildcard $(GST_INCLUDEDIR)/gst/*.h)) -gstreamer-base.defs: $(GST_INCLUDES) - $(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > gstreamer-base.defs +gstreamer.override: common.override $(GST_MAJORMINOR).override + cat $+ > $@ -gstreamer.defs: gstreamer-base.defs gstreamer-extra.defs $(top_srcdir)/gstreamer/gstreamer-arg-types.py - cat gstreamer-base.defs $(srcdir)/gstreamer-extra.defs > gstreamer.defs +core.defs: $(GST_INCLUDES) + $(PYTHON) $(PYGTK_H2DEF) $(GST_INCLUDES) > $@ -.defs.c: +gstreamer.defs: core.defs common.defs $(GST_MAJORMINOR).defs + cat $+ > $@ + +gstreamer.c: gstreamer.defs arg-types.py gstreamer.override $(PYGTK_CODEGEN) \ - --load-types $(srcdir)/gstreamer-arg-types.py \ - --override $(srcdir)/$*.override \ - --prefix py$* $*.defs > gen-$*.c \ - && cp gen-$*.c $*.c \ - && rm -f gen-$*.c + --load-types $(srcdir)/arg-types.py \ + --override $(srcdir)/gstreamer.override \ + --prefix pygstreamer gstreamer.defs > gen-gstreamer.c \ + && cp gen-gstreamer.c gstreamer.c \ + && rm -f gen-gstreamer.c -# --register $(PYGTK_DEFSDIR)/pango-types.defs -# --register $(PYGTK_DEFSDIR)/gdk-types.defs -# --register $(PYGTK_DEFSDIR)/gtk-types.defs -# --register $(top_srcdir)/bonobo/bonobo-types.defs -# --register $(top_srcdir)/bonobo/bonoboui-types.defs +# --register $(PYGTK_DEFSDIR)/gtk-types.defs +# --register $(top_srcdir)/blah/blah-types.defs --- NEW FILE: arg-types.py --- # # 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 <dl...@us...> # import argtypes arg = argtypes.UInt64Arg() argtypes.matcher.register('GstClockTime', arg) arg = argtypes.Int64Arg() argtypes.matcher.register('GstClockTimeDiff', arg) arg = argtypes.PointerArg('gpointer', 'G_TYPE_POINTER') argtypes.matcher.register('GstClockID', arg) --- NEW FILE: common.c --- /* 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 <dl...@us...> */ #include "pygobject.h" #include <gst/gst.h> #include "common.h" void iterate_bin_all(GstBin *bin) { g_return_if_fail(bin != NULL); g_return_if_fail(GST_IS_BIN(bin)); pyg_unblock_threads(); while (gst_bin_iterate(bin)); pyg_block_threads(); } static gboolean iterate_bin(gpointer data) { GstBin *bin; bin = GST_BIN(data); return gst_bin_iterate(bin); } static void iterate_bin_destroy(gpointer data) { GstBin *bin; bin = GST_BIN(data); gst_object_unref(GST_OBJECT(bin)); } guint add_iterate_bin(GstBin *bin) { g_return_val_if_fail(bin != NULL, FALSE); g_return_val_if_fail(GST_IS_BIN(bin), FALSE); gst_object_ref(GST_OBJECT(bin)); return g_idle_add_full( G_PRIORITY_DEFAULT_IDLE, iterate_bin, bin, iterate_bin_destroy); } void remove_iterate_bin(guint id) { g_source_remove(id); } --- NEW FILE: common.defs --- ;; ;; Boxed types ;; (define-boxed Buffer (in-module "Gst") (c-name "GstBuffer") (gtype-id "GST_TYPE_BUFFER") ) (define-boxed BufferPool (in-module "Gst") (c-name "GstBufferPool") (gtype-id "GST_TYPE_BUFFER_POOL") ) (define-boxed Caps (in-module "Gst") (c-name "GstCaps") (gtype-id "GST_TYPE_CAPS") ) (define-boxed Event (in-module "Gst") (c-name "GstEvent") (gtype-id "GST_TYPE_EVENT") ) (define-boxed Props (in-module "Gst") (c-name "GstProps") (gtype-id "GST_TYPE_PROPS") ) (define-boxed PropsEntry (in-module "Gst") (c-name "GstPropsEntry") (gtype-id "GST_TYPE_PROPS_ENTRY") ) ;; ;; Access GstProps properties list ;; (define-method get_list (of-object "GstProps") (c-name "gst_props_get_list") (return-type "const-GList*") ) ;; ;; Accelerate common GstBin iterate loop ;; (define-function iterate_bin_all (c-name "iterate_bin_all") (return-type "none") (parameters '("GstBin*" "bin") ) ) (define-function add_iterate_bin (c-name "add_iterate_bin") (return-type "guint") (parameters '("GstBin*" "bin") ) ) (define-function remove_iterate_bin (c-name "remove_iterate_bin") (return-type "none") (parameters '("guint" "id") ) ) ;; ;; HACK ;; (define-method get_data (of-object "GstBuffer") (c-name "gst_buffer_get_data") (return-type "char*") ) (define-method set_data (of-object "GstBuffer") (c-name "gst_buffer_set_data") (return-type "none") (parameters '("char*" "data") ) ) ;; ;; Element constructor override; uses a nonexistant make_element ;; which is defined in gstreamer.overrides ;; (define-function gst_element_factory_make_element (is-constructor-of "GstElement") (c-name "gst_element_factory_make_element") (return-type "GstElement*") (parameters '("const-gchar*" "elementname") '("const-gchar*" "name") ) ) --- NEW FILE: common.h --- /* 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 <dl...@us...> */ #include <glib-object.h> #include <gst/gst.h> #include <gst/gstqueue.h> #include <gst/gsttypefind.h> void iterate_bin_all(GstBin *bin); guint add_iterate_bin(GstBin *bin); void remove_iterate_bin(guint id); --- NEW FILE: common.override --- /* -*- Mode: C; 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 <dl...@us...> */ %% headers #include <Python.h> #include "pygobject.h" #include <gst/gst.h> #include "common.h" typedef struct { PyGObject *pad; PyObject *link_function; PyObject *chain_function; } PyGstPadPrivate; static PyGstPadPrivate* pad_private(GstPad *pad) { return (PyGstPadPrivate*)gst_pad_get_element_private(pad); } static PyGstPadPrivate* py_pad_private(PyGObject *pad) { PyGstPadPrivate *private; GstPad *gpad; gpad = (GstPad*)pygobject_get(pad); private = (PyGstPadPrivate*)gst_pad_get_element_private(gpad); if (private == NULL) { /* FIXME need to free this somewhere */ private = g_new0(PyGstPadPrivate, 1); Py_INCREF(pad); private->pad = pad; gst_pad_set_element_private(gpad, private); } return private; } %% modulename gstreamer %% import gobject.GObject as PyGObject_Type %% ignore-glob _* gstreamer_*init *_get_type %% override gst_pad_set_link_function kwargs static GstPadLinkReturn call_link_function (GstPad *pad, GstCaps *caps) { PyObject *function; PyObject *retval; GstPadLinkReturn ret; function = pad_private(pad)->link_function; pyg_block_threads(); retval = (PyObject*)PyObject_CallFunction (function, "OO", pad_private(pad)->pad, pyg_boxed_new(GST_TYPE_CAPS, caps, TRUE, TRUE)); if (PyErr_Occurred ()) { PyErr_Print (); pyg_unblock_threads(); return GST_PAD_LINK_REFUSED; } ret = PyInt_AsLong(retval); pyg_unblock_threads(); return ret; } static PyObject* _wrap_gst_pad_set_link_function (PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "link_function", NULL }; PyObject *link_function; GstPad *pad; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstPad.set_link_funcion", kwlist, &link_function)) { return NULL; } if (!PyCallable_Check(link_function)) { PyErr_SetString(PyExc_TypeError, "link_function not callable"); return NULL; } Py_INCREF(link_function); py_pad_private(self)->link_function = link_function; pad = (GstPad*)pygobject_get(self); gst_pad_set_link_function(pad, call_link_function); Py_INCREF(Py_None); return Py_None; } %% override gst_pad_set_chain_function kwargs static void call_chain_function(GstPad *pad, GstBuffer *buf) { PyObject *function; function = pad_private(pad)->chain_function; pyg_block_threads(); PyObject_CallFunction (function, "OO", pad_private(pad)->pad, pyg_boxed_new(GST_TYPE_BUFFER, buf, TRUE, TRUE)); if (PyErr_Occurred ()) { PyErr_Print (); pyg_unblock_threads(); return; } pyg_unblock_threads(); } static PyObject* _wrap_gst_pad_set_chain_function(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "chain_function", NULL }; PyObject *chain_function; GstPad *pad; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstPad.set_chain_funcion", kwlist, &chain_function)) { return NULL; } if (!PyCallable_Check(chain_function)) { PyErr_SetString(PyExc_TypeError, "chain_function not callable"); return NULL; } Py_INCREF(chain_function); py_pad_private(self)->chain_function = chain_function; pad = (GstPad*)pygobject_get(self); gst_pad_set_chain_function(pad, call_chain_function); Py_INCREF(Py_None); return Py_None; } %% override gst_buffer_get_data static PyObject* _wrap_gst_buffer_get_data(PyObject *self) { GstBuffer *buf; buf = pyg_boxed_get(self, GstBuffer); return PyString_FromStringAndSize( GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf)); } %% override gst_buffer_set_data kwargs static PyObject* _wrap_gst_buffer_set_data(PyObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = {"data", NULL}; PyObject *data; GstBuffer *buf; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstBuffer:set_data", kwlist, &data)) { return NULL; } if (!PyString_Check(data)) { PyErr_SetString(PyExc_TypeError, "data should be a string"); return NULL; } buf = pyg_boxed_get(self, GstBuffer); if (GST_BUFFER_FLAGS(buf) & GST_BUFFER_READONLY) { PyErr_SetString(PyExc_TypeError, "set_data can't use a READONLY buffer"); return NULL; } GST_BUFFER_SIZE(buf) = PyString_Size(data); GST_BUFFER_DATA(buf) = g_new0(char, GST_BUFFER_SIZE(buf)); memcpy(GST_BUFFER_DATA(buf), PyString_AsString(data), PyString_Size(data)); Py_INCREF(Py_None); return Py_None; } %% override gst_bin_iterate static PyObject * _wrap_gst_bin_iterate(PyGObject *self) { int ret; pyg_unblock_threads(); ret = gst_bin_iterate(GST_BIN(self->obj)); pyg_block_threads(); return PyInt_FromLong(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; GstElementState state; gint ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstElement.set_state", kwlist, &py_state)) return NULL; if (pyg_flags_get_value(GST_TYPE_ELEMENT_STATE, py_state, (gint *)&state)) return NULL; pyg_unblock_threads(); ret = gst_element_set_state(GST_ELEMENT(self->obj), state); pyg_block_threads(); return PyInt_FromLong(ret); } %% override gst_pad_query kwargs static PyObject * _wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "type", "format", NULL }; GstQueryType type; GstFormat format; gint64 value; gboolean ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GstPad.query", kwlist, &type, &format)) return NULL; value = 0; ret = gst_pad_query(GST_PAD(self->obj), type, &format, &value); return Py_BuildValue("(bL)", ret, value); } %% override gst_element_query kwargs static PyObject * _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "type", "format", NULL }; GstQueryType type; GstFormat format; gint64 value; gboolean ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GstElement.query", kwlist, &type, &format)) return NULL; value = 0; ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value); return Py_BuildValue("(bL)", ret, value); } %% 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; 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); dest_value = 0; ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value, &dest_format, &dest_value); return Py_BuildValue("(bL)", ret, dest_value); } %% override gst_element_convert kwargs static PyObject * _wrap_gst_element_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; gboolean ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iOi:GstElement.convert", kwlist, &src_format, &src_value_obj, &dest_format)) return NULL; src_value = PyLong_AsLongLong(src_value_obj); dest_value = 0; ret = gst_element_convert(GST_ELEMENT(self->obj), src_format, src_value, &dest_format, &dest_value); return Py_BuildValue("(bL)", ret, dest_value); } %% override gst_props_entry_get_int static PyObject * _wrap_gst_props_entry_get_int(PyObject *self) { gboolean ret; gint val; val = 0; ret = gst_props_entry_get_int(pyg_boxed_get(self, GstPropsEntry), &val); return Py_BuildValue("(bi)", ret, val); } %% override gst_props_entry_get_float static PyObject * _wrap_gst_props_entry_get_float(PyObject *self) { gboolean ret; gfloat val; val = 0.0f; ret = gst_props_entry_get_float(pyg_boxed_get(self, GstPropsEntry), &val); return Py_BuildValue("(bf)", ret, val); } %% override gst_props_entry_get_fourcc_int static PyObject * _wrap_gst_props_entry_get_fourcc_int(PyObject *self) { gboolean ret; gint32 val; val = 0; ret = gst_props_entry_get_fourcc_int(pyg_boxed_get(self, GstPropsEntry), &val); return Py_BuildValue("(bi)", ret, val); } %% override gst_props_entry_get_boolean static PyObject * _wrap_gst_props_entry_get_boolean(PyObject *self) { gboolean ret; gboolean val; PyObject *py_val; val = FALSE; ret = gst_props_entry_get_boolean(pyg_boxed_get(self, GstPropsEntry), &val); py_val = val ? Py_True : Py_False; return Py_BuildValue("(bO)", ret, py_val); } %% override gst_props_entry_get_string static PyObject * _wrap_gst_props_entry_get_string(PyObject *self) { gboolean ret; const gchar *val; val = NULL; ret = gst_props_entry_get_string(pyg_boxed_get(self, GstPropsEntry), &val); if (ret) { return Py_BuildValue("(bs)", ret, val); } else { return Py_BuildValue("(bO)", ret, Py_None); } } %% override gst_props_entry_get_int_range static PyObject * _wrap_gst_props_entry_get_int_range(PyObject *self) { gboolean ret; gint min, max; min = max = 0; ret = gst_props_entry_get_int_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); return Py_BuildValue("(bii)", ret, min, max); } %% override gst_props_entry_get_float_range static PyObject * _wrap_gst_props_entry_get_float_range(PyObject *self) { gboolean ret; gfloat min, max; min = max = 0.0f; ret = gst_props_entry_get_float_range(pyg_boxed_get(self, GstPropsEntry), &min, &max); return Py_BuildValue("(bff)", ret, min, max); } %% override gst_props_entry_get_list static PyObject * _wrap_gst_props_entry_get_list(PyObject *self) { gboolean ret; const GList *list; PyObject *tuple, *obj; int i; list = NULL; ret = gst_props_entry_get_list(pyg_boxed_get(self, GstPropsEntry), &list); if (ret == TRUE) { tuple = PyTuple_New(g_list_length((GList *) list)); for (i = 0; list != NULL; i++, list = g_list_next(list)) { obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); PyTuple_SET_ITEM(tuple, i, obj); } } else { tuple = Py_None; Py_INCREF(tuple); } return Py_BuildValue("(bO)", ret, tuple); } %% override gst_props_get_list static gboolean gst_props_get_list(GstProps *props, GList **list) { *list = GST_PROPS_PROPERTIES(props); return TRUE; } static PyObject * _wrap_gst_props_get_list(PyObject *self) { gboolean ret; GList *list; PyObject *tuple, *obj; int i; list = NULL; ret = gst_props_get_list(pyg_boxed_get(self, GstProps), &list); if (ret == TRUE) { tuple = PyTuple_New(g_list_length(list)); for (i = 0; list != NULL; i++, list = g_list_next(list)) { obj = pyg_boxed_new(GST_TYPE_PROPS_ENTRY, list->data, TRUE, TRUE); PyTuple_SET_ITEM(tuple, i, obj); } } else { tuple = Py_None; Py_INCREF(tuple); } return Py_BuildValue("(bO)", ret, tuple); } %% override gst_element_factory_make_element /* we create this function to serve as a constructor for Element */ static int _wrap_gst_element_factory_make_element(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "factoryname", "name", NULL }; char *factoryname, *name; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss:GstElement.__init__", kwlist, &factoryname, &name)) return -1; self->obj = (GObject *)gst_element_factory_make(factoryname, name); if (!self->obj) { PyErr_SetString(PyExc_RuntimeError, "could not create GstElement object"); return -1; } pygobject_register_wrapper((PyObject *)self); return 0; } %% override gst_version static PyObject * _wrap_gst_version(PyGObject *self) { guint major, minor, micro; gst_version(&major, &minor, µ); return Py_BuildValue("(iii)", major, minor, micro); } --- gstreamer-arg-types.py DELETED --- --- gstreamer-extra.defs DELETED --- --- gstreamer-fixes.c DELETED --- --- gstreamer-fixes.h DELETED --- --- gstreamer.override DELETED --- |