From 5e7dffcf4d6bb53768bf0838dc010951b237430b Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Mon, 15 Mar 2004 14:25:10 +0000 Subject: [PATCH] gst/*: Move interfaces over here, make it build, remove gstreamer.py Original commit message from CVS: * gst/*: Move interfaces over here, make it build, remove gstreamer.py --- ChangeLog | 4 + Makefile.am | 4 +- codegen/.gitignore | 1 + configure.ac | 1 - docs/.gitignore | 1 + gst/.gitignore | 1 + gst/Makefile.am | 75 +++++-- gst/gst-argtypes.c | 70 +++++++ gst/gst.override | 1 + gst/interfaces.defs | 526 +++++++++++++++++++++++++++++++++++++++++++++++ gst/interfaces.override | 117 +++++++++++ gst/interfacesmodule.c | 50 +++++ gst/xoverlay.defs | 57 +++++ gst/xoverlay.override | 24 +++ gst/xwindowlistener.defs | 41 ++++ 15 files changed, 949 insertions(+), 24 deletions(-) create mode 100644 codegen/.gitignore create mode 100644 gst/gst-argtypes.c create mode 100644 gst/interfaces.defs create mode 100644 gst/interfaces.override create mode 100644 gst/interfacesmodule.c create mode 100644 gst/xoverlay.defs create mode 100644 gst/xoverlay.override create mode 100644 gst/xwindowlistener.defs diff --git a/ChangeLog b/ChangeLog index e7e581f..9efb809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-03-15 Johan Dahlin + + * gst/*: Move interfaces over here, make it build, remove gstreamer.py + 2004-03-12 Johan Dahlin * configure.ac: PyGtk 1.99.14 should be okay (Shipped with RH9), diff --git a/Makefile.am b/Makefile.am index c70cb6c..86d8d5c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,17 +4,15 @@ else SUBDIRS_DOCS = endif -INTERFACESDIR = gstinterfaces #PLAYDIR = gstplay PLAYDIR = UNCONDDIRS = gst pkgconfig examples testsuite SUBDIRS = \ $(UNCONDDIRS) \ - $(INTERFACESDIR) \ $(PLAYDIR) \ $(SUBDIRS_DOCS) -DIST_SUBDIRS = $(UNCONDDIRS) docs gstinterfaces $(PLAYDIR) +DIST_SUBDIRS = $(UNCONDDIRS) docs $(PLAYDIR) EXTRA_DIST = \ gst-python.spec.in gst-python.spec README-docs diff --git a/codegen/.gitignore b/codegen/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/codegen/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/configure.ac b/configure.ac index b940f72..f8d7ade 100644 --- a/configure.ac +++ b/configure.ac @@ -160,7 +160,6 @@ changequote([,])dnl AC_OUTPUT([ Makefile gst/Makefile - gstinterfaces/Makefile gstplay/Makefile pkgconfig/Makefile pkgconfig/gst-python.pc diff --git a/docs/.gitignore b/docs/.gitignore index 61f5646..9bdc3d5 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -2,3 +2,4 @@ *.pdf *.html gst-python.ent +tmpbuildcatalog diff --git a/gst/.gitignore b/gst/.gitignore index a82c99b..60ec216 100644 --- a/gst/.gitignore +++ b/gst/.gitignore @@ -9,3 +9,4 @@ Makefile.in .deps gst.c gen-*.c +interfaces.c diff --git a/gst/Makefile.am b/gst/Makefile.am index c8530af..39b506b 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -1,43 +1,78 @@ INCLUDES = $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +defs_DATA = +defsdir = $(pkgdatadir)/2.0/defs + +EXTRA_DIST = $(defs_DATA) + pkgpythondir = $(pythondir)/gst pkgpyexecdir = $(pyexecdir)/gst +common_ldflags = -module -avoid-version + pygstdir = $(pkgpythondir) pygst_PYTHON = __init__.py -# Backwards comptibility -pygstreamerdir = $(pythondir) -pygstreamer_PYTHON = gstreamer.py - pygstexecdir = $(pkgpyexecdir) +# GStreamer bindings GST_OVERRIDES = gst.override gstpad-handlers.override +GST_DEFS = gst.defs gst-types.defs -pygstexec_LTLIBRARIES = _gstmodule.la -_gstmodule_la_SOURCES = gstmodule.c gst-types.c +pygstexec_LTLIBRARIES = _gst.la +_gst_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing +_gst_la_LIBADD = $(GST_LIBS) +_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 +defs_DATA += $(GST_DEFS) +gst.c: $(GST_DEFS) $(GST_OVERRIDES) -_gstmodule_la_CFLAGS = $(GST_CFLAGS) -fno-strict-aliasing -_gstmodule_la_LIBADD = $(GST_LIBS) -_gstmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex init_gst -nodist__gstmodule_la_SOURCES = gst.c +# GStreamer interfaces bindings -defs_DATA = \ - gst.defs \ - gst-types.defs -defsdir = $(pkgdatadir)/2.0/defs +INTERFACES_OVERRIDES = interfaces.override xoverlay.override +INTERFACES_DEFS = interfaces.defs xoverlay.defs xwindowlistener.defs -CLEANFILES = gst.c -EXTRA_DIST = $(defs_DATA) $(GST_OVERRIDES) arg-types.py +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 -gst.c: $(srcdir)/gst.defs $(srcdir)/gst-types.defs $(GST_OVERRIDES) - (cd $(srcdir)\ - && $(PYGTK_CODEGEN) \ +# FIXEME: configure.ac +#if BUILD_INTERFACES +pygstexec_LTLIBRARIES += interfaces.la +#endif +interfaces_la_CFLAGS = $(GST_CFLAGS) $(GST_INTERFACES_CFLAGS) -fno-strict-aliasing +interfaces_la_LIBADD = $(GST_LIBS) $(GST_INTERFACES_LIBS) +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 +defs_DATA += $(INTERFACES_DEFS) +interfaces.c: $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) + +.defs.c: + (cd $(srcdir) \ + && $(PYGTK_CODEGEN) \ --load-types $(srcdir)/arg-types.py \ --register $(srcdir)/gst-types.defs \ --override $*.override \ --prefix py$* $*.defs) > gen-$*.c \ && cp gen-$*.c $*.c \ && rm -f gen-$*.c - diff --git a/gst/gst-argtypes.c b/gst/gst-argtypes.c new file mode 100644 index 0000000..67364b8 --- /dev/null +++ b/gst/gst-argtypes.c @@ -0,0 +1,70 @@ +/* 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 + */ + +#include +#include + +gboolean +pygst_data_from_pyobject(PyObject *object, GstData **data) +{ + if (pyg_boxed_check(object, GST_TYPE_DATA)) { + *data = pyg_boxed_get(object, GstData); + return TRUE; + } else if (pyg_boxed_check(object, GST_TYPE_BUFFER)) { + *data = GST_DATA (pyg_boxed_get(object, GstBuffer)); + return TRUE; + } else if (pyg_boxed_check(object, GST_TYPE_EVENT)) { + *data = GST_DATA (pyg_boxed_get(object, GstEvent)); + return TRUE; + } + + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, "could not convert to GstData"); + return FALSE; +} + +static PyObject * +PyGstData_from_value(const GValue *value) +{ + GstData *data = (GstData *)g_value_get_boxed(value); + + return pyg_boxed_new(GST_TYPE_DATA, data, TRUE, TRUE); +} + +static int +PyGstData_to_value(GValue *value, PyObject *object) +{ + GstData* data; + + if (!pygst_data_from_pyobject(object, &data)) + return -1; + + g_value_set_boxed(value, data); + return 0; +} + +void +_pygst_register_boxed_types(PyObject *moddict) +{ + pyg_register_boxed_custom(GST_TYPE_DATA, + PyGstData_from_value, + PyGstData_to_value); +} diff --git a/gst/gst.override b/gst/gst.override index 241ff0d..30d52c0 100644 --- a/gst/gst.override +++ b/gst/gst.override @@ -33,6 +33,7 @@ headers #include #include #include +#include typedef struct { PyGObject *pad; diff --git a/gst/interfaces.defs b/gst/interfaces.defs new file mode 100644 index 0000000..e77499f --- /dev/null +++ b/gst/interfaces.defs @@ -0,0 +1,526 @@ +;; -*- scheme -*- + +(include "xoverlay.defs") + +; object definitions ... +;(define-object XWindowListener +; (in-module "Gst") +; (parent "GObject") +; (c-name "GstXWindowListener") +; (gtype-id "GST_TYPE_X_WINDOW_LISTENER") +;) + +;; 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") + ) +) + + +;; 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_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") + ) +) + + + +;; 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 "none") + (parameters + '("GstMixerTrack*" "track") + '("gint*" "volumes") + ) +) + +(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 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") + ) +) + + + +;; From /opt/gnome/include/gstreamer-0.7/gst/navigation/navigation.h + +(define-function gst_navigation_get_type + (c-name "gst_navigation_get_type") + (return-type "GType") +) + +(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") + ) +) + + + +;; 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 get_properties + (of-object "GstPropertyProbe") + (c-name "gst_property_probe_get_properties") + (return-type "const-GList*") +) + +(define-method 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 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") + ) +) + + + +;; 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") + ) +) + + + + +;; From /opt/gnome/include/gstreamer-0.7/gst/xwindowlistener/xwindowlistener.h + +(define-function gst_x_window_listener_get_type + (c-name "gst_x_window_listener_get_type") + (return-type "GType") +) + +(define-function gst_x_window_listener_new + (c-name "gst_x_window_listener_new") + (is-constructor-of "GstXWindowListener") + (return-type "GstXWindowListener*") + (parameters + '("gchar*" "display") + '("MapWindowFunc" "map_window_func") + '("SetWindowFunc" "set_window_func") + '("gpointer" "private_data") + ) +) + +(define-method set_xid + (of-object "GstXWindowListener") + (c-name "gst_x_window_listener_set_xid") + (return-type "none") + (parameters + '("XID" "id") + ) +) + + +;; +;; interface definitions ... +;; + +(define-interface ColorBalance + (in-module "Gst") + (c-name "GstColorBalance") + (gtype-id "GST_TYPE_COLOR_BALANCE") +) + +(define-object ColorBalanceChannel + (in-module "Gst") + (parent "GstObject") + (c-name "GstColorBalanceChannel") + (gtype-id "GST_TYPE_COLOR_BALANCE_CHANNEL") +) + +(define-interface Mixer + (in-module "Gst") + (c-name "GstMixer") + (gtype-id "GST_TYPE_MIXER") +) + +(define-object MixerTrack + (in-module "Gst") + (parent "GstObject") + (c-name "GstMixerTrack") + (gtype-id "GST_TYPE_MIXER_TRACK") +) + +(define-interface Navigation + (in-module "Gst") + (c-name "GstNavigation") + (gtype-id "GST_TYPE_NAVIGATION") +) + +(define-interface PropertyProbe + (in-module "Gst") + (c-name "GstPropertyProbe") + (gtype-id "GST_TYPE_PROPERTY_PROBE") +) + +(define-interface Tuner + (in-module "Gst") + (c-name "GstTuner") + (gtype-id "GST_TYPE_TUNER") +) + +(define-object TunerChannel + (in-module "Gst") + (parent "GstObject") + (c-name "GstTunerChannel") + (gtype-id "GST_TYPE_TUNER_CHANNEL") +) + +(define-object TunerNorm + (in-module "Gst") + (parent "GstObject") + (c-name "GstTunerNorm") + (gtype-id "GST_TYPE_TUNER_NORM") +) diff --git a/gst/interfaces.override b/gst/interfaces.override new file mode 100644 index 0000000..5efa177 --- /dev/null +++ b/gst/interfaces.override @@ -0,0 +1,117 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include +#include + +%% +modulename gstinterfaces +%% +import gobject.GObject as PyGObject_Type +import gst.Object as PyGstObject_Type +import gst.Structure as PyGstStructure_Type +import gst.Element as PyGstElement_Type +%% +include + xoverlay.override +%% +ignore-glob + _* + gstinterfaces_*init + *_get_type +%% +%% +override gst_tuner_make kwargs + +static PyObject * +_wrap_gst_tuner_make(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "obj", NULL }; + PyObject *py_value = NULL; + GValue value = { 0 }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstStructure.set_value", kwlist, &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; +} +%% +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/interfacesmodule.c b/gst/interfacesmodule.c new file mode 100644 index 0000000..117068e --- /dev/null +++ b/gst/interfacesmodule.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 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; + + m = Py_InitModule ("interfaces", pyinterfaces_functions); + d = PyModule_GetDict (m); + + pyinterfaces_register_classes (d); + pyinterfaces_add_constants (m, "GST_"); + + if (PyErr_Occurred ()) { + Py_FatalError ("can't initialize module gst.interfaces"); + } +} diff --git a/gst/xoverlay.defs b/gst/xoverlay.defs new file mode 100644 index 0000000..fcffb8d --- /dev/null +++ b/gst/xoverlay.defs @@ -0,0 +1,57 @@ +;; -*- 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 get_desired_size + (of-object "GstXOverlay") + (c-name "gst_x_overlay_get_desired_size") + (return-type "none") + (parameters + '("guint*" "width") + '("guint*" "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 + '("XID" "xwindow_id") + ) +) + +(define-method got_desired_size + (of-object "GstXOverlay") + (c-name "gst_x_overlay_got_desired_size") + (return-type "none") + (parameters + '("guint" "width") + '("guint" "height") + ) +) + + diff --git a/gst/xoverlay.override b/gst/xoverlay.override new file mode 100644 index 0000000..22825c9 --- /dev/null +++ b/gst/xoverlay.override @@ -0,0 +1,24 @@ +/* -*- 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/gst/xwindowlistener.defs b/gst/xwindowlistener.defs new file mode 100644 index 0000000..b4c6815 --- /dev/null +++ b/gst/xwindowlistener.defs @@ -0,0 +1,41 @@ +;; -*- scheme -*- +; object definitions ... +(define-object XWindowListener + (in-module "Gst") + (parent "GObject") + (c-name "GstXWindowListener") + (gtype-id "GST_TYPE_XWINDOW_LISTENER") +) + +;; Enumerations and flags ... + + +;; From /opt/gnome/include/gstreamer-0.7/gst/xwindowlistener/xwindowlistener.h + +(define-function gst_x_window_listener_get_type + (c-name "gst_x_window_listener_get_type") + (return-type "GType") +) + +(define-function gst_x_window_listener_new + (c-name "gst_x_window_listener_new") + (is-constructor-of "GstXWindowListener") + (return-type "GstXWindowListener*") + (parameters + '("gchar*" "display") + '("MapWindowFunc" "map_window_func") + '("SetWindowFunc" "set_window_func") + '("gpointer" "private_data") + ) +) + +(define-method set_xid + (of-object "GstXWindowListener") + (c-name "gst_x_window_listener_set_xid") + (return-type "none") + (parameters + '("XID" "id") + ) +) + + -- 2.7.4