From 171bc6bfa997c7c198adbead62126f3038d6d9a7 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 10 Oct 2003 04:21:21 +0000 Subject: [PATCH] Mass change to support compiling for both 0.6 and 0.7. Common support is now in common.{defs,override,c,h}. Specifi... Original commit message from CVS: 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 --- configure.ac | 23 +++---- gst/0.6.c | 30 +++++++++ gst/0.6.defs | 9 +++ gst/0.6.h | 24 +++++++ gst/0.6.override | 29 +++++++++ gst/0.7.c | 25 ++++++++ gst/0.7.defs | 0 gst/0.7.h | 20 ++++++ gst/0.7.override | 29 +++++++++ gst/Makefile.am | 63 ++++++++++++------- gst/{gstreamer-arg-types.py => arg-types.py} | 0 gstreamer/gstreamer-fixes.c => gst/common.c | 7 +-- gst/{gstreamer-extra.defs => common.defs} | 11 +--- gst/{gstreamer-fixes.h => common.h} | 1 - .../gstreamer.override => gst/common.override | 14 ++++- gstreamer/0.6.c | 30 +++++++++ gstreamer/0.6.defs | 9 +++ gstreamer/0.6.h | 24 +++++++ gstreamer/0.6.override | 29 +++++++++ gstreamer/0.7.c | 25 ++++++++ gstreamer/0.7.defs | 0 gstreamer/0.7.h | 20 ++++++ gstreamer/0.7.override | 29 +++++++++ gstreamer/Makefile.am | 63 ++++++++++++------- .../{gstreamer-arg-types.py => arg-types.py} | 0 gst/gstreamer-fixes.c => gstreamer/common.c | 7 +-- .../{gstreamer-extra.defs => common.defs} | 11 +--- gstreamer/{gstreamer-fixes.h => common.h} | 1 - .../common.override | 14 ++++- 29 files changed, 456 insertions(+), 91 deletions(-) create mode 100644 gst/0.6.c create mode 100644 gst/0.6.defs create mode 100644 gst/0.6.h create mode 100644 gst/0.6.override create mode 100644 gst/0.7.c create mode 100644 gst/0.7.defs create mode 100644 gst/0.7.h create mode 100644 gst/0.7.override rename gst/{gstreamer-arg-types.py => arg-types.py} (100%) rename gstreamer/gstreamer-fixes.c => gst/common.c (92%) rename gst/{gstreamer-extra.defs => common.defs} (90%) rename gst/{gstreamer-fixes.h => common.h} (94%) rename gstreamer/gstreamer.override => gst/common.override (98%) create mode 100644 gstreamer/0.6.c create mode 100644 gstreamer/0.6.defs create mode 100644 gstreamer/0.6.h create mode 100644 gstreamer/0.6.override create mode 100644 gstreamer/0.7.c create mode 100644 gstreamer/0.7.defs create mode 100644 gstreamer/0.7.h create mode 100644 gstreamer/0.7.override rename gstreamer/{gstreamer-arg-types.py => arg-types.py} (100%) rename gst/gstreamer-fixes.c => gstreamer/common.c (92%) rename gstreamer/{gstreamer-extra.defs => common.defs} (90%) rename gstreamer/{gstreamer-fixes.h => common.h} (94%) rename gst/gstreamer.override => gstreamer/common.override (98%) diff --git a/configure.ac b/configure.ac index 9172fb9cd9..99f12d1545 100644 --- a/configure.ac +++ b/configure.ac @@ -40,23 +40,18 @@ else 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 @@ fi 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) diff --git a/gst/0.6.c b/gst/0.6.c new file mode 100644 index 0000000000..6820f91827 --- /dev/null +++ b/gst/0.6.c @@ -0,0 +1,30 @@ +/* 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 + */ + +#include "pygobject.h" +#include + +#include "0.6.h" + +GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry) +{ + return gst_props_entry_get_type(entry); +} diff --git a/gst/0.6.defs b/gst/0.6.defs new file mode 100644 index 0000000000..e0ed8ee847 --- /dev/null +++ b/gst/0.6.defs @@ -0,0 +1,9 @@ +;; +;; 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") +) diff --git a/gst/0.6.h b/gst/0.6.h new file mode 100644 index 0000000000..ff0bcac68b --- /dev/null +++ b/gst/0.6.h @@ -0,0 +1,24 @@ +/* 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 + */ + +#include + +GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry); diff --git a/gst/0.6.override b/gst/0.6.override new file mode 100644 index 0000000000..213ab276a2 --- /dev/null +++ b/gst/0.6.override @@ -0,0 +1,29 @@ +/* -*- 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 + */ +%% +headers +#include + +#include "pygobject.h" +#include + +#include "0.6.h" diff --git a/gst/0.7.c b/gst/0.7.c new file mode 100644 index 0000000000..b8eb17723e --- /dev/null +++ b/gst/0.7.c @@ -0,0 +1,25 @@ +/* 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 + */ + +#include "pygobject.h" +#include + +#include "0.7.h" diff --git a/gst/0.7.defs b/gst/0.7.defs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gst/0.7.h b/gst/0.7.h new file mode 100644 index 0000000000..66d2bf1897 --- /dev/null +++ b/gst/0.7.h @@ -0,0 +1,20 @@ +/* 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 + */ diff --git a/gst/0.7.override b/gst/0.7.override new file mode 100644 index 0000000000..cd5308182e --- /dev/null +++ b/gst/0.7.override @@ -0,0 +1,29 @@ +/* -*- 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 + */ +%% +headers +#include + +#include "pygobject.h" +#include + +#include "0.7.h" diff --git a/gst/Makefile.am b/gst/Makefile.am index fbe0a9ad36..18b43a147a 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -6,40 +6,61 @@ pygstreamer_PYTHON = __init__.py 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 diff --git a/gst/gstreamer-arg-types.py b/gst/arg-types.py similarity index 100% rename from gst/gstreamer-arg-types.py rename to gst/arg-types.py diff --git a/gstreamer/gstreamer-fixes.c b/gst/common.c similarity index 92% rename from gstreamer/gstreamer-fixes.c rename to gst/common.c index 3ffb7d4be4..841283b16b 100644 --- a/gstreamer/gstreamer-fixes.c +++ b/gst/common.c @@ -22,7 +22,7 @@ #include "pygobject.h" #include -#include "gstreamer-fixes.h" +#include "common.h" void iterate_bin_all(GstBin *bin) { g_return_if_fail(bin != NULL); @@ -62,8 +62,3 @@ guint add_iterate_bin(GstBin *bin) { void remove_iterate_bin(guint id) { g_source_remove(id); } - -GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry) -{ - return gst_props_entry_get_type(entry); -} diff --git a/gst/gstreamer-extra.defs b/gst/common.defs similarity index 90% rename from gst/gstreamer-extra.defs rename to gst/common.defs index acb57cb963..02527b031f 100644 --- a/gst/gstreamer-extra.defs +++ b/gst/common.defs @@ -38,16 +38,6 @@ (gtype-id "GST_TYPE_PROPS_ENTRY") ) -;; -;; 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") -) - ;; ;; Access GstProps properties list ;; @@ -109,6 +99,7 @@ ;; 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") diff --git a/gst/gstreamer-fixes.h b/gst/common.h similarity index 94% rename from gst/gstreamer-fixes.h rename to gst/common.h index 1bd142dd41..a63f174f39 100644 --- a/gst/gstreamer-fixes.h +++ b/gst/common.h @@ -28,4 +28,3 @@ void iterate_bin_all(GstBin *bin); guint add_iterate_bin(GstBin *bin); void remove_iterate_bin(guint id); -GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry); diff --git a/gstreamer/gstreamer.override b/gst/common.override similarity index 98% rename from gstreamer/gstreamer.override rename to gst/common.override index b8bb6fda8a..416e1277f3 100644 --- a/gstreamer/gstreamer.override +++ b/gst/common.override @@ -26,7 +26,7 @@ headers #include "pygobject.h" #include -#include "gstreamer-fixes.h" +#include "common.h" typedef struct { PyGObject *pad; @@ -516,3 +516,15 @@ _wrap_gst_element_factory_make_element(PyGObject *self, PyObject *args, PyObject 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); +} diff --git a/gstreamer/0.6.c b/gstreamer/0.6.c new file mode 100644 index 0000000000..6820f91827 --- /dev/null +++ b/gstreamer/0.6.c @@ -0,0 +1,30 @@ +/* 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 + */ + +#include "pygobject.h" +#include + +#include "0.6.h" + +GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry) +{ + return gst_props_entry_get_type(entry); +} diff --git a/gstreamer/0.6.defs b/gstreamer/0.6.defs new file mode 100644 index 0000000000..e0ed8ee847 --- /dev/null +++ b/gstreamer/0.6.defs @@ -0,0 +1,9 @@ +;; +;; 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") +) diff --git a/gstreamer/0.6.h b/gstreamer/0.6.h new file mode 100644 index 0000000000..ff0bcac68b --- /dev/null +++ b/gstreamer/0.6.h @@ -0,0 +1,24 @@ +/* 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 + */ + +#include + +GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry); diff --git a/gstreamer/0.6.override b/gstreamer/0.6.override new file mode 100644 index 0000000000..213ab276a2 --- /dev/null +++ b/gstreamer/0.6.override @@ -0,0 +1,29 @@ +/* -*- 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 + */ +%% +headers +#include + +#include "pygobject.h" +#include + +#include "0.6.h" diff --git a/gstreamer/0.7.c b/gstreamer/0.7.c new file mode 100644 index 0000000000..b8eb17723e --- /dev/null +++ b/gstreamer/0.7.c @@ -0,0 +1,25 @@ +/* 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 + */ + +#include "pygobject.h" +#include + +#include "0.7.h" diff --git a/gstreamer/0.7.defs b/gstreamer/0.7.defs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gstreamer/0.7.h b/gstreamer/0.7.h new file mode 100644 index 0000000000..66d2bf1897 --- /dev/null +++ b/gstreamer/0.7.h @@ -0,0 +1,20 @@ +/* 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 + */ diff --git a/gstreamer/0.7.override b/gstreamer/0.7.override new file mode 100644 index 0000000000..cd5308182e --- /dev/null +++ b/gstreamer/0.7.override @@ -0,0 +1,29 @@ +/* -*- 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 + */ +%% +headers +#include + +#include "pygobject.h" +#include + +#include "0.7.h" diff --git a/gstreamer/Makefile.am b/gstreamer/Makefile.am index fbe0a9ad36..18b43a147a 100644 --- a/gstreamer/Makefile.am +++ b/gstreamer/Makefile.am @@ -6,40 +6,61 @@ pygstreamer_PYTHON = __init__.py 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 diff --git a/gstreamer/gstreamer-arg-types.py b/gstreamer/arg-types.py similarity index 100% rename from gstreamer/gstreamer-arg-types.py rename to gstreamer/arg-types.py diff --git a/gst/gstreamer-fixes.c b/gstreamer/common.c similarity index 92% rename from gst/gstreamer-fixes.c rename to gstreamer/common.c index 3ffb7d4be4..841283b16b 100644 --- a/gst/gstreamer-fixes.c +++ b/gstreamer/common.c @@ -22,7 +22,7 @@ #include "pygobject.h" #include -#include "gstreamer-fixes.h" +#include "common.h" void iterate_bin_all(GstBin *bin) { g_return_if_fail(bin != NULL); @@ -62,8 +62,3 @@ guint add_iterate_bin(GstBin *bin) { void remove_iterate_bin(guint id) { g_source_remove(id); } - -GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry) -{ - return gst_props_entry_get_type(entry); -} diff --git a/gstreamer/gstreamer-extra.defs b/gstreamer/common.defs similarity index 90% rename from gstreamer/gstreamer-extra.defs rename to gstreamer/common.defs index acb57cb963..02527b031f 100644 --- a/gstreamer/gstreamer-extra.defs +++ b/gstreamer/common.defs @@ -38,16 +38,6 @@ (gtype-id "GST_TYPE_PROPS_ENTRY") ) -;; -;; 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") -) - ;; ;; Access GstProps properties list ;; @@ -109,6 +99,7 @@ ;; 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") diff --git a/gstreamer/gstreamer-fixes.h b/gstreamer/common.h similarity index 94% rename from gstreamer/gstreamer-fixes.h rename to gstreamer/common.h index 1bd142dd41..a63f174f39 100644 --- a/gstreamer/gstreamer-fixes.h +++ b/gstreamer/common.h @@ -28,4 +28,3 @@ void iterate_bin_all(GstBin *bin); guint add_iterate_bin(GstBin *bin); void remove_iterate_bin(guint id); -GstPropsType gst_props_entry_get_props_type(GstPropsEntry *entry); diff --git a/gst/gstreamer.override b/gstreamer/common.override similarity index 98% rename from gst/gstreamer.override rename to gstreamer/common.override index b8bb6fda8a..416e1277f3 100644 --- a/gst/gstreamer.override +++ b/gstreamer/common.override @@ -26,7 +26,7 @@ headers #include "pygobject.h" #include -#include "gstreamer-fixes.h" +#include "common.h" typedef struct { PyGObject *pad; @@ -516,3 +516,15 @@ _wrap_gst_element_factory_make_element(PyGObject *self, PyObject *args, PyObject 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); +}