From 31d29bd63ac53d45c2f0f1d1dcd381409776dbdf Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 16 Mar 2004 18:42:00 +0000 Subject: [PATCH] gst/Makefile.am: Move the gstplay bindings over here Original commit message from CVS: * gst/Makefile.am: Move the gstplay bindings over here * Makefile.am, configure.ac: Remove examples/ and put them in EXTRA_DIST here --- ChangeLog | 5 ++ Makefile.am | 20 +++++--- common | 2 +- configure.ac | 27 ++--------- gst/.gitignore | 1 + gst/Makefile.am | 42 +++++++++-------- gst/interfaces.override | 47 +------------------ gst/play.defs | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ gst/play.override | 40 ++++++++++++++++ gst/playmodule.c | 50 ++++++++++++++++++++ 10 files changed, 260 insertions(+), 96 deletions(-) create mode 100644 gst/play.defs create mode 100644 gst/play.override create mode 100644 gst/playmodule.c diff --git a/ChangeLog b/ChangeLog index 6db19cb..279738f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-03-16 Johan Dahlin + * gst/Makefile.am: Move the gstplay bindings over here + + * Makefile.am, configure.ac: Remove examples/ and put them in + EXTRA_DIST here + * gst/gst.defs (element_make_from_uri): Remove const from enum here, should be fixed upstream too. diff --git a/Makefile.am b/Makefile.am index 86d8d5c..2d404cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,18 +4,26 @@ else SUBDIRS_DOCS = endif -#PLAYDIR = gstplay -PLAYDIR = - -UNCONDDIRS = gst pkgconfig examples testsuite +UNCONDDIRS = gst pkgconfig testsuite SUBDIRS = \ $(UNCONDDIRS) \ - $(PLAYDIR) \ $(SUBDIRS_DOCS) DIST_SUBDIRS = $(UNCONDDIRS) docs $(PLAYDIR) EXTRA_DIST = \ - gst-python.spec.in gst-python.spec README-docs + gst-python.spec.in \ + gst-python.spec \ + README-docs + examples/gst/bps.py \ + examples/gst/cp.py \ + examples/gst/dvdplay.py \ + examples/gst/f2f.py \ + examples/gst/identity.py \ + examples/gst/ilat.py \ + examples/gst/lat.py \ + examples/gst/rot13.py \ + examples/gst/vorbisplay.py \ + examples/gstplay/player.py snap: $(MAKE) dist distdir=$(PACKAGE)-`date +"%Y%m%d"` diff --git a/common b/common index 5557aa0..581b12c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5557aa074c4836b2cc9eac0e1519323df1cb876f +Subproject commit 581b12ce0812d391c32f212b9887be333bcdb420 diff --git a/configure.ac b/configure.ac index f8d7ade..365ce15 100644 --- a/configure.ac +++ b/configure.ac @@ -89,31 +89,15 @@ AC_SUBST(PYGTK_CODEGEN) #dnl check to make sure we can find gtk #AM_PATH_GTK_2_0(gtk_required_version,,[AC_MSG_ERROR(maybe you want the gtk-gnome-1-2 branch?)],$extra_mods) -AC_MSG_CHECKING(for GStreamer include dir) -GST_INCLUDEDIR=`$PKG_CONFIG --variable=includedir gstreamer-$GST_MAJORMINOR` -AC_MSG_RESULT($GST_INCLUDEDIR) -if test "x$GST_INCLUDEDIR" = "x"; then - AC_MSG_ERROR(no GStreamer include dir found) -fi -AC_SUBST(GST_INCLUDEDIR) - AC_MSG_CHECKING(for GStreamer interfaces include dir) PKG_CHECK_MODULES(GST_INTERFACES, gstreamer-interfaces-$GST_MAJORMINOR) -GST_INTERFACES_INCLUDEDIR=`$PKG_CONFIG --variable=includedir gstreamer-interfaces-$GST_MAJORMINOR` -AC_MSG_RESULT($GST_INTERFACES_INCLUDEDIR) -if test "x$GST_INTERFACES_INCLUDEDIR" = "x"; then - AC_MSG_ERROR(no GStreamer interfaces include dir found) -fi -AC_SUBST(GST_INTERFACES_INCLUDEDIR) +AC_SUBST(GST_INTERFACES_CFLAGS) +AC_SUBST(GST_INTERFACES_INCLUDES) AC_MSG_CHECKING(for GStreamer play include dir) PKG_CHECK_MODULES(GST_PLAY, gstreamer-play-$GST_MAJORMINOR) -GST_PLAY_INCLUDEDIR=`$PKG_CONFIG --variable=includedir gstreamer-play-$GST_MAJORMINOR` -AC_MSG_RESULT($GST_PLAY_INCLUDEDIR) -if test "x$GST_PLAY_INCLUDEDIR" = "x"; then - AC_MSG_ERROR(no GStreamer play include dir found) -fi -AC_SUBST(GST_PLAY_INCLUDEDIR) +AC_SUBST(GST_PLAY_CFLAGS) +AC_SUBST(GST_PLAY_INCLUDES) AC_CHECK_PROG(HAVE_XMLTO, xmlto, true, false) AC_CHECK_PROG(HAVE_XMLCATALOG, xmlcatalog, true, false) @@ -160,12 +144,9 @@ changequote([,])dnl AC_OUTPUT([ Makefile gst/Makefile - gstplay/Makefile pkgconfig/Makefile pkgconfig/gst-python.pc pkgconfig/gst-python-uninstalled.pc - examples/Makefile - examples/gst/Makefile docs/Makefile docs/gst-python.ent testsuite/Makefile diff --git a/gst/.gitignore b/gst/.gitignore index 60ec216..ed9f684 100644 --- a/gst/.gitignore +++ b/gst/.gitignore @@ -10,3 +10,4 @@ Makefile.in gst.c gen-*.c interfaces.c +play.c diff --git a/gst/Makefile.am b/gst/Makefile.am index 39b506b..cba003f 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -4,7 +4,7 @@ PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ defs_DATA = defsdir = $(pkgdatadir)/2.0/defs -EXTRA_DIST = $(defs_DATA) +EXTRA_DIST = $(defs_DATA) arg-types.py pkgpythondir = $(pythondir)/gst pkgpyexecdir = $(pyexecdir)/gst @@ -27,32 +27,34 @@ _gst_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gst _gst_la_SOURCES = gst-argtypes.c gstmodule.c nodist__gst_la_SOURCES = gst.c CLEANFILES = gst.c -EXTRA_DIST += $(GST_OVERRIDES) arg-types.py +EXTRA_DIST += $(GST_OVERRIDES) defs_DATA += $(GST_DEFS) gst.c: $(GST_DEFS) $(GST_OVERRIDES) +# gst-play bindings + +# FIXEME: configure.ac +PLAY_OVERRIDES = play.override +PLAY_DEFS = play.defs + +#if BUILD_PLAY +pygstexec_LTLIBRARIES += play.la +#endif +play_la_CFLAGS = $(GST_CFLAGS) $(GST_PLAY_CFLAGS) -fno-strict-aliasing +play_la_LIBADD = $(GST_LIBS) $(GST_PLAY_LIBS) +play_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initplay +play_la_SOURCES = playmodule.c +nodist_play_la_SOURCES = play.c +CLEANFILES += play.c +EXTRA_DIST += $(PLAY_OVERRIDES) +defs_DATA += $(PLAY_DEFS) +play.c: $(PLAY_DEFS) $(PLAY_OVERRIDES) + # GStreamer interfaces bindings INTERFACES_OVERRIDES = interfaces.override xoverlay.override INTERFACES_DEFS = interfaces.defs xoverlay.defs xwindowlistener.defs -GST_INTERFACES_INCLUDES= -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/colorbalance/colorbalance.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/colorbalance/colorbalancechannel.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/mixer/mixer.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/mixer/mixertrack.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/navigation/navigation.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/propertyprobe/propertyprobe.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/tuner/tuner.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/tuner/tunerchannel.h -GST_INTERFACES_INCLUDES += $(GST_INTERFACES_INCLUDEDIR)/gst/tuner/tunernorm.h - -# FIXME: configure.ac -#if USE_X -GST_INTERFACES_INCLUDES+=$(GST_INTERFACES_INCLUDEDIR)/gst/xoverlay/xoverlay.h -GST_INTERFACES_INCLUDES+=$(GST_INTERFACES_INCLUDEDIR)/gst/xwindowlistener/xwindowlistener.h -#endif - # FIXEME: configure.ac #if BUILD_INTERFACES pygstexec_LTLIBRARIES += interfaces.la @@ -63,7 +65,7 @@ interfaces_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initinterface interfaces_la_SOURCES = interfacesmodule.c nodist_interfaces_la_SOURCES = interfaces.c CLEANFILES += interfaces.c -EXTRA_DIST += $(INTERFACES_OVERRIDES) arg-types.py +EXTRA_DIST += $(INTERFACES_OVERRIDES) defs_DATA += $(INTERFACES_DEFS) interfaces.c: $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) diff --git a/gst/interfaces.override b/gst/interfaces.override index 5efa177..37fe829 100644 --- a/gst/interfaces.override +++ b/gst/interfaces.override @@ -35,7 +35,7 @@ headers #include %% -modulename gstinterfaces +modulename gst.interfaces %% import gobject.GObject as PyGObject_Type import gst.Object as PyGstObject_Type @@ -52,7 +52,6 @@ ignore-glob %% %% override gst_tuner_make kwargs - static PyObject * _wrap_gst_tuner_make(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -71,47 +70,3 @@ _wrap_gst_tuner_make(PyObject *self, PyObject *args, PyObject *kwargs) Py_INCREF(Py_None); return Py_None; } -%% -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; - } - self->free_on_dealloc = TRUE; - 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", NULL }; - char *field; - PyObject *py_value = NULL; - GValue value = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GstStructure.set_value", kwlist, &field, &py_value)) - return NULL; - g_value_init(&value, G_TYPE_STRING); - if (pyg_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; -} diff --git a/gst/play.defs b/gst/play.defs new file mode 100644 index 0000000..8599b61 --- /dev/null +++ b/gst/play.defs @@ -0,0 +1,122 @@ +;; -*- scheme -*- +; object definitions ... +(define-object Play + (in-module "Gst") + (parent "GstPipeline") + (c-name "GstPlay") + (gtype-id "GST_TYPE_PLAY") +) + +;; Enumerations and flags ... + +(define-enum PlaySinkType + (in-module "Gst") + (c-name "GstPlaySinkType") + (gtype-id "GST_TYPE_PLAY_SINK_TYPE") + (values + '("audio" "GST_PLAY_SINK_TYPE_AUDIO") + '("video" "GST_PLAY_SINK_TYPE_VIDEO") + '("any" "GST_PLAY_SINK_TYPE_ANY") + ) +) + + +;; From /opt/gnome/include/gstreamer-0.7/gst/play/play.h + +(define-function gst_play_get_type + (c-name "gst_play_get_type") + (return-type "GType") +) + +(define-function gst_play_new + (c-name "gst_play_new") + (is-constructor-of "GstPlay") + (return-type "GstPlay*") + (parameters + '("GError**" "error") + ) +) + +(define-method set_data_src + (of-object "GstPlay") + (c-name "gst_play_set_data_src") + (return-type "gboolean") + (parameters + '("GstElement*" "data_src") + ) +) + +(define-method set_video_sink + (of-object "GstPlay") + (c-name "gst_play_set_video_sink") + (return-type "gboolean") + (parameters + '("GstElement*" "video_sink") + ) +) + +(define-method set_audio_sink + (of-object "GstPlay") + (c-name "gst_play_set_audio_sink") + (return-type "gboolean") + (parameters + '("GstElement*" "audio_sink") + ) +) + +(define-method set_visualization + (of-object "GstPlay") + (c-name "gst_play_set_visualization") + (return-type "gboolean") + (parameters + '("GstElement*" "element") + ) +) + +(define-method connect_visualization + (of-object "GstPlay") + (c-name "gst_play_connect_visualization") + (return-type "gboolean") + (parameters + '("gboolean" "connect") + ) +) + +(define-method set_location + (of-object "GstPlay") + (c-name "gst_play_set_location") + (return-type "gboolean") + (parameters + '("const-char*" "location") + ) +) + +(define-method get_location + (of-object "GstPlay") + (c-name "gst_play_get_location") + (return-type "char*") +) + +(define-method seek_to_time + (of-object "GstPlay") + (c-name "gst_play_seek_to_time") + (return-type "gboolean") + (parameters + '("gint64" "time_nanos") + ) +) + +(define-method get_sink_element + (of-object "GstPlay") + (c-name "gst_play_get_sink_element") + (return-type "GstElement*") + (parameters + '("GstElement*" "element") + '("GstPlaySinkType" "sink_type") + ) +) + + +;; +;; interface definitions +;; diff --git a/gst/play.override b/gst/play.override new file mode 100644 index 0000000..63ac1d0 --- /dev/null +++ b/gst/play.override @@ -0,0 +1,40 @@ +/* -*- 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 +#include + +#include "pygobject.h" +#include +#include + +%% +modulename gst.play +%% +import gobject.GObject as PyGObject_Type +import gst.Element as PyGstElement_Type +import gst.Pipeline as PyGstPipeline_Type +%% +ignore-glob + _* + gstplay_*init + *_get_type diff --git a/gst/playmodule.c b/gst/playmodule.c new file mode 100644 index 0000000..cc6755e --- /dev/null +++ b/gst/playmodule.c @@ -0,0 +1,50 @@ +/* -*- 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 + +void pyplay_register_classes (PyObject *d); +void pyplay_add_constants(PyObject *module, const gchar *strip_prefix); + +extern PyMethodDef pyplay_functions[]; + +DL_EXPORT(void) +initplay (void) +{ + PyObject *m, *d; + + m = Py_InitModule ("play", pyplay_functions); + d = PyModule_GetDict (m); + + pyplay_register_classes (d); + pyplay_add_constants (m, "GST_"); + + if (PyErr_Occurred ()) { + Py_FatalError ("can't initialize module gst.play"); + } +} -- 2.7.4