From c68afb5f539fdcfa72bfeeecacd449cdc4091e91 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 17 Jun 2005 10:59:47 +0000 Subject: [PATCH] Backport from 0.8 branch and added new .defs file from GStreamer 0.9 Original commit message from CVS: Backport from 0.8 branch and added new .defs file from GStreamer 0.9 --- ChangeLog | 347 +++ Makefile.am | 1 + common | 2 +- configure.ac | 16 +- examples/gst/Makefile.am | 4 +- examples/gst/audioconcat.py | 128 ++ examples/gst/gstfile.py | 241 ++ gst/Makefile.am | 23 +- gst/__init__.py | 36 + gst/arg-types.py | 62 +- gst/common.h | 16 +- gst/gst-argtypes.c | 42 + gst/gst-extrafuncs.defs | 25 + gst/gst-types.c | 70 - gst/gst-types.defs | 359 +-- gst/gst.defs | 4961 ++++++++++++++++++++-------------------- gst/gst.override | 289 ++- gst/gstbuffer.override | 182 +- gst/gstcaps.override | 400 +++- gst/gstelement.override | 94 +- gst/gstevent.override | 49 + gst/gstmodule.c | 2 + gst/gstpad.override | 452 ++-- gst/gststructure.override | 78 +- gst/pygstvalue.c | 301 +++ gst/pygstvalue.h | 29 + gst/ltihooks.py => ltihooks.py | 0 testsuite/Makefile.am | 2 +- testsuite/common.py | 44 +- testsuite/runtests.py | 10 +- testsuite/test_buffer.py | 9 +- testsuite/test_caps.py | 63 +- testsuite/test_element.py | 3 +- testsuite/test_interface.py | 5 +- testsuite/test_struct.py | 50 +- 35 files changed, 5321 insertions(+), 3074 deletions(-) create mode 100644 examples/gst/audioconcat.py create mode 100644 examples/gst/gstfile.py create mode 100644 gst/gst-extrafuncs.defs delete mode 100644 gst/gst-types.c create mode 100644 gst/gstevent.override create mode 100644 gst/pygstvalue.c create mode 100644 gst/pygstvalue.h rename gst/ltihooks.py => ltihooks.py (100%) diff --git a/ChangeLog b/ChangeLog index 907048b..fd9dcf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,350 @@ +2005-06-17 Edward Hervey + + * Backport of bugfixes/new features from 0.8 branch to HEAD + + * gst/gst.defs: + * gst/gst-types.defs: + New defs files generated from 0.9 GStreamer + + PORTING-TODO will follow + +2005-06-17 Andy Wingo + + * gst/gstcaps.override (_wrap_gst_caps_tp_richcompare): Increment + the refcount of the return value in all cases, even for Py_True + and Py_False. Lines of code per day hovering around 1.3. + +2005-06-14 Edward Hervey + + * gst/gstcaps.override: (_wrap_gst_caps_tp_str): + reverting previous fix, was incorrect + + * configure.ac: + 0.8.1.2 pre-release + + * gst/gst.override: (probe_handler_marshal): + bye bye probe memleak + +2005-06-14 Edward Hervey + + * gst/Makefile.am: (defs_DATA) (GST_OVERRIDES): + * gst/gst.defs: + * gst/gst.override: + * gst/gst-extrafuncs.defs: + * gst/gstbuffer.override: + * gst/gstevent.override: + * gst/gst-types.defs: (Buffer) (Event): + Added support for element flags (list, set, unset) + Added gst.Buffer duration field + Added gst.Event fields + +2005-06-14 Andy Wingo + + * gst/gstcaps.override (_wrap_gst_caps_tp_richcompare): Fixes for + == and != when the second arg is not a caps. + + * testsuite/test_caps.py (CapsTest.testComparisons): Fix name. + +2005-06-14 Edward Hervey + + * gst/gstcaps.override: (_wrap_gst_caps_tp_str): + proper repr of GstCaps : : ''> + +2005-06-09 Edward Hervey + + * examples/gst/gstfile.py: (Discoverer.discover): + whoops, pipeline was being run twice :) + +2005-06-09 Zaheer Abbas Merali + + * examples/gst/gstfile.py: fix typo + +2005-06-08 Edward Hervey + + * examples/gst/Makefile.am: + * examples/gst/gstfile.py: + renamed gst-file.py to gstfile.py and made the Discoverer class useable + in other applications/scripts + + * examples/gst/audioconcat.py: + Example application that uses the Discoverer and the gnonlin elements to + concatenate several audio files to one single one + +2005-06-07 Edward Hervey + + * examples/gst/Makefile.am: + * examples/gst/gst-file.py: + New example that shows how to use gst-python in an object-oriented way, + and how to override existing methods + +2005-06-02 Edward Hervey + + * gst/gstbuffer.override (_wrap_gst_buffer_set_data): + gcc 4.x bugfixes + +2005-05-04 Benjamin Otte + + * gst/gst.defs: + factory.create doesn't need a name + * gst/gst.override: + implement tp_str and tp_repr gst.Object and gst.PluginFeature + * gst/gstelement.override: + implement factory.get_pad_templates and make element.link_pads + take NULL, pads or strings as the pad argument + * gst/gstpad.override: + implement tp_getattr for GstPadTemplate + +2005-05-03 Zaheer Abbas Merali + + * gst/pygstvalue.c: (pygst_value_from_pyobject): + stupid, stupid, stupid + +2005-05-03 Benjamin Otte + + * gst/gstcaps.override: + fix uninitialized warning and refator function + +2005-05-03 Benjamin Otte + + * gst/pygstvalue.c: + * gst/gst-argtypes.c: + * gst/gst.override: + define NO_IMPORT_PYGOBJECT to have a correct extern declaration + reenable _pygst_element_init and ifdef it correctly + * gst/arg-types.py: + check errors + * gst/gstcaps.override: + - remove list append functionality. Sets don't support the + + operator + - implement richcompare and coerce, nonzero, or, xor and subtract + number functions + * testsuite/test_caps.py: + add tests for the new stuff + +2005-05-03 Thomas Vander Stichele + + * testsuite/Makefile.am: + * testsuite/common.py: + rework common so that it behaves a bit more sanely + make the inner workings more clear + +2005-05-03 Thomas Vander Stichele + + * configure.ac: + add Wall and Werror just like other modules + * gst/gst.override: + * gst/gstelement.override: + fix compile problems for Wall Werror + * testsuite/common.py: + * Makefile.am: + * gst/Makefile.am: + * gst/ltihooks.py: + * ltihooks.py: + move ltihooks to root; having it in gst was a bad hack and + breaks distcheck + +2005-05-03 Thomas Vander Stichele + + * testsuite/common.py: ltihooks only needed for uninstalled (?) + +2005-05-03 Thomas Vander Stichele + + * testsuite/runtests.py: a much nicer way of getting all the tests + +2005-05-03 Benjamin Otte + + * testsuite/Makefile.am: + run tests with GST_DEBUG=*:0 so they don't produce any debugging + output + * testsuite/test_element.py: + don't disable stderr + * gst/gstbuffer.override: + initialize size correctly + +2005-05-03 Thomas Vander Stichele + + * testsuite/runtests.py: also return exit code 1 in case of errors + +2005-05-02 Edward Hervey + + * testsuite/common.py: Added case for 64bit-system that don't have + the dl module + +2005-05-02 Benjamin Otte + + * gst/Makefile.am: + running the code generator depends on the files it uses + * gst/arg-types.py: + add GstCaps parsing + * gst/gstelement.override: + make element.link take an optional caps parameter, deprecate + element.link_filtered + * testsuite/test_caps.py: + replace caps.get_strcuture(i) calls with caps[i], the deprecation + warnings are annoying + +2005-05-01 Thomas Vander Stichele + + * testsuite/test_interface.py: + do not do stuff in a testsuite that isn't guaranteed to be there. + could do with some way of detecting and skipping. + +2005-05-01 Benjamin Otte + + * gst/gst-types.c: + remove, it's called gst-argtypes.c these days + * gst/common.h: + * gst/gst-argtypes.c: (pygst_caps_from_pyobject): + add function to transform a PyObject to a GstCaps* + * gst/gstcaps.override: + implement more sequence functions, deprecate caps.get_structure() in + favour of caps[i] and make the structure-by-reference stuff work + * gst/gststructure.override: + make structures from caps work by reference but don't die a horrible + death if the caps get removed before the structure is + * testsuite/Makefile.am: + run with G_DEBUG=fatal_warnings so we crash on g_warnings in C code + * testsuite/test_caps.py: + add some checks + +2005-04-30 Benjamin Otte + + * gst/gst.override: + pyg_register_class_init is new API, so only use it when available. + If not available gst.element_register won't work either, but I just + won't care about that right now. + +2005-04-30 Benjamin Otte + + * gst/arg-types.py: + ref the GstData we get in conversions as pygst_data_from_pyobject + doesn't do that + * gst/gst-types.c: (pygst_data_from_pyobject), + (pygst_data_to_pyobject), (PyGstData_from_value), + (PyGstData_to_value): + make GstData <=> GValue conversions use the correct G_VALUE_TYPE and + don't copy the values, but just ref them. Avoids mad buffer copying + * gst/common.h: + include GstData <=> PyObject conversion funcs + * gst/gst.override: + - wrap gst.element_register + - add _pygst_get_plugin to query the plugin used by Python. + Necessary preparation for a Python plugin loader. Returns NULL if + no plugin, in that case gst.element_register registers the element + as part of the running app. + - add a class initializer for gst.Element subtypes, that checks the + variables __gsttemplates__ and __gstdetails__ and makes the correct + gst_element_class_set_element_details and + gst_element_class_add_pad_templates calls from them. Note: This + has issues when virtual methods are enabled. + - add _pygst_element_check_error. This functions checks if Python + code raised an exception and if so calls gst_element_error on the + element and clears the error. Very useful in + loop/chain/get-functions + * gst/gstbuffer.override: + - implement buffer.copy_on_write() + - implement sq_(ass_)[item|slice] functions for GstBuffer + - fix PyBufferProcs to allow writing when buffer is writable + * gst/gstpad.override: + - wrap gst.Pad to call gst_pad_new or gst_pad_new_from_template + automatically based on arguments + - don't attach private pad data to the element private, use + g_object_set_data instead + - make attaching functions to pads use closures. Allows garbage + collecting pads where handlers have been set + - fix _repr function to only print parent element's name if parent + exists + * gst/gstmodule.c: (init_gst): + register GstData <=> GValue conversion + +2005-04-28 Benjamin Otte + + * gst/gstbuffer.override: + Let's unref the buffer we created - prevents gst.Buffer from leaking + +2005-04-27 Benjamin Otte + + * gst/gstbuffer.override: + throw TypeError if bufsize < data size. Fixes testsuite + +2005-04-26 Johan Dahlin + + * testsuite/runtests.py: Return exit code 1 if we have any failures + +2005-04-26 Benjamin Otte + + * gst/gstbuffer.override: + make Buffer() not use memory it doesn't own + * testsuite/test_buffer.py: + check that it doesn't + +2005-04-19 Edward Hervey + + * gst/gststructure.override: (_wrap_gst_structure_get_double): + Forgot to convert the returned value to a PyFloat... + +2005-04-19 Edward Hervey + + * gst/gststructure.override: (_wrap_gst_structure_get_double): + Added overriding function for getting double values from a gst.Structure + +2005-04-16 Thomas Vander Stichele + + * configure.ac: bumped back required version of pygtk; we can backport + or copy over the code generator for what we need + +2005-04-16 Jan Schmidt + + * configure.ac: + Bump GStreamer core requirement to 0.8.9 for + gst_pad_set_active_recursive. + + * gst/gst.defs: + Wrap gst_pad_set_active_recursive + +2005-04-14 Edward Hervey + + * gst/gst.defs: + Added definitions for methods of GstObject, GstElement, GstBin and Clock + so you can create derived classes with more functionnalities. + + * configure.ac: (ACLOCAL): + bumped required version of PYGTK to 2.6.0 + +2005-04-14 Andy Wingo + + * gst/__init__.py (Value, Fourcc, IntRange, DoubleRange) + (Fraction): New classes. + + * gst/gst.override (_wrap_gst_tag_list_get) + (_wrap_gst_tag_list_get_value_index) + (tag_foreach_func_dict) + (_wrap_gst_tag_list_subscript): Use gstvalue procs. + (init): Initialize the pygstvalue stuff (which involves accessing + definitions from gst/__init__.py). + + * gst/gststructure.override (_wrap_gst_structure_ass_subscript): + Just use the pygstvalue functions to do conversion. As it is right + now, it's an incompatible change with the previous behavior, + because it doesn't try to parse field values like "(fourcc)XVID". + We can restore that previous behaviour if there is a need for it. + (_wrap_gst_structure_subscript): Use gstvalue functions to do the + conversion. + + * gst/Makefile.am: Add in pygstvalue.[ch]. + + * gst/pygstvalue.h: + * gst/pygstvalue.c: New files. + (pygst_value_as_pyobject): Wraps pyg_value_as_pyobject, handling + gstvalues as well. + (pygst_value_init_for_pyobject): Sniffs a pyobject for a type and + initializes a GValue appropriately. + (pygst_value_from_pyobject): Wraps pyg_value_from_pyobject, + handling gvalues as well. + + * testsuite/test_struct.py (StructureTest.testStructureChange) + (StructureTest.testGstValue): Add some tests for GstValue wrapping. + 2005-04-25 Benjamin Otte * gst/gstbuffer.override: diff --git a/Makefile.am b/Makefile.am index b2cbf57..1512450 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,6 +11,7 @@ SUBDIRS = \ DIST_SUBDIRS = $(UNCONDDIRS) docs EXTRA_DIST = \ + ltihooks.py \ gst-python.spec.in \ gst-python.spec \ README-docs \ diff --git a/common b/common index 495d6e3..d6e46b2 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d +Subproject commit d6e46b214fac0ecb46010ff522af2f7653e1c18e diff --git a/configure.ac b/configure.ac index a709a02..b35a0d4 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,8 @@ dnl required versions of other packages AC_SUBST(PYGTK_REQ, 2.4.0) AC_SUBST(GLIB_REQ, 2.0.0) AC_SUBST(GTK_REQ, 2.0.0) -AC_SUBST(GST_REQ, 0.8.8.1) +AC_SUBST(GST_REQ, 0.8.9) + AC_DISABLE_STATIC AC_PROG_LIBTOOL @@ -145,6 +146,19 @@ esac]) AM_CONDITIONAL(BUILD_DOCS, test "x$BUILD_DOCS" = "xyes") +dnl decide on error flags +dnl if we support -Wall, set it unconditionally +AS_COMPILER_FLAG(-Wall, + PYGST_ERROR_CFLAGS="-Wall", + PYGST_ERROR_CFLAGS="") +dnl if we're in nano >= 1, add -Werror if supported +if test "x$GST_CVS" = "xyes" +then + AS_COMPILER_FLAG(-Werror, PYGST_ERROR_CFLAGS="$PYGST_ERROR_CFLAGS -Werror") +fi + +PYGST_CFLAGS="$PYGST_ERROR_CFLAGS" +AC_SUBST(PYGST_CFLAGS) dnl add debugging options ... changequote(,)dnl diff --git a/examples/gst/Makefile.am b/examples/gst/Makefile.am index e0cc5dc..bb81a9e 100644 --- a/examples/gst/Makefile.am +++ b/examples/gst/Makefile.am @@ -6,6 +6,8 @@ examples_DATA = \ filesrc.py \ gst123 \ play.py \ - vorbisplay.py + vorbisplay.py \ + gstfile.py \ + audioconcat.py EXTRA_DIST = $(examples_DATA) diff --git a/examples/gst/audioconcat.py b/examples/gst/audioconcat.py new file mode 100644 index 0000000..7acb322 --- /dev/null +++ b/examples/gst/audioconcat.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python + +# audio concat tool +# takes in one or more audio files and creates one audio file of the combination + +# Uses the gnonlin elements (http://gnonlin.sf.net/) + +import os +import sys +import gobject +import gst + +from gstfile import Discoverer, time_to_string + +class AudioSource(gst.Bin): + """A bin for audio sources with proper audio converters""" + + def __init__(self, filename, caps): + gst.Bin.__init__(self) + self.filename = filename + self.outcaps = caps + + self.filesrc = gst.element_factory_make("filesrc") + self.filesrc.set_property("location", self.filename) + self.dbin = gst.element_factory_make("decodebin") + self.ident = gst.element_factory_make("identity") + self.audioconvert = gst.element_factory_make("audioconvert") + self.audioscale = gst.element_factory_make("audioscale") + + self.add_many(self.filesrc, self.dbin, self.ident, + self.audioconvert, self.audioscale) + self.filesrc.link(self.dbin) + self.audioconvert.link(self.audioscale) + self.audioscale.link(self.ident, caps) + self.add_ghost_pad(self.ident.get_pad("src"), "src") + + self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb) + + def _new_decoded_pad_cb(self, dbin, pad, is_last): + if not "audio" in pad.get_caps().to_string(): + return + pad.link(self.audioconvert.get_pad("sink")) + +gobject.type_register(AudioSource) + +class AudioConcat(gst.Thread): + """A Gstreamer thread that concatenates a series of audio files to another audio file""" + + def __init__(self, infiles, outfile, audioenc="rawvorbisenc", muxer="oggmux"): + gst.Thread.__init__(self) + self.infiles = infiles + self.outfile = outfile + self.audioenc = gst.element_factory_make(audioenc) + if not self.audioenc: + raise NameError, str(audioenc + " audio encoder is not available") + self.muxer = gst.element_factory_make(muxer) + if not self.muxer: + raise NameError, str(muxer + " muxer is not available") + self.filesink = gst.element_factory_make("filesink") + self.filesink.set_property("location", self.outfile) + + self.timeline = gst.element_factory_make("gnltimeline") + self.audiocomp = gst.element_factory_make("gnlcomposition", "audiocomp") + + self.audioconvert = gst.element_factory_make("audioconvert") + self.add_many(self.timeline, self.audioconvert, + self.audioenc, self.muxer, self.filesink) + + ## identity perfect stream check ! + identity = gst.element_factory_make("identity") + identity.set_property("check-perfect", True) + self.add(identity) + + #self.audioconvert.link(self.audioenc) + if not self.audioconvert.link(identity): + print "couldn't link audioconv -> ident" + if not identity.link(self.audioenc): + print "couldn't link ident -> audioenc" + self.audioenc.link(self.muxer) + self.muxer.link(self.filesink) + + self.timeline.add(self.audiocomp) + + caps = gst.caps_from_string("audio/x-raw-int,channels=2,rate=44100,depth=16") + pos = 0L + for infile in self.infiles: + d = Discoverer(infile) + if not d.audiolength: + continue + print "file", infile, "has length", time_to_string(d.audiolength) + asource = AudioSource(infile, caps) + gnlsource = gst.element_factory_make("gnlsource") + gnlsource.set_property("element", asource) + gnlsource.set_property("media-start", 0L) + gnlsource.set_property("media-stop", d.audiolength) + gnlsource.set_property("start", pos) + gnlsource.set_property("stop", pos + d.audiolength) + self.audiocomp.add(gnlsource) + pos += d.audiolength + + self.timeline.get_pad("src_audiocomp").link(self.audioconvert.get_pad("sink")) + timelineprobe = gst.Probe(False, self.timelineprobe) + self.timeline.get_pad("src_audiocomp").add_probe(timelineprobe) + + def timelineprobe(self, probe, data): + if isinstance(data, gst.Buffer): + print "timeline outputs buffer", data.timestamp, data.duration + else: + print "timeline ouputs event", data.type + return True + +gobject.type_register(AudioConcat) + +def eos_cb(pipeline): + sys.exit() + +if __name__ == "__main__": + if len(sys.argv) < 3: + print "Usage : %s " % sys.argv[0] + print "\tCreates an ogg file from all the audio input files" + sys.exit() + if not gst.element_factory_make("gnltimeline"): + print "You need the gnonlin elements installed (http://gnonlin.sf.net/)" + sys.exit() + concat = AudioConcat(sys.argv[1:-1], sys.argv[-1]) + concat.connect("eos", eos_cb) + concat.set_state(gst.STATE_PLAYING) + gst.main() diff --git a/examples/gst/gstfile.py b/examples/gst/gstfile.py new file mode 100644 index 0000000..49c0c59 --- /dev/null +++ b/examples/gst/gstfile.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python + +# gstfile.py +# (c) 2005 Edward Hervey +# Discovers and prints out multimedia information of files + +# This example shows how to use gst-python: +# _ in an object-oriented way (Discoverer class) +# _ subclassing a gst.Pipeline +# _ and overidding existing methods (do_iterate()) + +import os +import sys + +import gobject +import gst + +def time_to_string(value): + """ + transform a value in nanoseconds into a human-readable string + """ + ms = value / gst.MSECOND + sec = ms / 1000 + ms = ms % 1000 + min = sec / 60 + sec = sec % 60 + return "%2dm %2ds %3d" % (min, sec, ms) + + +class Discoverer(gst.Pipeline): + """ + Discovers information about files + """ + mimetype = None + + audiocaps = {} + videocaps = {} + + videowidth = 0 + videoheight = 0 + videorate = 0 + + audiofloat = False + audiorate = 0 + audiodepth = 0 + audiowidth = 0 + audiochannels = 0 + + audiolength = 0L + videolength = 0L + + is_video = False + is_audio = False + + otherstreams = [] + + finished = False + tags = {} + + + def __init__(self, filename): + gobject.GObject.__init__(self) + + self.mimetype = None + + self.audiocaps = {} + self.videocaps = {} + + self.videowidth = 0 + self.videoheight = 0 + self.videorate = 0 + + self.audiofloat = False + self.audiorate = 0 + self.audiodepth = 0 + self.audiowidth = 0 + self.audiochannels = 0 + + self.audiolength = 0L + self.videolength = 0L + + self.is_video = False + self.is_audio = False + + self.otherstreams = [] + + self.finished = False + self.tags = {} + + if not os.path.isfile(filename): + self.finished = True + return + + # the initial elements of the pipeline + self.src = gst.element_factory_make("filesrc") + self.src.set_property("location", filename) + self.src.set_property("blocksize", 1000000) + self.dbin = gst.element_factory_make("decodebin") + self.add_many(self.src, self.dbin) + self.src.link(self.dbin) + self.typefind = self.dbin.get_by_name("typefind") + + # callbacks + self.typefind.connect("have-type", self._have_type_cb) + self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb) + self.dbin.connect("unknown-type", self._unknown_type_cb) + self.dbin.connect("found-tag", self._found_tag_cb) + + self.discover() + + def discover(self): + """iterate on ourself to find the information on the given file""" + if self.finished: + return + self.set_state(gst.STATE_PLAYING) + while 1: + if not self.iterate(): + break + self.set_state(gst.STATE_NULL) + self.finished = True + + def print_info(self): + """prints out the information on the given file""" + if not self.finished: + self.discover() + if not self.mimetype: + print "Unknown media type" + return + print "Mime Type :\t", self.mimetype + if not self.is_video and not self.is_audio: + return + print "Length :\t", time_to_string(max(self.audiolength, self.videolength)) + print "\tAudio:", time_to_string(self.audiolength), "\tVideo:", time_to_string(self.videolength) + if self.is_video: + print "Video :" + print "\t%d x %d @ %.2f fps" % (self.videowidth, + self.videoheight, + self.videorate) + if self.tags.has_key("video-codec"): + print "\tCodec :", self.tags.pop("video-codec") + if self.is_audio: + print "Audio :" + if self.audiofloat: + print "\t%d channels(s) : %dHz @ %dbits (float)" % (self.audiochannels, + self.audiorate, + self.audiowidth) + else: + print "\t%d channels(s) : %dHz @ %dbits (int)" % (self.audiochannels, + self.audiorate, + self.audiodepth) + if self.tags.has_key("audio-codec"): + print "\tCodec :", self.tags.pop("audio-codec") + for stream in self.otherstreams: + if not stream == self.mimetype: + print "Other unsuported Multimedia stream :", stream + if self.tags: + print "Additional information :" + for tag in self.tags.keys(): + print "%20s :\t" % tag, self.tags[tag] + + def _unknown_type_cb(self, dbin, pad, caps): + self.otherstreams.append(caps.to_string()) + + def _have_type_cb(self, typefind, prob, caps): + self.mimetype = caps.to_string() + + def _notify_caps_cb(self, pad, args): + caps = pad.get_negotiated_caps() + if not caps: + return + # the caps are fixed + # We now get the total length of that stream + length = pad.get_peer().query(gst.QUERY_TOTAL, gst.FORMAT_TIME) + # We store the caps and length in the proper location + if "audio" in caps.to_string(): + self.audiocaps = caps + self.audiolength = length + self.audiorate = caps[0]["rate"] + self.audiowidth = caps[0]["width"] + self.audiochannels = caps[0]["channels"] + if "x-raw-float" in caps.to_string(): + self.audiofloat = True + else: + self.audiodepth = caps[0]["depth"] + if (not self.is_video) or self.videocaps: + self.finished = True + elif "video" in caps.to_string(): + self.videocaps = caps + self.videolength = length + self.videowidth = caps[0]["width"] + self.videoheight = caps[0]["height"] + self.videorate = caps[0]["framerate"] + if (not self.is_audio) or self.audiocaps: + self.finished = True + + def _new_decoded_pad_cb(self, dbin, pad, is_last): + # Does the file contain got audio or video ? + if "audio" in pad.get_caps().to_string(): + self.is_audio = True + elif "video" in pad.get_caps().to_string(): + self.is_video = True + if is_last and not self.is_video and not self.is_audio: + self.finished = True + return + # we connect a fakesink to the new pad... + fakesink = gst.element_factory_make("fakesink") + self.add(fakesink) + sinkpad = fakesink.get_pad("sink") + # ... and connect a callback for when the caps are fixed + sinkpad.connect("notify::caps", self._notify_caps_cb) + pad.link(sinkpad) + fakesink.set_state(gst.STATE_PLAYING) + + def _found_tag_cb(self, dbin, source, tags): + self.tags.update(tags) + + def do_iterate(self): + # this overrides the GstBin 'iterate' method + # if we have finished discovering we stop the iteration + if self.finished: + return False + # else we call the parent class method + return gst.Pipeline.do_iterate(self) + +gobject.type_register(Discoverer) + +def main(args): + if len(args) < 2: + print 'usage: %s files...' % args[0] + return 2 + + if len(args[1:]) > 1: + for filename in args[1:]: + print "File :", filename + Discoverer(filename).print_info() + print "\n" + else: + Discoverer(args[1]).print_info() + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/gst/Makefile.am b/gst/Makefile.am index cb65ad4..807cd26 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -1,4 +1,4 @@ -common_cflags = $(PYGTK_CFLAGS) $(GST_CFLAGS) -fno-strict-aliasing +common_cflags = $(PYGTK_CFLAGS) $(GST_CFLAGS) $(PYGST_CFLAGS) -fno-strict-aliasing common_libadd = $(GST_LIBS) common_ldflags = -module -avoid-version @@ -22,20 +22,22 @@ else play_lib = endif -defs_DATA = gst-types.defs +defs_DATA = gst-types.defs \ + gst-extrafuncs.defs defsdir = $(pkgdatadir)/2.0/defs -noinst_HEADERS = common.h +noinst_HEADERS = common.h pygstvalue.h INCLUDES = $(PYTHON_INCLUDES) -EXTRA_DIST = $(defs_DATA) common.h arg-types.py ltihooks.py +EXTRA_DIST = $(defs_DATA) common.h arg-types.py PYGTK_DEFSDIR = @PYGTK_DEFSDIR@ +GEN_FILES = arg-types.py gst-types.defs # GStreamer bindings _gst_la_CFLAGS = $(common_cflags) _gst_la_LIBADD = $(common_libadd) _gst_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gst -_gst_la_SOURCES = gst-argtypes.c gstmodule.c +_gst_la_SOURCES = gst-argtypes.c gstmodule.c pygstvalue.c nodist__gst_la_SOURCES = gst.c GST_OVERRIDES = \ gst.override \ @@ -43,13 +45,14 @@ GST_OVERRIDES = \ gstbuffer.override \ gstcaps.override \ gstelement.override \ + gstevent.override \ gstpad.override \ gststructure.override -GST_DEFS = gst.defs gst-types.defs +GST_DEFS = gst.defs gst-types.defs gst-extrafuncs.defs CLEANFILES = gst.c EXTRA_DIST += $(GST_DEFS) $(GST_OVERRIDES) -gst.c: $(GST_DEFS) $(GST_OVERRIDES) +gst.c: $(GST_DEFS) $(GST_OVERRIDES) $(GEN_FILES) # gst-play bindings play_la_CFLAGS = $(common_cflags) $(GST_PLAY_CFLAGS) @@ -61,7 +64,7 @@ PLAY_OVERRIDES = play.override PLAY_DEFS = play.defs CLEANFILES += play.c EXTRA_DIST += $(PLAY_DEFS) $(PLAY_OVERRIDES) -play.c: $(PLAY_DEFS) $(PLAY_OVERRIDES) +play.c: $(PLAY_DEFS) $(PLAY_OVERRIDES) $(GEN_FILES) # GStreamer interfaces bindings interfaces_la_CFLAGS = $(common_cflags) $(GST_INTERFACES_CFLAGS) @@ -73,9 +76,9 @@ INTERFACES_OVERRIDES = interfaces.override xoverlay.override INTERFACES_DEFS = interfaces.defs xoverlay.defs xwindowlistener.defs CLEANFILES += interfaces.c EXTRA_DIST += $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) -interfaces.c: $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) +interfaces.c: $(INTERFACES_DEFS) $(INTERFACES_OVERRIDES) $(GEN_FILES) -.defs.c: +.defs.c: (cd $(srcdir) \ && $(PYGTK_CODEGEN) \ --load-types $(srcdir)/arg-types.py \ diff --git a/gst/__init__.py b/gst/__init__.py index fa98961..711b53d 100644 --- a/gst/__init__.py +++ b/gst/__init__.py @@ -36,4 +36,40 @@ try: except ImportError: pass +class Value: + def __init__(self, type): + assert type in ('fourcc', 'intrange', 'doublerange', 'fraction') + self.type = type + +class Fourcc(Value): + def __init__(self, string): + Value.__init__(self, 'fourcc') + self.fourcc = string + def __repr__(self): + return '' % self.fourcc + +class IntRange(Value): + def __init__(self, low, high): + Value.__init__(self, 'intrange') + self.low = low + self.high = high + def __repr__(self): + return '' % (self.low, self.high) + +class DoubleRange(Value): + def __init__(self, low, high): + Value.__init__(self, 'doublerange') + self.low = low + self.high = high + def __repr__(self): + return '' % (self.low, self.high) + +class Fraction(Value): + def __init__(self, num, denom): + Value.__init__(self, 'fraction') + self.num = num + self.denom = denom + def __repr__(self): + return '' % (self.num, self.denom) + from _gst import * diff --git a/gst/arg-types.py b/gst/arg-types.py index affbd11..36d3c21 100644 --- a/gst/arg-types.py +++ b/gst/arg-types.py @@ -26,13 +26,15 @@ from argtypes import UInt64Arg, Int64Arg, PointerArg, ArgMatcher, ArgType, match class GstDataPtrArg(ArgType): normal = (' if (!pygst_data_from_pyobject(py_%(name)s, &%(name)s))\n' - ' return NULL;\n') + ' return NULL;\n' + ' gst_data_ref (%(name)s);\n') null = (' if (py_%(name)s == Py_None)\n' ' %(name)s = NULL;\n' ' else if (pyst_data_from_pyobject(py_%(name)s, %(name)s_rect))\n' ' %(name)s = &%(name)s_rect;\n' ' else\n' - ' return NULL;\n') + ' return NULL;\n' + ' gst_data_ref (%(name)s);\n') def write_param(self, ptype, pname, pdflt, pnull, info): if pnull: info.varlist.add('GstData', pname + '_data') @@ -84,7 +86,7 @@ class XmlNodeArg(ArgType): info.add_parselist('O', ['&py'+pname], [pname]) info.arglist.append(pname) self.names["name"] = pname - info.codebefore.append(self.parm %self.names) + info.codebefore.append(self.parm % self.names) info.codeafter.append(self.parmp % self.names); def write_return(self, ptype, ownsreturn, info): info.varlist.add('PyObject', '*xml = _gst_get_libxml2_module()') @@ -101,12 +103,66 @@ class XmlDocArg(XmlNodeArg): "xptr":"xmlDocPtr", "xwrap":"libxml_xmlDocPtrWrap"} +class GstCapsArg(ArgType): + """GstCaps node generator""" + + before = (' %(name)s = pygst_caps_from_pyobject (py_%(name)s, %(namecopy)s);\n' + ' if (PyErr_Occurred())\n' + ' return NULL;\n') + beforenull = (' if (py_%(name)s == Py_None)\n' + ' %(name)s = NULL;\n' + ' else\n' + ' ' + before) + after = (' if (%(name)s && %(name)s_is_copy)\n' + ' gst_caps_free (%(name)s);\n') + + def write_param(self, ptype, pname, pdflt, pnull, info): + if ptype == 'const-GstCaps*': + self.write_const_param(pname, pdflt, pnull, info) + elif ptype == 'GstCaps*': + self.write_normal_param(pname, pdflt, pnull, info) + else: + raise RuntimeError, "write_param not implemented for %s" % ptype + def write_const_param(self, pname, pdflt, pnull, info): + info.varlist.add('PyObject', '*py_'+pname) + info.varlist.add('GstCaps', '*'+pname) + info.varlist.add('gboolean', pname+'_is_copy') + info.add_parselist('O', ['&py_'+pname], [pname]) + info.arglist.append(pname) + if pnull: + info.codebefore.append (self.beforenull % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) + else: + info.codebefore.append (self.before % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) + info.codeafter.append (self.after % { 'name' : pname, 'namecopy' : '&'+pname+'_is_copy' }) + def write_normal_param(self, pname, pdflt, pnull, info): + info.varlist.add('PyObject', '*py_'+pname) + info.varlist.add('GstCaps', '*'+pname) + info.add_parselist('O', ['&py_'+pname], [pname]) + info.arglist.append(pname) + if pnull: + info.codebefore.append (self.beforenull % { 'name' : pname, 'namecopy' : 'NULL' }) + else: + info.codebefore.append (self.before % { 'name' : pname, 'namecopy' : 'NULL' }) + + def write_return(self, ptype, ownsreturn, info): + if ptype == 'GstCaps*': + info.varlist.add('GstCaps', '*ret') + copyval = 'FALSE' + elif ptype == 'const-GstCaps*': + info.varlist.add('const GstCaps', '*ret') + copyval = 'TRUE' + else: + raise RuntimeError, "write_return not implemented for %s" % ptype + info.codeafter.append(' return pyg_boxed_new (GST_TYPE_CAPS, ret, '+copyval+', TRUE);') matcher.register('GstData*', GstDataPtrArg()) matcher.register('GstClockTime', UInt64Arg()) matcher.register('GstClockTimeDiff', Int64Arg()) matcher.register('xmlNodePtr', XmlNodeArg()) matcher.register('xmlDocPtr', XmlDocArg()) +matcher.register('GstCaps', GstCapsArg()) #FIXME: does this work? +matcher.register('GstCaps*', GstCapsArg()) #FIXME: does this work? +matcher.register('const-GstCaps*', GstCapsArg()) arg = PointerArg('gpointer', 'G_TYPE_POINTER') matcher.register('GstClockID', arg) diff --git a/gst/common.h b/gst/common.h index 83bee09..75bd2e9 100644 --- a/gst/common.h +++ b/gst/common.h @@ -23,6 +23,7 @@ #define __COMMON_H__ #include +#include #include "pygobject.h" @@ -32,14 +33,21 @@ typedef struct { PyGObject *pad; - PyObject *link_function; - PyObject *event_function; - PyObject *chain_function; - PyObject *get_function; + GClosure *link_function; + GClosure *event_function; + GClosure *chain_function; + GClosure *get_function; + GClosure *getcaps_function; } PyGstPadPrivate; typedef struct { PyObject *func, *data; } PyGstCustomNotify; +/* from gst-types.c */ +gboolean pygst_data_from_pyobject(PyObject *object, GstData **data); +PyObject *pygst_data_to_pyobject(GstData *data); +GstCaps *pygst_caps_from_pyobject (PyObject *object, gboolean *copy); + + #endif /* __COMMON_H__ */ diff --git a/gst/gst-argtypes.c b/gst/gst-argtypes.c index 7f2d40b..d78ce42 100644 --- a/gst/gst-argtypes.c +++ b/gst/gst-argtypes.c @@ -19,6 +19,10 @@ * Author: Johan Dahlin */ +/* define this for all source files that don't run init_pygobject() + * before including pygobject.h */ +#define NO_IMPORT_PYGOBJECT + #include #include "common.h" @@ -61,6 +65,44 @@ PyGstData_to_value(GValue *value, PyObject *object) return 0; } +/* This function will return a copy, unless the following is all TRUE: + * - The given PyObject contains a GstCaps already + * - The copy parameter is non-NULL + * - New years is the first of January + * If copy is non-NULL, it is set to TRUE if a copy was made. + * If the PyObject could not be converted to a caps, a TypeError is raised + * and NULL is returned. + */ +GstCaps * +pygst_caps_from_pyobject (PyObject *object, gboolean *copy) +{ + if (pyg_boxed_check(object, GST_TYPE_CAPS)) { + GstCaps *caps = pyg_boxed_get(object, GstCaps); + if (copy) { + *copy = FALSE; + return caps; + } else { + return gst_caps_copy (caps); + } + } else if (pyg_boxed_check(object, GST_TYPE_STRUCTURE)) { + GstStructure *structure = pyg_boxed_get(object, GstStructure); + if (copy) + *copy = TRUE; + return gst_caps_new_full (gst_structure_copy (structure), NULL); + } else if (PyString_Check (object)) { + GstCaps *caps = gst_caps_from_string (PyString_AsString (object)); + if (!caps) { + PyErr_SetString(PyExc_TypeError, "could not convert string to GstCaps"); + return NULL; + } + if (copy) + *copy = TRUE; + return caps; + } + PyErr_SetString(PyExc_TypeError, "could not convert to GstCaps"); + return NULL; +} + void _pygst_register_boxed_types(PyObject *moddict) { diff --git a/gst/gst-extrafuncs.defs b/gst/gst-extrafuncs.defs new file mode 100644 index 0000000..c9e10b8 --- /dev/null +++ b/gst/gst-extrafuncs.defs @@ -0,0 +1,25 @@ +; -*- scheme -*- + +(define-method flags + (of-object "GstElement") + (c-name "GST_FLAGS") + (return-type "GstElementFlags") +) + +(define-method set_flag + (of-object "GstObject") + (c-name "GST_FLAG_SET") + (return-type "none") + (parameters + '("GstObjectFlags" "flags") + ) +) + +(define-method unset_flag + (of-object "GstObject") + (c-name "GST_FLAG_UNSET") + (return-type "none") + (parameters + '("GstObjectFlags" "flag") + ) +) \ No newline at end of file diff --git a/gst/gst-types.c b/gst/gst-types.c deleted file mode 100644 index 67364b8..0000000 --- a/gst/gst-types.c +++ /dev/null @@ -1,70 +0,0 @@ -/* gst-python - * Copyright (C) 2004 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Johan Dahlin - */ - -#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-types.defs b/gst/gst-types.defs index 7631ca9..ffb5bdf 100644 --- a/gst/gst-types.defs +++ b/gst/gst-types.defs @@ -6,9 +6,6 @@ (parent "GObject") (c-name "GstObject") (gtype-id "GST_TYPE_OBJECT") - (fields - '("guint32" "flags") - ) ) (define-object Index @@ -39,18 +36,18 @@ (gtype-id "GST_TYPE_CLOCK") ) -(define-object Pad +(define-object Bus (in-module "Gst") (parent "GstObject") - (c-name "GstPad") - (gtype-id "GST_TYPE_PAD") + (c-name "GstBus") + (gtype-id "GST_TYPE_BUS") ) -(define-object GhostPad +(define-object Pad (in-module "Gst") - (parent "GstPad") - (c-name "GstGhostPad") - (gtype-id "GST_TYPE_GHOST_PAD") + (parent "GstObject") + (c-name "GstPad") + (gtype-id "GST_TYPE_PAD") ) (define-object PadTemplate @@ -95,13 +92,6 @@ (gtype-id "GST_TYPE_QUEUE") ) -(define-object RealPad - (in-module "Gst") - (parent "GstPad") - (c-name "GstRealPad") - (gtype-id "GST_TYPE_REAL_PAD") -) - (define-object Registry (in-module "Gst") (parent "GObject") @@ -130,11 +120,11 @@ (gtype-id "GST_TYPE_SYSTEM_CLOCK") ) -(define-object Thread +(define-object Task (in-module "Gst") - (parent "GstBin") - (c-name "GstThread") - (gtype-id "GST_TYPE_THREAD") + (parent "GstObject") + (c-name "GstTask") + (gtype-id "GST_TYPE_TASK") ) (define-object TypeFindFactory @@ -151,67 +141,47 @@ (gtype-id "GST_TYPE_XML") ) -;; -;; Boxed types -;; +:: +:: MiniObject types +:: -(define-boxed Buffer +(define-object Buffer (in-module "Gst") + (parent "GstMiniObject") (c-name "GstBuffer") (gtype-id "GST_TYPE_BUFFER") - (copy-func "gst_buffer_copy") - (release-func "gst_data_unref") - (fields - ;; GstData fields - '("GType" "data_type") - '("guint16" "flags") - - ;; GstBuffer fields - '("guint" "size") - '("guint" "maxsize") - '("guint64" "offset") - '("guint64" "offset_end") - '("GstClockTime" "timestamp") - ) ) -(define-boxed Caps +(define-object Event (in-module "Gst") - (c-name "GstCaps") - (gtype-id "GST_TYPE_CAPS") + (parent "GstMiniObject") + (c-name "GstEvent") + (gtype-id "GST_TYPE_EVENT") ) -(define-boxed Probe +(define-object Message (in-module "Gst") - (c-name "GstProbe") - (gtype-id "GST_TYPE_PROBE") + (parent "GstMiniObject") + (c-name "GstMessage") + (gtype-id "GST_TYPE_MESSAGE") ) -; Defined in arg-types.py -;(define-boxed Data -; (in-module "Gst") -; (c-name "GstData") -; (gtype-id "GST_TYPE_DATA") -; (copy-func "gst_data_copy") -; (release-func "gst_data_free") -;) - -(define-boxed Event +(define-object Query (in-module "Gst") - (c-name "GstEvent") - (gtype-id "GST_TYPE_EVENT") + (parent "GstMiniObject") + (c-name "GstQuery") + (gtype-id "GST_TYPE_QUERY") ) -(define-boxed GError + +;; +;; Boxed types +;; + +(define-boxed Caps (in-module "Gst") - (c-name "GError") - (gtype-id "GST_TYPE_G_ERROR") - (copy-func "g_error_copy") - (release-func "g_error_free") - (fields - '("GQuark" "domain") - '("gint" "code") - '("gchar*" "message")) + (c-name "GstCaps") + (gtype-id "GST_TYPE_CAPS") ) (define-boxed Plugin @@ -235,7 +205,6 @@ (gtype-id "GST_TYPE_TAG_LIST") ) - ;; Enumerations and flags ... (define-enum BinFlags @@ -243,47 +212,44 @@ (c-name "GstBinFlags") (gtype-id "GST_TYPE_BIN_FLAGS") (values - '("flag-manager" "GST_BIN_FLAG_MANAGER") - '("self-schedulable" "GST_BIN_SELF_SCHEDULABLE") - '("flag-prefer-cothreads" "GST_BIN_FLAG_PREFER_COTHREADS") - '("flag-fixed-clock" "GST_BIN_FLAG_FIXED_CLOCK") - '("flag-last" "GST_BIN_FLAG_LAST") + '("t" "GST_BIN_FLAG_LAST") ) ) -(define-enum BufferFlag +(define-flags BufferFlag (in-module "Gst") (c-name "GstBufferFlag") (gtype-id "GST_TYPE_BUFFER_FLAG") (values - '("readonly" "GST_BUFFER_READONLY") - '("subbuffer" "GST_BUFFER_SUBBUFFER") - '("original" "GST_BUFFER_ORIGINAL") - '("dontfree" "GST_BUFFER_DONTFREE") - '("key-unit" "GST_BUFFER_KEY_UNIT") - '("dontkeep" "GST_BUFFER_DONTKEEP") - '("flag-last" "GST_BUFFER_FLAG_LAST") + '("readonly" "GST_BUFFER_FLAG_READONLY") + '("original" "GST_BUFFER_FLAG_ORIGINAL") + '("preroll" "GST_BUFFER_FLAG_PREROLL") + '("discont" "GST_BUFFER_FLAG_DISCONT") + '("in-caps" "GST_BUFFER_FLAG_IN_CAPS") + '("gap" "GST_BUFFER_FLAG_GAP") + '("delta-unit" "GST_BUFFER_FLAG_DELTA_UNIT") + '("last" "GST_BUFFER_FLAG_LAST") ) ) -(define-enum ClockEntryStatus +(define-enum BusFlags (in-module "Gst") - (c-name "GstClockEntryStatus") - (gtype-id "GST_TYPE_CLOCK_ENTRY_STATUS") + (c-name "GstBusFlags") + (gtype-id "GST_TYPE_BUS_FLAGS") (values - '("ok" "GST_CLOCK_ENTRY_OK") - '("early" "GST_CLOCK_ENTRY_EARLY") - '("restart" "GST_CLOCK_ENTRY_RESTART") + '("ushing" "GST_BUS_FLUSHING") + '("ag-last" "GST_BUS_FLAG_LAST") ) ) -(define-enum ClockEntryType +(define-enum BusSyncReply (in-module "Gst") - (c-name "GstClockEntryType") - (gtype-id "GST_TYPE_CLOCK_ENTRY_TYPE") + (c-name "GstBusSyncReply") + (gtype-id "GST_TYPE_BUS_SYNC_REPLY") (values - '("single" "GST_CLOCK_ENTRY_SINGLE") - '("periodic" "GST_CLOCK_ENTRY_PERIODIC") + '("drop" "GST_BUS_DROP") + '("pass" "GST_BUS_PASS") + '("async" "GST_BUS_ASYNC") ) ) @@ -292,14 +258,26 @@ (c-name "GstClockReturn") (gtype-id "GST_TYPE_CLOCK_RETURN") (values - '("stopped" "GST_CLOCK_STOPPED") - '("timeout" "GST_CLOCK_TIMEOUT") + '("ok" "GST_CLOCK_OK") '("early" "GST_CLOCK_EARLY") + '("unscheduled" "GST_CLOCK_UNSCHEDULED") + '("busy" "GST_CLOCK_BUSY") + '("badtime" "GST_CLOCK_BADTIME") '("error" "GST_CLOCK_ERROR") '("unsupported" "GST_CLOCK_UNSUPPORTED") ) ) +(define-enum ClockEntryType + (in-module "Gst") + (c-name "GstClockEntryType") + (gtype-id "GST_TYPE_CLOCK_ENTRY_TYPE") + (values + '("single" "GST_CLOCK_ENTRY_SINGLE") + '("periodic" "GST_CLOCK_ENTRY_PERIODIC") + ) +) + (define-flags ClockFlags (in-module "Gst") (c-name "GstClockFlags") @@ -310,29 +288,6 @@ '("do-periodic-sync" "GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC") '("do-periodic-async" "GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC") '("set-resolution" "GST_CLOCK_FLAG_CAN_SET_RESOLUTION") - '("set-speed" "GST_CLOCK_FLAG_CAN_SET_SPEED") - ) -) - -(define-flags CPUFlags - (in-module "Gst") - (c-name "GstCPUFlags") - (gtype-id "GST_TYPE_CPU_FLAGS") - (values - '("mmx" "GST_CPU_FLAG_MMX") - '("sse" "GST_CPU_FLAG_SSE") - '("mmxext" "GST_CPU_FLAG_MMXEXT") - '("3dnow" "GST_CPU_FLAG_3DNOW") - ) -) - -(define-enum DataFlags - (in-module "Gst") - (c-name "GstDataFlags") - (gtype-id "GST_TYPE_DATA_FLAGS") - (values - '("readonly" "GST_DATA_READONLY") - '("flag-last" "GST_DATA_FLAG_LAST") ) ) @@ -341,17 +296,10 @@ (c-name "GstElementFlags") (gtype-id "GST_TYPE_ELEMENT_FLAGS") (values - '("complex" "GST_ELEMENT_COMPLEX") - '("decoupled" "GST_ELEMENT_DECOUPLED") - '("thread-suggested" "GST_ELEMENT_THREAD_SUGGESTED") - '("infinite-loop" "GST_ELEMENT_INFINITE_LOOP") - '("new-loopfunc" "GST_ELEMENT_NEW_LOOPFUNC") - '("event-aware" "GST_ELEMENT_EVENT_AWARE") - '("use-threadsafe-properties" "GST_ELEMENT_USE_THREADSAFE_PROPERTIES") '("scheduler-private1" "GST_ELEMENT_SCHEDULER_PRIVATE1") '("scheduler-private2" "GST_ELEMENT_SCHEDULER_PRIVATE2") '("locked-state" "GST_ELEMENT_LOCKED_STATE") - '("in-error" "GST_ELEMENT_IN_ERROR") + '("is-sink" "GST_ELEMENT_IS_SINK") '("flag-last" "GST_ELEMENT_FLAG_LAST") ) ) @@ -442,17 +390,11 @@ '("unknown" "GST_EVENT_UNKNOWN") '("eos" "GST_EVENT_EOS") '("flush" "GST_EVENT_FLUSH") - '("empty" "GST_EVENT_EMPTY") '("discontinuous" "GST_EVENT_DISCONTINUOUS") '("qos" "GST_EVENT_QOS") '("seek" "GST_EVENT_SEEK") - '("seek-segment" "GST_EVENT_SEEK_SEGMENT") - '("segment-done" "GST_EVENT_SEGMENT_DONE") '("size" "GST_EVENT_SIZE") '("rate" "GST_EVENT_RATE") - '("filler" "GST_EVENT_FILLER") - '("ts-offset" "GST_EVENT_TS_OFFSET") - '("interrupt" "GST_EVENT_INTERRUPT") '("navigation" "GST_EVENT_NAVIGATION") '("tag" "GST_EVENT_TAG") ) @@ -548,6 +490,7 @@ (values '("none" "GST_ASSOCIATION_FLAG_NONE") '("key-unit" "GST_ASSOCIATION_FLAG_KEY_UNIT") + '("delta-unit" "GST_ASSOCIATION_FLAG_DELTA_UNIT") '("last" "GST_ASSOCIATION_FLAG_LAST") ) ) @@ -615,14 +558,71 @@ ) ) +(define-enum IteratorResult + (in-module "Gst") + (c-name "GstIteratorResult") + (gtype-id "GST_TYPE_ITERATOR_RESULT") + (values + '("done" "GST_ITERATOR_DONE") + '("ok" "GST_ITERATOR_OK") + '("resync" "GST_ITERATOR_RESYNC") + '("error" "GST_ITERATOR_ERROR") + ) +) + +(define-enum IteratorItem + (in-module "Gst") + (c-name "GstIteratorItem") + (gtype-id "GST_TYPE_ITERATOR_ITEM") + (values + '("skip" "GST_ITERATOR_ITEM_SKIP") + '("pass" "GST_ITERATOR_ITEM_PASS") + '("end" "GST_ITERATOR_ITEM_END") + ) +) + +(define-flags MessageType + (in-module "Gst") + (c-name "GstMessageType") + (gtype-id "GST_TYPE_MESSAGE_TYPE") + (values + '("unknown" "GST_MESSAGE_UNKNOWN") + '("eos" "GST_MESSAGE_EOS") + '("error" "GST_MESSAGE_ERROR") + '("warning" "GST_MESSAGE_WARNING") + '("info" "GST_MESSAGE_INFO") + '("tag" "GST_MESSAGE_TAG") + '("buffering" "GST_MESSAGE_BUFFERING") + '("state-changed" "GST_MESSAGE_STATE_CHANGED") + '("step-done" "GST_MESSAGE_STEP_DONE") + '("new-clock" "GST_MESSAGE_NEW_CLOCK") + '("structure-change" "GST_MESSAGE_STRUCTURE_CHANGE") + '("stream-status" "GST_MESSAGE_STREAM_STATUS") + '("application" "GST_MESSAGE_APPLICATION") + '("any" "GST_MESSAGE_ANY") + ) +) + +(define-flags MiniObjectFlags + (in-module "Gst") + (c-name "GstMiniObjectFlags") + (gtype-id "GST_TYPE_MINI_OBJECT_FLAGS") + (values + '("readonly" "GST_MINI_OBJECT_FLAG_READONLY") + '("static" "GST_MINI_OBJECT_FLAG_STATIC") + '("last" "GST_MINI_OBJECT_FLAG_LAST") + ) +) + (define-enum ObjectFlags (in-module "Gst") (c-name "GstObjectFlags") (gtype-id "GST_TYPE_OBJECT_FLAGS") (values - '("destroyed" "GST_DESTROYED") - '("floating" "GST_FLOATING") - '("object-flag-last" "GST_OBJECT_FLAG_LAST") + '("disposing" "GST_OBJECT_DISPOSING") + '("destroyed" "GST_OBJECT_DESTROYED") + '("floating" "GST_OBJECT_FLOATING") + '("flag-last" "GST_OBJECT_FLAG_LAST") ) ) @@ -631,10 +631,39 @@ (c-name "GstPadLinkReturn") (gtype-id "GST_TYPE_PAD_LINK_RETURN") (values + '("nosched" "GST_PAD_LINK_NOSCHED") + '("noformat" "GST_PAD_LINK_NOFORMAT") '("refused" "GST_PAD_LINK_REFUSED") - '("delayed" "GST_PAD_LINK_DELAYED") + '("wrong-direction" "GST_PAD_LINK_WRONG_DIRECTION") + '("was-linked" "GST_PAD_LINK_WAS_LINKED") '("ok" "GST_PAD_LINK_OK") - '("done" "GST_PAD_LINK_DONE") + ) +) + +(define-enum FlowReturn + (in-module "Gst") + (c-name "GstFlowReturn") + (gtype-id "GST_TYPE_FLOW_RETURN") + (values + '("ok" "GST_FLOW_OK") + '("resend" "GST_FLOW_RESEND") + '("error" "GST_FLOW_ERROR") + '("not-connected" "GST_FLOW_NOT_CONNECTED") + '("not-negotiated" "GST_FLOW_NOT_NEGOTIATED") + '("wrong-state" "GST_FLOW_WRONG_STATE") + '("unexpected" "GST_FLOW_UNEXPECTED") + '("not-supported" "GST_FLOW_NOT_SUPPORTED") + ) +) + +(define-enum ActivateMode + (in-module "Gst") + (c-name "GstActivateMode") + (gtype-id "GST_TYPE_ACTIVATE_MODE") + (values + '("none" "GST_ACTIVATE_NONE") + '("push" "GST_ACTIVATE_PUSH") + '("pull" "GST_ACTIVATE_PULL") ) ) @@ -654,8 +683,10 @@ (c-name "GstPadFlags") (gtype-id "GST_TYPE_PAD_FLAGS") (values - '("disabled" "GST_PAD_DISABLED") - '("negotiating" "GST_PAD_NEGOTIATING") + '("blocked" "GST_PAD_BLOCKED") + '("flushing" "GST_PAD_FLUSHING") + '("in-getcaps" "GST_PAD_IN_GETCAPS") + '("in-setcaps" "GST_PAD_IN_SETCAPS") '("flag-last" "GST_PAD_FLAG_LAST") ) ) @@ -696,6 +727,16 @@ ) ) +(define-enum PipelineFlags + (in-module "Gst") + (c-name "GstPipelineFlags") + (gtype-id "GST_TYPE_PIPELINE_FLAGS") + (values + '("fixed-clock" "GST_PIPELINE_FLAG_FIXED_CLOCK") + '("last" "GST_PIPELINE_FLAG_LAST") + ) +) + (define-enum PluginError (in-module "Gst") (c-name "GstPluginError") @@ -720,6 +761,9 @@ '("start" "GST_QUERY_START") '("segment-end" "GST_QUERY_SEGMENT_END") '("rate" "GST_QUERY_RATE") + '("seeking" "GST_QUERY_SEEKING") + '("convert" "GST_QUERY_CONVERT") + '("formats" "GST_QUERY_FORMATS") ) ) @@ -754,20 +798,7 @@ (c-name "GstSchedulerFlags") (gtype-id "GST_TYPE_SCHEDULER_FLAGS") (values - '("fixed-clock" "GST_SCHEDULER_FLAG_FIXED_CLOCK") - '("last" "GST_SCHEDULER_FLAG_LAST") - ) -) - -(define-enum SchedulerState - (in-module "Gst") - (c-name "GstSchedulerState") - (gtype-id "GST_TYPE_SCHEDULER_STATE") - (values - '("none" "GST_SCHEDULER_STATE_NONE") - '("running" "GST_SCHEDULER_STATE_RUNNING") - '("stopped" "GST_SCHEDULER_STATE_STOPPED") - '("error" "GST_SCHEDULER_STATE_ERROR") + '("t" "GST_SCHEDULER_FLAG_LAST") ) ) @@ -800,15 +831,14 @@ ) ) -(define-enum ThreadState +(define-enum TaskState (in-module "Gst") - (c-name "GstThreadState") - (gtype-id "GST_TYPE_THREAD_STATE") + (c-name "GstTaskState") + (gtype-id "GST_TYPE_TASK_STATE") (values - '("state-spinning" "GST_THREAD_STATE_SPINNING") - '("state-reaping" "GST_THREAD_STATE_REAPING") - '("mutex-locked" "GST_THREAD_MUTEX_LOCKED") - '("flag-last" "GST_THREAD_FLAG_LAST") + '("started" "GST_TASK_STARTED") + '("stopped" "GST_TASK_STOPPED") + '("paused" "GST_TASK_PAUSED") ) ) @@ -859,14 +889,15 @@ ) ) -(define-enum Result +(define-enum Rank (in-module "Gst") - (c-name "GstResult") - (gtype-id "GST_TYPE_RESULT") + (c-name "GstRank") + (gtype-id "GST_TYPE_RANK") (values - '("ok" "GST_RESULT_OK") - '("nok" "GST_RESULT_NOK") - '("not-impl" "GST_RESULT_NOT_IMPL") + '("none" "GST_RANK_NONE") + '("marginal" "GST_RANK_MARGINAL") + '("secondary" "GST_RANK_SECONDARY") + '("primary" "GST_RANK_PRIMARY") ) ) diff --git a/gst/gst.defs b/gst/gst.defs index 99a5fc7..2b1b9b7 100644 --- a/gst/gst.defs +++ b/gst/gst.defs @@ -1,117 +1,224 @@ ;; -*- scheme -*- -(include "gst-types.defs") -;;(include "0.7.defs") +(include "gst-extrafuncs.defs") +{include "gst-types.defs") -;; From /opt/gnome/include/gstreamer-0.7/gst/gstatomic.h -(define-method init - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_init") +;; From ../gstreamer/gst/cothreads.h + +(define-function cothread_context_init + (c-name "cothread_context_init") + (return-type "cothread_context*") +) + +(define-function cothread_context_free + (c-name "cothread_context_free") (return-type "none") (parameters - '("gint" "val") + '("cothread_context*" "ctx") ) ) -(define-method destroy - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_destroy") +(define-function cothread_context_set_data + (c-name "cothread_context_set_data") (return-type "none") + (parameters + '("cothread_state*" "cothread") + '("gchar*" "key") + '("gpointer" "data") + ) ) -(define-method set - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_set") +(define-function cothread_context_get_data + (c-name "cothread_context_get_data") + (return-type "gpointer") + (parameters + '("cothread_state*" "cothread") + '("gchar*" "key") + ) +) + +(define-function cothread_create + (c-name "cothread_create") + (return-type "cothread_state*") + (parameters + '("cothread_context*" "ctx") + ) +) + +(define-function cothread_free + (c-name "cothread_free") (return-type "none") (parameters - '("gint" "val") + '("cothread_state*" "cothread") ) ) -(define-method read - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_read") - (return-type "gint") +(define-function cothread_setfunc + (c-name "cothread_setfunc") + (return-type "none") + (parameters + '("cothread_state*" "cothread") + '("cothread_func" "func") + '("int" "argc") + '("char**" "argv") + ) ) -(define-method add - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_add") +(define-function cothread_stop + (c-name "cothread_stop") + (return-type "none") + (parameters + '("cothread_state*" "cothread") + ) +) + +(define-function cothread_switch + (c-name "cothread_switch") + (return-type "none") + (parameters + '("cothread_state*" "cothread") + ) +) + +(define-function cothread_set_private + (c-name "cothread_set_private") + (return-type "none") + (parameters + '("cothread_state*" "cothread") + '("gpointer" "data") + ) +) + +(define-function cothread_get_private + (c-name "cothread_get_private") + (return-type "gpointer") + (parameters + '("cothread_state*" "cothread") + ) +) + +(define-function cothread_main + (c-name "cothread_main") + (return-type "cothread_state*") + (parameters + '("cothread_context*" "ctx") + ) +) + +(define-function cothread_current_main + (c-name "cothread_current_main") + (return-type "cothread_state*") +) + +(define-function cothread_current + (c-name "cothread_current") + (return-type "cothread_state*") +) + + + +;; From ../gstreamer/gst/gettext.h + + + +;; From ../gstreamer/gst/gst-i18n-app.h + + + +;; From ../gstreamer/gst/gst-i18n-lib.h + + + +;; From ../gstreamer/gst/gst.h + +(define-function gst_init + (c-name "gst_init") (return-type "none") (parameters - '("gint" "val") + '("int*" "argc") + '("char**[]" "argv") + ) +) + +(define-function gst_init_check + (c-name "gst_init_check") + (return-type "gboolean") + (parameters + '("int*" "argc") + '("char**[]" "argv") ) ) -(define-method inc - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_inc") +(define-function gst_init_with_popt_table + (c-name "gst_init_with_popt_table") (return-type "none") + (parameters + '("int*" "argc") + '("char**[]" "argv") + '("const-GstPoptOption*" "popt_options") + ) ) -(define-method dec_and_test - (of-object "GstAtomicInt") - (c-name "gst_atomic_int_dec_and_test") +(define-function gst_init_check_with_popt_table + (c-name "gst_init_check_with_popt_table") (return-type "gboolean") + (parameters + '("int*" "argc") + '("char**[]" "argv") + '("const-GstPoptOption*" "popt_options") + ) +) + +(define-function gst_init_get_popt_table + (c-name "gst_init_get_popt_table") + (return-type "const-GstPoptOption*") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstbin.h +;; From ../gstreamer/gst/gst_private.h + + -(define-function bin_get_type +;; From ../gstreamer/gst/gstarch.h + + + +;; From ../gstreamer/gst/gstbin.h + +(define-function gst_bin_get_type (c-name "gst_bin_get_type") (return-type "GType") ) -(define-function bin_new +(define-function gst_bin_new (c-name "gst_bin_new") (is-constructor-of "GstBin") (return-type "GstElement*") (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) + '("const-gchar*" "name") ) ) (define-method add (of-object "GstBin") (c-name "gst_bin_add") - (return-type "none") + (return-type "gboolean") (parameters '("GstElement*" "element") ) ) -(define-method add_many - (of-object "GstBin") - (c-name "gst_bin_add_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - (define-method remove (of-object "GstBin") (c-name "gst_bin_remove") - (return-type "none") + (return-type "gboolean") (parameters '("GstElement*" "element") ) ) -(define-method remove_many - (of-object "GstBin") - (c-name "gst_bin_remove_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - ) - (varargs #t) -) - (define-method get_by_name (of-object "GstBin") (c-name "gst_bin_get_by_name") @@ -130,12 +237,6 @@ ) ) -(define-method get_list - (of-object "GstBin") - (c-name "gst_bin_get_list") - (return-type "const-GList*") -) - (define-method get_by_interface (of-object "GstBin") (c-name "gst_bin_get_by_interface") @@ -145,84 +246,49 @@ ) ) -(define-method get_all_by_interface - (of-object "GstBin") - (c-name "gst_bin_get_all_by_interface") - (return-type "GList*") - (parameters - '("GType" "interface") - ) -) - -(define-method iterate - (of-object "GstBin") - (c-name "gst_bin_iterate") - (return-type "gboolean") -) - -(define-method use_clock - (of-object "GstBin") - (c-name "gst_bin_use_clock") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method get_clock - (of-object "GstBin") - (c-name "gst_bin_get_clock") - (return-type "GstClock*") -) - -(define-method auto_clock +(define-method iterate_elements (of-object "GstBin") - (c-name "gst_bin_auto_clock") - (return-type "none") + (c-name "gst_bin_iterate_elements") + (return-type "GstIterator*") ) -(define-method sync_children_state +(define-method iterate_recurse (of-object "GstBin") - (c-name "gst_bin_sync_children_state") - (return-type "GstElementStateReturn") + (c-name "gst_bin_iterate_recurse") + (return-type "GstIterator*") ) -(define-method set_pre_iterate_function +(define-method iterate_sinks (of-object "GstBin") - (c-name "gst_bin_set_pre_iterate_function") - (return-type "none") - (parameters - '("GstBinPrePostIterateFunction" "func") - '("gpointer" "user_data") - ) + (c-name "gst_bin_iterate_sinks") + (return-type "GstIterator*") ) -(define-method set_post_iterate_function +(define-method iterate_all_by_interface (of-object "GstBin") - (c-name "gst_bin_set_post_iterate_function") - (return-type "none") + (c-name "gst_bin_iterate_all_by_interface") + (return-type "GstIterator*") (parameters - '("GstBinPrePostIterateFunction" "func") - '("gpointer" "user_data") + '("GType" "interface") ) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstbuffer.h +;; From ../gstreamer/gst/gstbuffer.h -(define-function buffer_get_type +(define-function gst_buffer_get_type (c-name "gst_buffer_get_type") (return-type "GType") ) -(define-function buffer_new +(define-function gst_buffer_new (c-name "gst_buffer_new") (is-constructor-of "GstBuffer") (return-type "GstBuffer*") ) -(define-function buffer_new_and_alloc +(define-function gst_buffer_new_and_alloc (c-name "gst_buffer_new_and_alloc") (return-type "GstBuffer*") (parameters @@ -230,12 +296,18 @@ ) ) -(define-method stamp +(define-method get_caps (of-object "GstBuffer") - (c-name "gst_buffer_stamp") + (c-name "gst_buffer_get_caps") + (return-type "GstCaps*") +) + +(define-method set_caps + (of-object "GstBuffer") + (c-name "gst_buffer_set_caps") (return-type "none") (parameters - '("const-GstBuffer*" "src") + '("GstCaps*" "caps") ) ) @@ -249,15 +321,6 @@ ) ) -(define-method merge - (of-object "GstBuffer") - (c-name "gst_buffer_merge") - (return-type "GstBuffer*") - (parameters - '("GstBuffer*" "buf2") - ) -) - (define-method is_span_fast (of-object "GstBuffer") (c-name "gst_buffer_is_span_fast") @@ -278,60 +341,125 @@ ) ) -(define-method get_data - (of-object "GstBuffer") - (c-name "gst_buffer_get_data") - (return-type "char*") + + +;; From ../gstreamer/gst/gstbus.h + +(define-function gst_bus_get_type + (c-name "gst_bus_get_type") + (return-type "GType") ) -(define-function _gst_buffer_initialize - (c-name "_gst_buffer_initialize") - (return-type "none") +(define-function gst_bus_new + (c-name "gst_bus_new") + (is-constructor-of "GstBus") + (return-type "GstBus*") ) -(define-method default_free - (of-object "GstBuffer") - (c-name "gst_buffer_default_free") - (return-type "none") +(define-method post + (of-object "GstBus") + (c-name "gst_bus_post") + (return-type "gboolean") + (parameters + '("GstMessage*" "message") + ) ) -(define-method default_copy - (of-object "GstBuffer") - (c-name "gst_buffer_default_copy") - (return-type "GstBuffer*") +(define-method have_pending + (of-object "GstBus") + (c-name "gst_bus_have_pending") + (return-type "gboolean") ) -(define-method set_buffer_data - (of-object "GstBuffer") - (c-name "gst_buffer_set_data") - (return-type "none") +(define-method peek + (of-object "GstBus") + (c-name "gst_bus_peek") + (return-type "GstMessage*") ) +(define-method pop + (of-object "GstBus") + (c-name "gst_bus_pop") + (return-type "GstMessage*") +) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstcaps.h +(define-method set_flushing + (of-object "GstBus") + (c-name "gst_bus_set_flushing") + (return-type "none") + (parameters + '("gboolean" "flushing") + ) +) -(define-function _gst_caps_initialize - (c-name "_gst_caps_initialize") +(define-method set_sync_handler + (of-object "GstBus") + (c-name "gst_bus_set_sync_handler") (return-type "none") + (parameters + '("GstBusSyncHandler" "func") + '("gpointer" "data") + ) +) + +(define-method create_watch + (of-object "GstBus") + (c-name "gst_bus_create_watch") + (return-type "GSource*") +) + +(define-method add_watch_full + (of-object "GstBus") + (c-name "gst_bus_add_watch_full") + (return-type "guint") + (parameters + '("gint" "priority") + '("GstBusHandler" "handler") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-method add_watch + (of-object "GstBus") + (c-name "gst_bus_add_watch") + (return-type "guint") + (parameters + '("GstBusHandler" "handler") + '("gpointer" "user_data") + ) +) + +(define-method poll + (of-object "GstBus") + (c-name "gst_bus_poll") + (return-type "GstMessageType") + (parameters + '("GstMessageType" "events") + '("GstClockTimeDiff" "timeout") + ) ) -(define-function caps_get_type + + +;; From ../gstreamer/gst/gstcaps.h + +(define-function gst_caps_get_type (c-name "gst_caps_get_type") (return-type "GType") ) -(define-function new_empty - (is-constructor-of "GstCaps") +(define-function gst_caps_new_empty (c-name "gst_caps_new_empty") (return-type "GstCaps*") ) -(define-function caps_new_any +(define-function gst_caps_new_any (c-name "gst_caps_new_any") (return-type "GstCaps*") ) -(define-function caps_new_simple +(define-function gst_caps_new_simple (c-name "gst_caps_new_simple") (return-type "GstCaps*") (parameters @@ -341,7 +469,7 @@ (varargs #t) ) -(define-function caps_new_full +(define-function gst_caps_new_full (c-name "gst_caps_new_full") (return-type "GstCaps*") (parameters @@ -350,7 +478,7 @@ (varargs #t) ) -(define-function caps_new_full_valist +(define-function gst_caps_new_full_valist (c-name "gst_caps_new_full_valist") (return-type "GstCaps*") (parameters @@ -359,15 +487,27 @@ ) ) +(define-method ref + (of-object "GstCaps") + (c-name "gst_caps_ref") + (return-type "GstCaps*") +) + (define-method copy (of-object "GstCaps") (c-name "gst_caps_copy") (return-type "GstCaps*") ) -(define-method free +(define-method make_writable + (of-object "GstCaps") + (c-name "gst_caps_make_writable") + (return-type "GstCaps*") +) + +(define-method unref (of-object "GstCaps") - (c-name "gst_caps_free") + (c-name "gst_caps_unref") (return-type "none") ) @@ -395,12 +535,6 @@ ) ) -(define-method split_one - (of-object "GstCaps") - (c-name "gst_caps_split_one") - (return-type "GstCaps*") -) - (define-method get_size (of-object "GstCaps") (c-name "gst_caps_get_size") @@ -416,10 +550,13 @@ ) ) -(define-method copy_1 +(define-method copy_nth (of-object "GstCaps") - (c-name "gst_caps_copy_1") + (c-name "gst_caps_copy_nth") (return-type "GstCaps*") + (parameters + '("gint" "nth") + ) ) (define-method set_simple @@ -454,45 +591,57 @@ (return-type "gboolean") ) -(define-method is_chained - (of-object "GstCaps") - (c-name "gst_caps_is_chained") - (return-type "gboolean") -) - (define-method is_fixed (of-object "GstCaps") (c-name "gst_caps_is_fixed") (return-type "gboolean") ) -(define-method is_equal_fixed +(define-method is_always_compatible (of-object "GstCaps") - (c-name "gst_caps_is_equal_fixed") + (c-name "gst_caps_is_always_compatible") (return-type "gboolean") (parameters '("const-GstCaps*" "caps2") ) ) -(define-method is_always_compatible +(define-method is_subset (of-object "GstCaps") - (c-name "gst_caps_is_always_compatible") + (c-name "gst_caps_is_subset") (return-type "gboolean") (parameters - '("const-GstCaps*" "caps2") + '("const-GstCaps*" "superset") ) ) -(define-method intersect +(define-method is_equal (of-object "GstCaps") - (c-name "gst_caps_intersect") + (c-name "gst_caps_is_equal") + (return-type "gboolean") + (parameters + '("const-GstCaps*" "caps2") + ) +) + +(define-method intersect + (of-object "GstCaps") + (c-name "gst_caps_intersect") (return-type "GstCaps*") (parameters '("const-GstCaps*" "caps2") ) ) +(define-method subtract + (of-object "GstCaps") + (c-name "gst_caps_subtract") + (return-type "GstCaps*") + (parameters + '("const-GstCaps*" "subtrahend") + ) +) + (define-method union (of-object "GstCaps") (c-name "gst_caps_union") @@ -508,10 +657,10 @@ (return-type "GstCaps*") ) -(define-method simplify +(define-method do_simplify (of-object "GstCaps") - (c-name "gst_caps_simplify") - (return-type "GstCaps*") + (c-name "gst_caps_do_simplify") + (return-type "gboolean") ) (define-method save_thyself @@ -523,7 +672,7 @@ ) ) -(define-function caps_load_thyself +(define-function gst_caps_load_thyself (c-name "gst_caps_load_thyself") (return-type "GstCaps*") (parameters @@ -531,7 +680,7 @@ ) ) -(define-function caps_replace +(define-function gst_caps_replace (c-name "gst_caps_replace") (return-type "none") (parameters @@ -546,7 +695,7 @@ (return-type "gchar*") ) -(define-function caps_from_string +(define-function gst_caps_from_string (c-name "gst_caps_from_string") (return-type "GstCaps*") (parameters @@ -554,50 +703,15 @@ ) ) -(define-function caps_structure_fixate_field_nearest_int - (c-name "gst_caps_structure_fixate_field_nearest_int") - (return-type "gboolean") - (parameters - '("GstStructure*" "structure") - '("const-char*" "field_name") - '("int" "target") - ) -) - -(define-function caps_structure_fixate_field_nearest_double - (c-name "gst_caps_structure_fixate_field_nearest_double") - (return-type "gboolean") - (parameters - '("GstStructure*" "structure") - '("const-char*" "field_name") - '("double" "target") - ) -) - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstclock.h +;; From ../gstreamer/gst/gstclock.h -(define-function clock_get_type +(define-function gst_clock_get_type (c-name "gst_clock_get_type") (return-type "GType") ) -(define-method set_speed - (of-object "GstClock") - (c-name "gst_clock_set_speed") - (return-type "gdouble") - (parameters - '("gdouble" "speed") - ) -) - -(define-method get_speed - (of-object "GstClock") - (c-name "gst_clock_get_speed") - (return-type "gdouble") -) - (define-method set_resolution (of-object "GstClock") (c-name "gst_clock_set_resolution") @@ -613,52 +727,28 @@ (return-type "guint64") ) -(define-method set_active - (of-object "GstClock") - (c-name "gst_clock_set_active") - (return-type "none") - (parameters - '("gboolean" "active") - ) -) - -(define-method is_active +(define-method get_time (of-object "GstClock") - (c-name "gst_clock_is_active") - (return-type "gboolean") + (c-name "gst_clock_get_time") + (return-type "GstClockTime") ) -(define-method reset +(define-method set_time_adjust (of-object "GstClock") - (c-name "gst_clock_reset") + (c-name "gst_clock_set_time_adjust") (return-type "none") -) - -(define-method handle_discont - (of-object "GstClock") - (c-name "gst_clock_handle_discont") - (return-type "gboolean") (parameters - '("guint64" "time") + '("GstClockTime" "adjust") ) ) -(define-method get_time - (of-object "GstClock") - (c-name "gst_clock_get_time") - (return-type "GstClockTime") -) - -(define-method get_event_time +(define-method adjust_unlocked (of-object "GstClock") - (c-name "gst_clock_get_event_time") + (c-name "gst_clock_adjust_unlocked") (return-type "GstClockTime") -) - -(define-method get_next_id - (of-object "GstClock") - (c-name "gst_clock_get_next_id") - (return-type "GstClockID") + (parameters + '("GstClockTime" "internal") + ) ) (define-method new_single_shot_id @@ -680,6 +770,27 @@ ) ) +(define-method ref + (of-object "GstClockID") + (c-name "gst_clock_id_ref") + (return-type "GstClockID") +) + +(define-method unref + (of-object "GstClockID") + (c-name "gst_clock_id_unref") + (return-type "none") +) + +(define-function gst_clock_id_compare_func + (c-name "gst_clock_id_compare_func") + (return-type "gint") + (parameters + '("gconstpointer" "id1") + '("gconstpointer" "id2") + ) +) + (define-method get_time (of-object "GstClockID") (c-name "gst_clock_id_get_time") @@ -711,1195 +822,756 @@ (return-type "none") ) -(define-method unlock - (of-object "GstClockID") - (c-name "gst_clock_id_unlock") - (return-type "none") -) -(define-method free - (of-object "GstClockID") - (c-name "gst_clock_id_free") - (return-type "none") -) + +;; From ../gstreamer/gst/gstcompat.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstconfig.h +;; From ../gstreamer/gst/gstconfig.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstcpu.h +;; From ../gstreamer/gst/gstelement.h -(define-function _gst_cpu_initialize - (c-name "_gst_cpu_initialize") +(define-method add_pad_template + (of-object "GstElementClass") + (c-name "gst_element_class_add_pad_template") (return-type "none") (parameters - '("gboolean" "useopt") + '("GstPadTemplate*" "templ") ) ) -(define-function cpu_get_flags - (c-name "gst_cpu_get_flags") - (return-type "GstCPUFlags") -) - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstdata.h - -(define-method init - (of-object "GstData") - (c-name "gst_data_init") - (return-type "none") +(define-method get_pad_template + (of-object "GstElementClass") + (c-name "gst_element_class_get_pad_template") + (return-type "GstPadTemplate*") (parameters - '("GType" "type") - '("guint16" "flags") - '("GstDataFreeFunction" "free") - '("GstDataCopyFunction" "copy") + '("const-gchar*" "name") ) ) -(define-method dispose - (of-object "GstData") - (c-name "gst_data_dispose") - (return-type "none") +(define-method get_pad_template_list + (of-object "GstElementClass") + (c-name "gst_element_class_get_pad_template_list") + (return-type "GList*") ) -(define-method copy_into - (of-object "GstData") - (c-name "gst_data_copy_into") +(define-method set_details + (of-object "GstElementClass") + (c-name "gst_element_class_set_details") (return-type "none") (parameters - '("GstData*" "target") + '("const-GstElementDetails*" "details") ) ) -(define-method copy - (of-object "GstData") - (c-name "gst_data_copy") - (return-type "GstData*") +(define-function gst_element_get_type + (c-name "gst_element_get_type") + (return-type "GType") ) -(define-method is_writable - (of-object "GstData") - (c-name "gst_data_is_writable") +(define-method requires_clock + (of-object "GstElement") + (c-name "gst_element_requires_clock") (return-type "gboolean") ) -(define-method copy_on_write - (of-object "GstData") - (c-name "gst_data_copy_on_write") - (return-type "GstData*") -) - -(define-method free - (of-object "GstData") - (c-name "gst_data_free") - (return-type "none") +(define-method provides_clock + (of-object "GstElement") + (c-name "gst_element_provides_clock") + (return-type "gboolean") ) -(define-method ref - (of-object "GstData") - (c-name "gst_data_ref") - (return-type "GstData*") +(define-method get_clock + (of-object "GstElement") + (c-name "gst_element_get_clock") + (return-type "GstClock*") ) -(define-method ref_by_count - (of-object "GstData") - (c-name "gst_data_ref_by_count") - (return-type "GstData*") +(define-method set_clock + (of-object "GstElement") + (c-name "gst_element_set_clock") + (return-type "none") (parameters - '("gint" "count") + '("GstClock*" "clock") ) ) -(define-method unref - (of-object "GstData") - (c-name "gst_data_unref") - (return-type "none") +(define-method is_indexable + (of-object "GstElement") + (c-name "gst_element_is_indexable") + (return-type "gboolean") ) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstelement.h - -(define-method add_pad_template - (of-object "GstElementClass") - (c-name "gst_element_class_add_pad_template") +(define-method set_index + (of-object "GstElement") + (c-name "gst_element_set_index") (return-type "none") (parameters - '("GstPadTemplate*" "templ") + '("GstIndex*" "index") ) ) -(define-method install_std_props - (of-object "GstElementClass") - (c-name "gst_element_class_install_std_props") - (return-type "none") - (parameters - '("const-gchar*" "first_name") - ) - (varargs #t) +(define-method get_index + (of-object "GstElement") + (c-name "gst_element_get_index") + (return-type "GstIndex*") ) -(define-method set_details - (of-object "GstElementClass") - (c-name "gst_element_class_set_details") +(define-method set_manager + (of-object "GstElement") + (c-name "gst_element_set_manager") (return-type "none") (parameters - '("const-GstElementDetails*" "details") + '("GstPipeline*" "pipeline") ) ) -(define-function element_default_error - (c-name "gst_element_default_error") +(define-method get_manager + (of-object "GstElement") + (c-name "gst_element_get_manager") + (return-type "GstPipeline*") +) + +(define-method set_bus + (of-object "GstElement") + (c-name "gst_element_set_bus") (return-type "none") (parameters - '("GObject*" "object") - '("GstObject*" "orig") - '("GError*" "error") - '("gchar*" "debug") + '("GstBus*" "bus") ) ) -(define-function element_get_type - (c-name "gst_element_get_type") - (return-type "GType") +(define-method get_bus + (of-object "GstElement") + (c-name "gst_element_get_bus") + (return-type "GstBus*") ) -(define-method set_loop_function +(define-method set_scheduler (of-object "GstElement") - (c-name "gst_element_set_loop_function") + (c-name "gst_element_set_scheduler") (return-type "none") (parameters - '("GstElementLoopFunction" "loop") + '("GstScheduler*" "sched") ) ) -(define-method set +(define-method get_scheduler (of-object "GstElement") - (c-name "gst_element_set") - (return-type "none") - (parameters - '("const-gchar*" "first_property_name") - ) - (varargs #t) + (c-name "gst_element_get_scheduler") + (return-type "GstScheduler*") ) -(define-method get +(define-method add_pad (of-object "GstElement") - (c-name "gst_element_get") - (return-type "none") + (c-name "gst_element_add_pad") + (return-type "gboolean") (parameters - '("const-gchar*" "first_property_name") + '("GstPad*" "pad") ) - (varargs #t) ) -(define-method set_valist +(define-method remove_pad (of-object "GstElement") - (c-name "gst_element_set_valist") - (return-type "none") + (c-name "gst_element_remove_pad") + (return-type "gboolean") (parameters - '("const-gchar*" "first_property_name") - '("va_list" "var_args") + '("GstPad*" "pad") ) ) -(define-method get_valist +(define-method no_more_pads (of-object "GstElement") - (c-name "gst_element_get_valist") + (c-name "gst_element_no_more_pads") (return-type "none") - (parameters - '("const-gchar*" "first_property_name") - '("va_list" "var_args") - ) ) -(define-method set_property +(define-method get_pad (of-object "GstElement") - (c-name "gst_element_set_property") - (return-type "none") + (c-name "gst_element_get_pad") + (return-type "GstPad*") (parameters - '("const-gchar*" "property_name") - '("const-GValue*" "value") + '("const-gchar*" "name") ) ) -(define-method get_property +(define-method get_static_pad (of-object "GstElement") - (c-name "gst_element_get_property") - (return-type "none") + (c-name "gst_element_get_static_pad") + (return-type "GstPad*") (parameters - '("const-gchar*" "property_name") - '("GValue*" "value") + '("const-gchar*" "name") ) ) -(define-method enable_threadsafe_properties +(define-method get_request_pad (of-object "GstElement") - (c-name "gst_element_enable_threadsafe_properties") - (return-type "none") + (c-name "gst_element_get_request_pad") + (return-type "GstPad*") + (parameters + '("const-gchar*" "name") + ) ) -(define-method disable_threadsafe_properties +(define-method release_request_pad (of-object "GstElement") - (c-name "gst_element_disable_threadsafe_properties") + (c-name "gst_element_release_request_pad") (return-type "none") + (parameters + '("GstPad*" "pad") + ) ) -(define-method set_pending_properties +(define-method iterate_pads (of-object "GstElement") - (c-name "gst_element_set_pending_properties") - (return-type "none") + (c-name "gst_element_iterate_pads") + (return-type "GstIterator*") ) -(define-method requires_clock +(define-method send_event (of-object "GstElement") - (c-name "gst_element_requires_clock") + (c-name "gst_element_send_event") (return-type "gboolean") + (parameters + '("GstEvent*" "event") + ) ) -(define-method provides_clock +(define-method seek (of-object "GstElement") - (c-name "gst_element_provides_clock") + (c-name "gst_element_seek") (return-type "gboolean") -) - -(define-method get_clock - (of-object "GstElement") - (c-name "gst_element_get_clock") - (return-type "GstClock*") -) - -(define-method set_clock - (of-object "GstElement") - (c-name "gst_element_set_clock") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method clock_wait - (of-object "GstElement") - (c-name "gst_element_clock_wait") - (return-type "GstClockReturn") (parameters - '("GstClockID" "id") - '("GstClockTimeDiff*" "jitter") + '("GstSeekType" "seek_type") + '("guint64" "offset") ) ) -(define-method get_time +(define-method get_query_types (of-object "GstElement") - (c-name "gst_element_get_time") - (return-type "GstClockTime") + (c-name "gst_element_get_query_types") + (return-type "const-GstQueryType*") ) -(define-method wait +(define-method query (of-object "GstElement") - (c-name "gst_element_wait") + (c-name "gst_element_query") (return-type "gboolean") (parameters - '("GstClockTime" "timestamp") + '("GstQuery*" "query") ) ) -(define-method set_time +(define-method post_message (of-object "GstElement") - (c-name "gst_element_set_time") - (return-type "none") + (c-name "gst_element_post_message") + (return-type "gboolean") (parameters - '("GstClockTime" "time") + '("GstMessage*" "message") ) ) -(define-method adjust_time +(define-method message_full (of-object "GstElement") - (c-name "gst_element_adjust_time") + (c-name "gst_element_message_full") (return-type "none") (parameters - '("GstClockTimeDiff" "diff") + '("GstMessageType" "type") + '("GQuark" "domain") + '("gint" "code") + '("gchar*" "text") + '("gchar*" "debug") + '("const-gchar*" "file") + '("const-gchar*" "function") + '("gint" "line") ) ) -(define-method is_indexable +(define-method is_locked_state (of-object "GstElement") - (c-name "gst_element_is_indexable") + (c-name "gst_element_is_locked_state") (return-type "gboolean") ) -(define-method set_index +(define-method set_locked_state (of-object "GstElement") - (c-name "gst_element_set_index") - (return-type "none") + (c-name "gst_element_set_locked_state") + (return-type "gboolean") (parameters - '("GstIndex*" "index") + '("gboolean" "locked_state") ) ) -(define-method get_index - (of-object "GstElement") - (c-name "gst_element_get_index") - (return-type "GstIndex*") -) - -(define-method release_locks +(define-method sync_state_with_parent (of-object "GstElement") - (c-name "gst_element_release_locks") + (c-name "gst_element_sync_state_with_parent") (return-type "gboolean") ) -(define-method yield - (of-object "GstElement") - (c-name "gst_element_yield") - (return-type "none") -) - -(define-method interrupt +(define-method get_state (of-object "GstElement") - (c-name "gst_element_interrupt") - (return-type "gboolean") + (c-name "gst_element_get_state") + (return-type "GstElementStateReturn") + (parameters + '("GstElementState*" "state") + '("GstElementState*" "pending") + '("GTimeVal*" "timeout") + ) ) -(define-method set_scheduler +(define-method set_state (of-object "GstElement") - (c-name "gst_element_set_scheduler") - (return-type "none") + (c-name "gst_element_set_state") + (return-type "GstElementStateReturn") (parameters - '("GstScheduler*" "sched") + '("GstElementState" "state") ) ) -(define-method get_scheduler +(define-method abort_state (of-object "GstElement") - (c-name "gst_element_get_scheduler") - (return-type "GstScheduler*") + (c-name "gst_element_abort_state") + (return-type "none") ) -(define-method add_pad +(define-method commit_state (of-object "GstElement") - (c-name "gst_element_add_pad") + (c-name "gst_element_commit_state") (return-type "none") - (parameters - '("GstPad*" "pad") - ) ) -(define-method remove_pad +(define-method lost_state (of-object "GstElement") - (c-name "gst_element_remove_pad") + (c-name "gst_element_lost_state") (return-type "none") - (parameters - '("GstPad*" "pad") - ) ) -(define-method add_ghost_pad +(define-method get_factory (of-object "GstElement") - (c-name "gst_element_add_ghost_pad") - (return-type "GstPad*") - (parameters - '("GstPad*" "pad") - '("const-gchar*" "name") - ) + (c-name "gst_element_get_factory") + (return-type "GstElementFactory*") ) -(define-method remove_ghost_pad - (of-object "GstElement") - (c-name "gst_element_remove_ghost_pad") - (return-type "none") - (parameters - '("GstPad*" "pad") - ) -) -(define-method get_pad - (of-object "GstElement") - (c-name "gst_element_get_pad") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - ) + +;; From ../gstreamer/gst/gstelementfactory.h + +(define-function gst_element_factory_get_type + (c-name "gst_element_factory_get_type") + (return-type "GType") ) -(define-method get_static_pad - (of-object "GstElement") - (c-name "gst_element_get_static_pad") - (return-type "GstPad*") +(define-function gst_element_factory_find + (c-name "gst_element_factory_find") + (return-type "GstElementFactory*") (parameters '("const-gchar*" "name") ) ) -(define-method get_request_pad - (of-object "GstElement") - (c-name "gst_element_get_request_pad") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - ) +(define-method get_element_type + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_element_type") + (return-type "GType") ) -(define-method release_request_pad - (of-object "GstElement") - (c-name "gst_element_release_request_pad") - (return-type "none") - (parameters - '("GstPad*" "pad") - ) +(define-method get_longname + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_longname") + (return-type "const-gchar*") ) -(define-method get_pad_list - (of-object "GstElement") - (c-name "gst_element_get_pad_list") - (return-type "const-GList*") +(define-method get_klass + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_klass") + (return-type "const-gchar*") ) -(define-method get_compatible_pad - (of-object "GstElement") - (c-name "gst_element_get_compatible_pad") - (return-type "GstPad*") - (parameters - '("GstPad*" "pad") - ) +(define-method get_description + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_description") + (return-type "const-gchar*") ) -(define-method get_compatible_pad_filtered - (of-object "GstElement") - (c-name "gst_element_get_compatible_pad_filtered") - (return-type "GstPad*") - (parameters - '("GstPad*" "pad") - '("const-GstCaps*" "filtercaps") - ) +(define-method get_author + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_author") + (return-type "const-gchar*") ) -(define-method get_pad_template - (of-object "GstElementClass") - (c-name "gst_element_class_get_pad_template") - (return-type "GstPadTemplate*") - (parameters - '("const-gchar*" "name") - ) +(define-method get_num_pad_templates + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_num_pad_templates") + (return-type "guint") ) -(define-method get_pad_template_list - (of-object "GstElementClass") - (c-name "gst_element_class_get_pad_template_list") - (return-type "GList*") +(define-method get_static_pad_templates + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_static_pad_templates") + (return-type "const-GList*") ) -(define-method get_pad_template - (of-object "GstElement") - (c-name "gst_element_get_pad_template") - (return-type "GstPadTemplate*") - (parameters - '("const-gchar*" "name") - ) +(define-method get_uri_type + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_uri_type") + (return-type "guint") ) -(define-method get_pad_template_list - (of-object "GstElement") - (c-name "gst_element_get_pad_template_list") - (return-type "GList*") +(define-method get_uri_protocols + (of-object "GstElementFactory") + (c-name "gst_element_factory_get_uri_protocols") + (return-type "gchar**") ) -(define-method get_compatible_pad_template - (of-object "GstElement") - (c-name "gst_element_get_compatible_pad_template") - (return-type "GstPadTemplate*") +(define-method create + (of-object "GstElementFactory") + (c-name "gst_element_factory_create") + (return-type "GstElement*") (parameters - '("GstPadTemplate*" "compattempl") + '("const-gchar*" "name") ) ) -(define-method link - (of-object "GstElement") - (c-name "gst_element_link") - (return-type "gboolean") +(define-function gst_element_factory_make + (c-name "gst_element_factory_make") + (return-type "GstElement*") (parameters - '("GstElement*" "dest") + '("const-gchar*" "factoryname") + '("const-gchar*" "name") ) ) -(define-method link_filtered - (of-object "GstElement") - (c-name "gst_element_link_filtered") +(define-function gst_element_register + (c-name "gst_element_register") (return-type "gboolean") (parameters - '("GstElement*" "dest") - '("const-GstCaps*" "filtercaps") + '("GstPlugin*" "plugin") + '("const-gchar*" "name") + '("guint" "rank") + '("GType" "type") ) ) -(define-function element_link_many - (c-name "gst_element_link_many") - (return-type "gboolean") - (parameters - '("GstElement*" "element_1") - '("GstElement*" "element_2") - ) - (varargs #t) + + +;; From ../gstreamer/gst/gstenumtypes.h + +(define-function gst_object_flags_get_type + (c-name "gst_object_flags_get_type") + (return-type "GType") ) -(define-method unlink - (of-object "GstElement") - (c-name "gst_element_unlink") - (return-type "none") - (parameters - '("GstElement*" "dest") - ) +(define-function gst_bin_flags_get_type + (c-name "gst_bin_flags_get_type") + (return-type "GType") ) -(define-function element_unlink_many - (c-name "gst_element_unlink_many") - (return-type "none") - (parameters - '("GstElement*" "element_1") - '("GstElement*" "element_2") - ) - (varargs #t) +(define-function gst_buffer_flag_get_type + (c-name "gst_buffer_flag_get_type") + (return-type "GType") ) -(define-method link_pads - (of-object "GstElement") - (c-name "gst_element_link_pads") - (return-type "gboolean") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - ) +(define-function gst_bus_flags_get_type + (c-name "gst_bus_flags_get_type") + (return-type "GType") ) -(define-method link_pads_filtered - (of-object "GstElement") - (c-name "gst_element_link_pads_filtered") - (return-type "gboolean") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - '("const-GstCaps*" "filtercaps") - ) +(define-function gst_bus_sync_reply_get_type + (c-name "gst_bus_sync_reply_get_type") + (return-type "GType") ) -(define-method unlink_pads - (of-object "GstElement") - (c-name "gst_element_unlink_pads") - (return-type "none") - (parameters - '("const-gchar*" "srcpadname") - '("GstElement*" "dest") - '("const-gchar*" "destpadname") - ) +(define-function gst_clock_return_get_type + (c-name "gst_clock_return_get_type") + (return-type "GType") ) -(define-method get_event_masks - (of-object "GstElement") - (c-name "gst_element_get_event_masks") - (return-type "const-GstEventMask*") +(define-function gst_clock_entry_type_get_type + (c-name "gst_clock_entry_type_get_type") + (return-type "GType") ) -(define-method send_event - (of-object "GstElement") - (c-name "gst_element_send_event") - (return-type "gboolean") - (parameters - '("GstEvent*" "event") - ) +(define-function gst_clock_flags_get_type + (c-name "gst_clock_flags_get_type") + (return-type "GType") ) -(define-method seek - (of-object "GstElement") - (c-name "gst_element_seek") - (return-type "gboolean") - (parameters - '("GstSeekType" "seek_type") - '("guint64" "offset") - ) +(define-function gst_element_flags_get_type + (c-name "gst_element_flags_get_type") + (return-type "GType") ) -(define-method get_query_types - (of-object "GstElement") - (c-name "gst_element_get_query_types") - (return-type "const-GstQueryType*") +(define-function gst_core_error_get_type + (c-name "gst_core_error_get_type") + (return-type "GType") ) -(define-method query - (of-object "GstElement") - (c-name "gst_element_query") - (return-type "gboolean") - (parameters - '("GstQueryType" "type") - '("GstFormat*" "format") - '("gint64*" "value") - ) +(define-function gst_library_error_get_type + (c-name "gst_library_error_get_type") + (return-type "GType") ) -(define-method get_formats - (of-object "GstElement") - (c-name "gst_element_get_formats") - (return-type "const-GstFormat*") +(define-function gst_resource_error_get_type + (c-name "gst_resource_error_get_type") + (return-type "GType") ) -(define-method convert - (of-object "GstElement") - (c-name "gst_element_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_value") - '("GstFormat*" "dest_format") - '("gint64*" "dest_value") - ) +(define-function gst_stream_error_get_type + (c-name "gst_stream_error_get_type") + (return-type "GType") ) -(define-method found_tags - (of-object "GstElement") - (c-name "gst_element_found_tags") - (return-type "none") - (parameters - '("const-GstTagList*" "tag_list") - ) +(define-function gst_event_type_get_type + (c-name "gst_event_type_get_type") + (return-type "GType") ) -(define-method found_tags_for_pad - (of-object "GstElement") - (c-name "gst_element_found_tags_for_pad") - (return-type "none") - (parameters - '("GstPad*" "pad") - '("GstClockTime" "timestamp") - '("GstTagList*" "list") - ) +(define-function gst_event_flag_get_type + (c-name "gst_event_flag_get_type") + (return-type "GType") ) -(define-method set_eos - (of-object "GstElement") - (c-name "gst_element_set_eos") - (return-type "none") +(define-function gst_seek_type_get_type + (c-name "gst_seek_type_get_type") + (return-type "GType") ) -(define-function _gst_element_error_printf - (c-name "_gst_element_error_printf") - (return-type "gchar*") - (parameters - '("const-gchar*" "format") - ) - (varargs #t) +(define-function gst_seek_accuracy_get_type + (c-name "gst_seek_accuracy_get_type") + (return-type "GType") ) -(define-method error_full - (of-object "GstElement") - (c-name "gst_element_error_full") - (return-type "none") - (parameters - '("GQuark" "domain") - '("gint" "code") - '("gchar*" "message") - '("gchar*" "debug") - '("const-gchar*" "file") - '("const-gchar*" "function") - '("gint" "line") - ) +(define-function gst_format_get_type + (c-name "gst_format_get_type") + (return-type "GType") ) -(define-method is_locked_state - (of-object "GstElement") - (c-name "gst_element_is_locked_state") - (return-type "gboolean") +(define-function gst_index_certainty_get_type + (c-name "gst_index_certainty_get_type") + (return-type "GType") ) -(define-method set_locked_state - (of-object "GstElement") - (c-name "gst_element_set_locked_state") - (return-type "none") - (parameters - '("gboolean" "locked_state") - ) +(define-function gst_index_entry_type_get_type + (c-name "gst_index_entry_type_get_type") + (return-type "GType") ) -(define-method sync_state_with_parent - (of-object "GstElement") - (c-name "gst_element_sync_state_with_parent") - (return-type "gboolean") +(define-function gst_index_lookup_method_get_type + (c-name "gst_index_lookup_method_get_type") + (return-type "GType") ) -(define-method get_state - (of-object "GstElement") - (c-name "gst_element_get_state") - (return-type "GstElementState") +(define-function gst_assoc_flags_get_type + (c-name "gst_assoc_flags_get_type") + (return-type "GType") ) -(define-method set_state - (of-object "GstElement") - (c-name "gst_element_set_state") - (return-type "GstElementStateReturn") - (parameters - '("GstElementState" "state") - ) +(define-function gst_index_resolver_method_get_type + (c-name "gst_index_resolver_method_get_type") + (return-type "GType") ) -(define-method wait_state_change - (of-object "GstElement") - (c-name "gst_element_wait_state_change") - (return-type "none") +(define-function gst_index_flags_get_type + (c-name "gst_index_flags_get_type") + (return-type "GType") ) -(define-method get_name - (of-object "GstElementState") - (c-name "gst_element_state_get_name") - (return-type "const-gchar*") +(define-function gst_debug_level_get_type + (c-name "gst_debug_level_get_type") + (return-type "GType") ) -(define-method get_factory - (of-object "GstElement") - (c-name "gst_element_get_factory") - (return-type "GstElementFactory*") +(define-function gst_debug_color_flags_get_type + (c-name "gst_debug_color_flags_get_type") + (return-type "GType") ) -(define-method get_managing_bin - (of-object "GstElement") - (c-name "gst_element_get_managing_bin") - (return-type "GstBin*") +(define-function gst_iterator_result_get_type + (c-name "gst_iterator_result_get_type") + (return-type "GType") ) -(define-function element_factory_get_type - (c-name "gst_element_factory_get_type") +(define-function gst_iterator_item_get_type + (c-name "gst_iterator_item_get_type") (return-type "GType") ) -(define-function element_register - (c-name "gst_element_register") - (return-type "gboolean") - (parameters - '("GstPlugin*" "plugin") - '("const-gchar*" "elementname") - '("guint" "rank") - '("GType" "type") - ) +(define-function gst_message_type_get_type + (c-name "gst_message_type_get_type") + (return-type "GType") ) -(define-function element_factory_find - (c-name "gst_element_factory_find") - (return-type "GstElementFactory*") - (parameters - '("const-gchar*" "name") - ) +(define-function gst_mini_object_flags_get_type + (c-name "gst_mini_object_flags_get_type") + (return-type "GType") ) -(define-method get_element_type - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_element_type") +(define-function gst_pad_link_return_get_type + (c-name "gst_pad_link_return_get_type") (return-type "GType") ) -(define-method get_longname - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_longname") - (return-type "const-gchar*") +(define-function gst_flow_return_get_type + (c-name "gst_flow_return_get_type") + (return-type "GType") ) -(define-method get_klass - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_klass") - (return-type "const-gchar*") +(define-function gst_activate_mode_get_type + (c-name "gst_activate_mode_get_type") + (return-type "GType") ) -(define-method get_description - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_description") - (return-type "const-gchar*") +(define-function gst_pad_direction_get_type + (c-name "gst_pad_direction_get_type") + (return-type "GType") ) -(define-method get_author - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_author") - (return-type "const-gchar*") +(define-function gst_pad_flags_get_type + (c-name "gst_pad_flags_get_type") + (return-type "GType") ) -(define-method get_num_pad_templates - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_num_pad_templates") - (return-type "guint") +(define-function gst_pad_presence_get_type + (c-name "gst_pad_presence_get_type") + (return-type "GType") ) -(define-method get_pad_templates - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_pad_templates") - (return-type "const-GList*") +(define-function gst_pad_template_flags_get_type + (c-name "gst_pad_template_flags_get_type") + (return-type "GType") ) -(define-method get_uri_type - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_uri_type") - (return-type "guint") +(define-function gst_pipeline_flags_get_type + (c-name "gst_pipeline_flags_get_type") + (return-type "GType") ) -(define-method get_uri_protocols - (of-object "GstElementFactory") - (c-name "gst_element_factory_get_uri_protocols") - (return-type "gchar**") +(define-function gst_plugin_error_get_type + (c-name "gst_plugin_error_get_type") + (return-type "GType") ) -(define-method create - (of-object "GstElementFactory") - (c-name "gst_element_factory_create") - (return-type "GstElement*") - (parameters - '("const-gchar*" "name") - ) +(define-function gst_query_type_get_type + (c-name "gst_query_type_get_type") + (return-type "GType") ) -(define-function element_factory_make - (c-name "gst_element_factory_make") - (return-type "GstElement*") - (caller-owns-return #t) - (parameters - '("const-gchar*" "factoryname") - '("const-gchar*" "name" (null-ok) (default "NULL")) - ) +(define-function gst_scheduler_flags_get_type + (c-name "gst_scheduler_flags_get_type") + (return-type "GType") ) -(define-method can_src_caps - (of-object "GstElementFactory") - (c-name "gst_element_factory_can_src_caps") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-method can_sink_caps - (of-object "GstElementFactory") - (c-name "gst_element_factory_can_sink_caps") - (return-type "gboolean") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-method __add_pad_template - (of-object "GstElementFactory") - (c-name "__gst_element_factory_add_pad_template") - (return-type "none") - (parameters - '("GstPadTemplate*" "templ") - ) -) - -(define-method __add_interface - (of-object "GstElementFactory") - (c-name "__gst_element_factory_add_interface") - (return-type "none") - (parameters - '("const-gchar*" "interfacename") - ) -) - - -(define-function element_state_get_name - (c-name "gst_element_state_get_name") - (parameters - '("GstElementState" "state") - ) - (return-type "const-gchar*") -) - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstenumtypes.h - -(define-function object_flags_get_type - (c-name "gst_object_flags_get_type") - (return-type "GType") -) - -(define-function bin_flags_get_type - (c-name "gst_bin_flags_get_type") - (return-type "GType") -) - -(define-function buffer_flag_get_type - (c-name "gst_buffer_flag_get_type") - (return-type "GType") -) - -(define-function clock_entry_status_get_type - (c-name "gst_clock_entry_status_get_type") - (return-type "GType") -) - -(define-function clock_entry_type_get_type - (c-name "gst_clock_entry_type_get_type") - (return-type "GType") -) - -(define-function clock_return_get_type - (c-name "gst_clock_return_get_type") - (return-type "GType") -) - -(define-function clock_flags_get_type - (c-name "gst_clock_flags_get_type") - (return-type "GType") -) - -(define-function cpu_flags_get_type - (c-name "gst_cpu_flags_get_type") - (return-type "GType") -) - -(define-function data_flags_get_type - (c-name "gst_data_flags_get_type") - (return-type "GType") -) - -(define-function element_flags_get_type - (c-name "gst_element_flags_get_type") - (return-type "GType") -) - -(define-function core_error_get_type - (c-name "gst_core_error_get_type") - (return-type "GType") -) - -(define-function library_error_get_type - (c-name "gst_library_error_get_type") - (return-type "GType") -) - -(define-function resource_error_get_type - (c-name "gst_resource_error_get_type") - (return-type "GType") -) - -(define-function stream_error_get_type - (c-name "gst_stream_error_get_type") - (return-type "GType") -) - -(define-function event_type_get_type - (c-name "gst_event_type_get_type") - (return-type "GType") -) - -(define-function event_flag_get_type - (c-name "gst_event_flag_get_type") - (return-type "GType") -) - -(define-function seek_type_get_type - (c-name "gst_seek_type_get_type") - (return-type "GType") -) - -(define-function seek_accuracy_get_type - (c-name "gst_seek_accuracy_get_type") - (return-type "GType") -) - -(define-function format_get_type - (c-name "gst_format_get_type") - (return-type "GType") -) - -(define-function index_certainty_get_type - (c-name "gst_index_certainty_get_type") - (return-type "GType") -) - -(define-function index_entry_type_get_type - (c-name "gst_index_entry_type_get_type") - (return-type "GType") -) - -(define-function index_lookup_method_get_type - (c-name "gst_index_lookup_method_get_type") - (return-type "GType") -) - -(define-function assoc_flags_get_type - (c-name "gst_assoc_flags_get_type") - (return-type "GType") -) - -(define-function index_resolver_method_get_type - (c-name "gst_index_resolver_method_get_type") - (return-type "GType") -) - -(define-function index_flags_get_type - (c-name "gst_index_flags_get_type") - (return-type "GType") -) - -(define-function debug_level_get_type - (c-name "gst_debug_level_get_type") - (return-type "GType") -) - -(define-function debug_color_flags_get_type - (c-name "gst_debug_color_flags_get_type") - (return-type "GType") -) - -(define-function pad_link_return_get_type - (c-name "gst_pad_link_return_get_type") - (return-type "GType") -) - -(define-function pad_direction_get_type - (c-name "gst_pad_direction_get_type") - (return-type "GType") -) - -(define-function pad_flags_get_type - (c-name "gst_pad_flags_get_type") - (return-type "GType") -) - -(define-function pad_presence_get_type - (c-name "gst_pad_presence_get_type") - (return-type "GType") -) - -(define-function pad_template_flags_get_type - (c-name "gst_pad_template_flags_get_type") - (return-type "GType") -) - -(define-function plugin_error_get_type - (c-name "gst_plugin_error_get_type") - (return-type "GType") -) - -(define-function query_type_get_type - (c-name "gst_query_type_get_type") - (return-type "GType") -) - -(define-function scheduler_flags_get_type - (c-name "gst_scheduler_flags_get_type") - (return-type "GType") -) - -(define-function scheduler_state_get_type - (c-name "gst_scheduler_state_get_type") - (return-type "GType") -) - -(define-function tag_merge_mode_get_type +(define-function gst_tag_merge_mode_get_type (c-name "gst_tag_merge_mode_get_type") (return-type "GType") ) -(define-function tag_flag_get_type +(define-function gst_tag_flag_get_type (c-name "gst_tag_flag_get_type") (return-type "GType") ) -(define-function thread_state_get_type - (c-name "gst_thread_state_get_type") +(define-function gst_task_state_get_type + (c-name "gst_task_state_get_type") (return-type "GType") ) -(define-function alloc_trace_flags_get_type +(define-function gst_alloc_trace_flags_get_type (c-name "gst_alloc_trace_flags_get_type") (return-type "GType") ) -(define-function type_find_probability_get_type +(define-function gst_type_find_probability_get_type (c-name "gst_type_find_probability_get_type") (return-type "GType") ) -(define-function element_state_get_type +(define-function gst_element_state_get_type (c-name "gst_element_state_get_type") (return-type "GType") ) -(define-function element_state_return_get_type +(define-function gst_element_state_return_get_type (c-name "gst_element_state_return_get_type") (return-type "GType") ) -(define-function result_get_type - (c-name "gst_result_get_type") +(define-function gst_rank_get_type + (c-name "gst_rank_get_type") (return-type "GType") ) -(define-function uri_type_get_type +(define-function gst_uri_type_get_type (c-name "gst_uri_type_get_type") (return-type "GType") ) -(define-function registry_return_get_type +(define-function gst_registry_return_get_type (c-name "gst_registry_return_get_type") (return-type "GType") ) -(define-function registry_flags_get_type +(define-function gst_registry_flags_get_type (c-name "gst_registry_flags_get_type") (return-type "GType") ) -(define-function parse_error_get_type +(define-function gst_parse_error_get_type (c-name "gst_parse_error_get_type") (return-type "GType") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gsterror.h +;; From ../gstreamer/gst/gsterror.h -(define-function core_error_quark - (c-name "gst_core_error_quark") - (return-type "GQuark") +(define-function gst_g_error_get_type + (c-name "gst_g_error_get_type") + (return-type "GType") ) -(define-function library_error_quark - (c-name "gst_library_error_quark") - (return-type "GQuark") +(define-function gst_error_get_message + (c-name "gst_error_get_message") + (return-type "gchar*") + (parameters + '("GQuark" "domain") + '("gint" "code") + ) ) -(define-function resource_error_quark - (c-name "gst_resource_error_quark") +(define-function gst_stream_error_quark + (c-name "gst_stream_error_quark") (return-type "GQuark") ) -(define-function stream_error_quark - (c-name "gst_stream_error_quark") +(define-function gst_core_error_quark + (c-name "gst_core_error_quark") (return-type "GQuark") ) -(define-function error_get_message - (c-name "gst_error_get_message") - (return-type "gchar*") - (parameters - '("GQuark" "domain") - '("gint" "code") - ) +(define-function gst_resource_error_quark + (c-name "gst_resource_error_quark") + (return-type "GQuark") ) +(define-function gst_library_error_quark + (c-name "gst_library_error_quark") + (return-type "GQuark") +) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstevent.h -(define-function _gst_event_initialize - (c-name "_gst_event_initialize") - (return-type "none") -) +;; From ../gstreamer/gst/gstevent.h -(define-function event_get_type +(define-function gst_event_get_type (c-name "gst_event_get_type") (return-type "GType") ) -(define-function event_new +(define-function gst_event_new (c-name "gst_event_new") (is-constructor-of "GstEvent") (return-type "GstEvent*") @@ -1917,7 +1589,7 @@ ) ) -(define-function event_new_seek +(define-function gst_event_new_seek (c-name "gst_event_new_seek") (return-type "GstEvent*") (parameters @@ -1926,7 +1598,7 @@ ) ) -(define-function event_new_segment_seek +(define-function gst_event_new_segment_seek (c-name "gst_event_new_segment_seek") (return-type "GstEvent*") (parameters @@ -1936,7 +1608,7 @@ ) ) -(define-function event_new_size +(define-function gst_event_new_size (c-name "gst_event_new_size") (return-type "GstEvent*") (parameters @@ -1945,29 +1617,21 @@ ) ) -(define-function event_new_any - (c-name "gst_event_new_any") - (return-type "GstEvent*") - (parameters - '("GstStructure*" "structure") - ) -) - -(define-function event_new_discontinuous +(define-function gst_event_new_discontinuous (c-name "gst_event_new_discontinuous") (return-type "GstEvent*") (parameters - '("gboolean" "new_media") + '("gdouble" "rate") '("GstFormat" "format1") ) (varargs #t) ) -(define-function event_new_discontinuous_valist +(define-function gst_event_new_discontinuous_valist (c-name "gst_event_new_discontinuous_valist") (return-type "GstEvent*") (parameters - '("gboolean" "new_media") + '("gdouble" "rate") '("GstFormat" "format1") '("va_list" "var_args") ) @@ -1979,20 +1643,24 @@ (return-type "gboolean") (parameters '("GstFormat" "format") - '("gint64*" "value") + '("gint64*" "start_value") + '("gint64*" "end_value") ) ) -(define-method any_get_structure - (of-object "GstEvent") - (c-name "gst_event_any_get_structure") - (return-type "GstStructure*") +(define-function gst_event_new_flush + (c-name "gst_event_new_flush") + (return-type "GstEvent*") + (parameters + '("gboolean" "done") + ) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstfilter.h -(define-function filter_run +;; From ../gstreamer/gst/gstfilter.h + +(define-function gst_filter_run (c-name "gst_filter_run") (return-type "GList*") (parameters @@ -2005,14 +1673,9 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstformat.h +;; From ../gstreamer/gst/gstformat.h -(define-function _gst_format_initialize - (c-name "_gst_format_initialize") - (return-type "none") -) - -(define-function format_register +(define-function gst_format_register (c-name "gst_format_register") (return-type "GstFormat") (parameters @@ -2021,7 +1684,7 @@ ) ) -(define-function format_get_by_nick +(define-function gst_format_get_by_nick (c-name "gst_format_get_by_nick") (return-type "GstFormat") (parameters @@ -2044,102 +1707,51 @@ (return-type "const-GstFormatDefinition*") ) -(define-function format_get_definitions - (c-name "gst_format_get_definitions") - (return-type "const-GList*") +(define-function gst_format_iterate_definitions + (c-name "gst_format_iterate_definitions") + (return-type "GstIterator*") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gst.h +;; From ../gstreamer/gst/gstghostpad.h -(define-function init - (c-name "gst_init") - (return-type "none") - (parameters - '("int*" "argc") - '("char**[]" "argv") - ) +(define-function gst_ghost_pad_get_type + (c-name "gst_ghost_pad_get_type") + (return-type "GType") ) -(define-function init_check - (c-name "gst_init_check") - (return-type "gboolean") +(define-function gst_ghost_pad_new + (c-name "gst_ghost_pad_new") + (is-constructor-of "GstGhostPad") + (return-type "GstPad*") (parameters - '("int*" "argc") - '("char**[]" "argv") + '("const-gchar*" "name") + '("GstPad*" "target") ) ) -(define-function init_with_popt_table - (c-name "gst_init_with_popt_table") + + +;; From ../gstreamer/gst/gstindex.h + +(define-function gst_index_get_type + (c-name "gst_index_get_type") + (return-type "GType") +) + +(define-function gst_index_new + (c-name "gst_index_new") + (is-constructor-of "GstIndex") + (return-type "GstIndex*") +) + +(define-method commit + (of-object "GstIndex") + (c-name "gst_index_commit") (return-type "none") (parameters - '("int*" "argc") - '("char**[]" "argv") - '("const-GstPoptOption*" "popt_options") - ) -) - -(define-function init_check_with_popt_table - (c-name "gst_init_check_with_popt_table") - (return-type "gboolean") - (parameters - '("int*" "argc") - '("char**[]" "argv") - '("const-GstPoptOption*" "popt_options") - ) -) - -(define-function init_get_popt_table - (c-name "gst_init_get_popt_table") - (return-type "const-GstPoptOption*") -) - -(define-function use_threads - (c-name "gst_use_threads") - (return-type "none") - (parameters - '("gboolean" "use_threads") - ) -) - -(define-function has_threads - (c-name "gst_has_threads") - (return-type "gboolean") -) - -(define-function main - (c-name "gst_main") - (return-type "none") -) - -(define-function main_quit - (c-name "gst_main_quit") - (return-type "none") -) - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstindex.h - -(define-function index_get_type - (c-name "gst_index_get_type") - (return-type "GType") -) - -(define-function index_new - (c-name "gst_index_new") - (is-constructor-of "GstIndex") - (return-type "GstIndex*") -) - -(define-method commit - (of-object "GstIndex") - (c-name "gst_index_commit") - (return-type "none") - (parameters - '("gint" "id") + '("gint" "id") ) ) @@ -2282,7 +1894,7 @@ ) ) -(define-function index_entry_get_type +(define-function gst_index_entry_get_type (c-name "gst_index_entry_get_type") (return-type "GType") ) @@ -2309,12 +1921,12 @@ ) ) -(define-function index_factory_get_type +(define-function gst_index_factory_get_type (c-name "gst_index_factory_get_type") (return-type "GType") ) -(define-function index_factory_new +(define-function gst_index_factory_new (c-name "gst_index_factory_new") (is-constructor-of "GstIndexFactory") (return-type "GstIndexFactory*") @@ -2331,7 +1943,7 @@ (return-type "none") ) -(define-function index_factory_find +(define-function gst_index_factory_find (c-name "gst_index_factory_find") (return-type "GstIndexFactory*") (parameters @@ -2345,7 +1957,7 @@ (return-type "GstIndex*") ) -(define-function index_factory_make +(define-function gst_index_factory_make (c-name "gst_index_factory_make") (return-type "GstIndex*") (parameters @@ -2355,14 +1967,9 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstinfo.h +;; From ../gstreamer/gst/gstinfo.h -(define-function _gst_debug_init - (c-name "_gst_debug_init") - (return-type "none") -) - -(define-function debug_log +(define-function gst_debug_log (c-name "gst_debug_log") (return-type "none") (parameters @@ -2377,7 +1984,7 @@ (varargs #t) ) -(define-function debug_log_valist +(define-function gst_debug_log_valist (c-name "gst_debug_log_valist") (return-type "none") (parameters @@ -2398,7 +2005,7 @@ (return-type "const-gchar*") ) -(define-function debug_log_default +(define-function gst_debug_log_default (c-name "gst_debug_log_default") (return-type "none") (parameters @@ -2419,7 +2026,7 @@ (return-type "const-gchar*") ) -(define-function debug_add_log_function +(define-function gst_debug_add_log_function (c-name "gst_debug_add_log_function") (return-type "none") (parameters @@ -2428,7 +2035,7 @@ ) ) -(define-function debug_remove_log_function +(define-function gst_debug_remove_log_function (c-name "gst_debug_remove_log_function") (return-type "guint") (parameters @@ -2436,7 +2043,7 @@ ) ) -(define-function debug_remove_log_function_by_data +(define-function gst_debug_remove_log_function_by_data (c-name "gst_debug_remove_log_function_by_data") (return-type "guint") (parameters @@ -2444,7 +2051,7 @@ ) ) -(define-function debug_set_active +(define-function gst_debug_set_active (c-name "gst_debug_set_active") (return-type "none") (parameters @@ -2452,12 +2059,12 @@ ) ) -(define-function debug_is_active +(define-function gst_debug_is_active (c-name "gst_debug_is_active") (return-type "gboolean") ) -(define-function debug_set_colored +(define-function gst_debug_set_colored (c-name "gst_debug_set_colored") (return-type "none") (parameters @@ -2465,12 +2072,12 @@ ) ) -(define-function debug_is_colored +(define-function gst_debug_is_colored (c-name "gst_debug_is_colored") (return-type "gboolean") ) -(define-function debug_set_default_threshold +(define-function gst_debug_set_default_threshold (c-name "gst_debug_set_default_threshold") (return-type "none") (parameters @@ -2478,12 +2085,12 @@ ) ) -(define-function debug_get_default_threshold +(define-function gst_debug_get_default_threshold (c-name "gst_debug_get_default_threshold") (return-type "GstDebugLevel") ) -(define-function debug_set_threshold_for_name +(define-function gst_debug_set_threshold_for_name (c-name "gst_debug_set_threshold_for_name") (return-type "none") (parameters @@ -2492,7 +2099,7 @@ ) ) -(define-function debug_unset_threshold_for_name +(define-function gst_debug_unset_threshold_for_name (c-name "gst_debug_unset_threshold_for_name") (return-type "none") (parameters @@ -2500,17 +2107,6 @@ ) ) -(define-function _gst_debug_category_new - (c-name "_gst_debug_category_new") - (is-constructor-of "GstDebugCategory") - (return-type "GstDebugCategory*") - (parameters - '("gchar*" "name") - '("guint" "color") - '("gchar*" "description") - ) -) - (define-method free (of-object "GstDebugCategory") (c-name "gst_debug_category_free") @@ -2556,12 +2152,12 @@ (return-type "const-gchar*") ) -(define-function debug_get_all_categories +(define-function gst_debug_get_all_categories (c-name "gst_debug_get_all_categories") (return-type "GSList*") ) -(define-function debug_construct_term_color +(define-function gst_debug_construct_term_color (c-name "gst_debug_construct_term_color") (return-type "gchar*") (parameters @@ -2569,33 +2165,27 @@ ) ) -(define-function _gst_debug_register_funcptr - (c-name "_gst_debug_register_funcptr") - (return-type "void*") +(define-function gst_debug_remove_log_function + (c-name "gst_debug_remove_log_function") + (return-type "guint") (parameters - '("void*" "ptr") - '("gchar*" "ptrname") + '("GstLogFunction" "func") ) ) -(define-function _gst_debug_nameof_funcptr - (c-name "_gst_debug_nameof_funcptr") - (return-type "const-gchar*") +(define-function gst_debug_remove_log_function_by_data + (c-name "gst_debug_remove_log_function_by_data") + (return-type "guint") (parameters - '("void*" "ptr") + '("gpointer" "data") ) ) -(define-function debug_print_stack_trace - (c-name "gst_debug_print_stack_trace") - (return-type "none") -) +;; From ../gstreamer/gst/gstinterface.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstinterface.h - -(define-function implements_interface_get_type +(define-function gst_implements_interface_get_type (c-name "gst_implements_interface_get_type") (return-type "GType") ) @@ -2609,7 +2199,7 @@ ) ) -(define-function implements_interface_cast +(define-function gst_implements_interface_cast (c-name "gst_implements_interface_cast") (return-type "gpointer") (parameters @@ -2618,7 +2208,7 @@ ) ) -(define-function implements_interface_check +(define-function gst_implements_interface_check (c-name "gst_implements_interface_check") (return-type "gboolean") (parameters @@ -2629,21 +2219,120 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstlog.h +;; From ../gstreamer/gst/gstiterator.h + +(define-function gst_iterator_new + (c-name "gst_iterator_new") + (is-constructor-of "GstIterator") + (return-type "GstIterator*") + (parameters + '("guint" "size") + '("GMutex*" "lock") + '("guint32*" "master_cookie") + '("GstIteratorNextFunction" "next") + '("GstIteratorItemFunction" "item") + '("GstIteratorResyncFunction" "resync") + '("GstIteratorFreeFunction" "free") + ) +) + +(define-function gst_iterator_new_list + (c-name "gst_iterator_new_list") + (return-type "GstIterator*") + (parameters + '("GMutex*" "lock") + '("guint32*" "master_cookie") + '("GList**" "list") + '("gpointer" "owner") + '("GstIteratorItemFunction" "item") + '("GstIteratorDisposeFunction" "free") + ) +) + +(define-method next + (of-object "GstIterator") + (c-name "gst_iterator_next") + (return-type "GstIteratorResult") + (parameters + '("gpointer*" "result") + ) +) + +(define-method resync + (of-object "GstIterator") + (c-name "gst_iterator_resync") + (return-type "none") +) + +(define-method free + (of-object "GstIterator") + (c-name "gst_iterator_free") + (return-type "none") +) + +(define-method push + (of-object "GstIterator") + (c-name "gst_iterator_push") + (return-type "none") + (parameters + '("GstIterator*" "other") + ) +) + +(define-method filter + (of-object "GstIterator") + (c-name "gst_iterator_filter") + (return-type "GstIterator*") + (parameters + '("GCompareFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method fold + (of-object "GstIterator") + (c-name "gst_iterator_fold") + (return-type "GstIteratorResult") + (parameters + '("GstIteratorFoldFunction" "func") + '("GValue*" "ret") + '("gpointer" "user_data") + ) +) + +(define-method foreach + (of-object "GstIterator") + (c-name "gst_iterator_foreach") + (return-type "GstIteratorResult") + (parameters + '("GFunc" "func") + '("gpointer" "user_data") + ) +) + +(define-method find_custom + (of-object "GstIterator") + (c-name "gst_iterator_find_custom") + (return-type "gpointer") + (parameters + '("GCompareFunc" "func") + '("gpointer" "user_data") + ) +) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstmacros.h +;; From ../gstreamer/gst/gstmacros.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstmarshal.h +;; From ../gstreamer/gst/gstmarshal.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstmemchunk.h +;; From ../gstreamer/gst/gstmemchunk.h -(define-function mem_chunk_new +(define-function gst_mem_chunk_new (c-name "gst_mem_chunk_new") (is-constructor-of "GstMemChunk") (return-type "GstMemChunk*") @@ -2684,257 +2373,385 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstobject.h +;; From ../gstreamer/gst/gstmessage.h -(define-function object_get_type - (c-name "gst_object_get_type") +(define-function gst_message_get_type + (c-name "gst_message_get_type") (return-type "GType") ) -(define-method set_name - (of-object "GstObject") - (c-name "gst_object_set_name") - (return-type "none") +(define-function gst_message_new_eos + (c-name "gst_message_new_eos") + (return-type "GstMessage*") (parameters - '("const-gchar*" "name") + '("GstObject*" "src") ) ) -(define-method get_name - (of-object "GstObject") - (c-name "gst_object_get_name") - (return-type "const-gchar*") -) - -(define-method set_parent - (of-object "GstObject") - (c-name "gst_object_set_parent") - (return-type "none") +(define-function gst_message_new_error + (c-name "gst_message_new_error") + (return-type "GstMessage*") (parameters - '("GstObject*" "parent") + '("GstObject*" "src") + '("GError*" "error") + '("gchar*" "debug") ) ) -(define-method get_parent - (of-object "GstObject") - (c-name "gst_object_get_parent") - (return-type "GstObject*") -) - -(define-method unparent - (of-object "GstObject") - (c-name "gst_object_unparent") - (return-type "none") +(define-function gst_message_new_warning + (c-name "gst_message_new_warning") + (return-type "GstMessage*") + (parameters + '("GstObject*" "src") + '("GError*" "error") + '("gchar*" "debug") + ) ) -(define-function object_default_deep_notify - (c-name "gst_object_default_deep_notify") - (return-type "none") +(define-function gst_message_new_tag + (c-name "gst_message_new_tag") + (return-type "GstMessage*") (parameters - '("GObject*" "object") - '("GstObject*" "orig") - '("GParamSpec*" "pspec") - '("gchar**" "excluded_props") + '("GstObject*" "src") + '("GstTagList*" "tag_list") ) ) -(define-function object_check_uniqueness - (c-name "gst_object_check_uniqueness") - (return-type "gboolean") +(define-function gst_message_new_state_changed + (c-name "gst_message_new_state_changed") + (return-type "GstMessage*") (parameters - '("GList*" "list") - '("const-gchar*" "name") + '("GstObject*" "src") + '("GstElementState" "old_state") + '("GstElementState" "new_state") ) ) -(define-method save_thyself - (of-object "GstObject") - (c-name "gst_object_save_thyself") - (return-type "xmlNodePtr") +(define-function gst_message_new_application + (c-name "gst_message_new_application") + (return-type "GstMessage*") (parameters - '("xmlNodePtr" "parent") + '("GstStructure*" "structure") ) ) -(define-method restore_thyself - (of-object "GstObject") - (c-name "gst_object_restore_thyself") +(define-method parse_error + (of-object "GstMessage") + (c-name "gst_message_parse_error") (return-type "none") (parameters - '("xmlNodePtr" "self") + '("GError**" "gerror") + '("gchar**" "debug") ) ) -(define-method ref - (of-object "GstObject") - (c-name "gst_object_ref") - (return-type "GstObject*") -) - -(define-method unref - (of-object "GstObject") - (c-name "gst_object_unref") +(define-method parse_warning + (of-object "GstMessage") + (c-name "gst_message_parse_warning") (return-type "none") + (parameters + '("GError**" "gerror") + '("gchar**" "debug") + ) ) -(define-method sink - (of-object "GstObject") - (c-name "gst_object_sink") +(define-method parse_tag + (of-object "GstMessage") + (c-name "gst_message_parse_tag") (return-type "none") + (parameters + '("GstTagList**" "tag_list") + ) ) -(define-function object_replace - (c-name "gst_object_replace") +(define-method parse_state_changed + (of-object "GstMessage") + (c-name "gst_message_parse_state_changed") (return-type "none") (parameters - '("GstObject**" "oldobj") - '("GstObject*" "newobj") + '("GstElementState*" "old_state") + '("GstElementState*" "new_state") ) ) -(define-method get_path_string - (of-object "GstObject") - (c-name "gst_object_get_path_string") - (return-type "gchar*") +(define-method get_structure + (of-object "GstMessage") + (c-name "gst_message_get_structure") + (return-type "const-GstStructure*") ) -(define-function class_signal_connect - (c-name "gst_class_signal_connect") - (return-type "guint") - (parameters - '("GstObjectClass*" "klass") - '("const-gchar*" "name") - '("gpointer" "func") - '("gpointer" "func_data") - ) + + +;; From ../gstreamer/gst/gstminiobject.h + +(define-function gst_mini_object_get_type + (c-name "gst_mini_object_get_type") + (return-type "GType") ) -(define-function class_signal_emit_by_name - (c-name "gst_class_signal_emit_by_name") - (return-type "none") +(define-function gst_mini_object_new + (c-name "gst_mini_object_new") + (is-constructor-of "GstMiniObject") + (return-type "GstMiniObject*") (parameters - '("GstObject*" "object") - '("const-gchar*" "name") - '("xmlNodePtr" "self") + '("GType" "type") ) ) +(define-method copy + (of-object "GstMiniObject") + (c-name "gst_mini_object_copy") + (return-type "GstMiniObject*") +) +(define-method is_writable + (of-object "GstMiniObject") + (c-name "gst_mini_object_is_writable") + (return-type "gboolean") +) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstpad.h - -(define-function pad_get_type - (c-name "gst_pad_get_type") - (return-type "GType") +(define-method make_writable + (of-object "GstMiniObject") + (c-name "gst_mini_object_make_writable") + (return-type "GstMiniObject*") ) -(define-function real_pad_get_type - (c-name "gst_real_pad_get_type") - (return-type "GType") +(define-method ref + (of-object "GstMiniObject") + (c-name "gst_mini_object_ref") + (return-type "GstMiniObject*") ) -(define-function ghost_pad_get_type - (c-name "gst_ghost_pad_get_type") - (return-type "GType") +(define-method unref + (of-object "GstMiniObject") + (c-name "gst_mini_object_unref") + (return-type "none") ) -(define-function pad_new - (c-name "gst_pad_new") - (is-constructor-of "GstPad") - (return-type "GstPad*") +(define-function gst_mini_object_replace + (c-name "gst_mini_object_replace") + (return-type "none") (parameters - '("const-gchar*" "name") - '("GstPadDirection" "direction") + '("GstMiniObject**" "olddata") + '("GstMiniObject*" "newdata") ) ) -(define-function pad_new_from_template - (c-name "gst_pad_new_from_template") - (return-type "GstPad*") +(define-function gst_param_spec_mini_object + (c-name "gst_param_spec_mini_object") + (return-type "GParamSpec*") (parameters - '("GstPadTemplate*" "templ") - '("const-gchar*" "name") + '("const-char*" "name") + '("const-char*" "nick") + '("const-char*" "blurb") + '("GType" "object_type") + '("GParamFlags" "flags") ) ) -(define-function pad_custom_new - (c-name "gst_pad_custom_new") - (is-constructor-of "GstPadCustom") - (return-type "GstPad*") +(define-function gst_value_set_mini_object + (c-name "gst_value_set_mini_object") + (return-type "none") (parameters - '("GType" "type") - '("const-gchar*" "name") - '("GstPadDirection" "direction") + '("GValue*" "value") + '("GstMiniObject*" "mini_object") ) ) -(define-function pad_custom_new_from_template - (c-name "gst_pad_custom_new_from_template") - (return-type "GstPad*") +(define-function gst_value_take_mini_object + (c-name "gst_value_take_mini_object") + (return-type "none") (parameters - '("GType" "type") - '("GstPadTemplate*" "templ") - '("const-gchar*" "name") + '("GValue*" "value") + '("GstMiniObject*" "mini_object") ) ) -(define-method set_name - (of-object "GstPad") - (c-name "gst_pad_set_name") - (return-type "none") +(define-function gst_value_get_mini_object + (c-name "gst_value_get_mini_object") + (return-type "GstMiniObject*") (parameters - '("const-gchar*" "name") + '("const-GValue*" "value") ) ) -(define-method get_name - (of-object "GstPad") - (c-name "gst_pad_get_name") - (return-type "const-gchar*") -) -(define-method get_direction - (of-object "GstPad") - (c-name "gst_pad_get_direction") - (return-type "GstPadDirection") + +;; From ../gstreamer/gst/gstobject.h + +(define-function gst_object_get_type + (c-name "gst_object_get_type") + (return-type "GType") ) -(define-method set_active - (of-object "GstPad") - (c-name "gst_pad_set_active") +(define-method set_name + (of-object "GstObject") + (c-name "gst_object_set_name") + (return-type "gboolean") + (parameters + '("const-gchar*" "name") + ) +) + +(define-method get_name + (of-object "GstObject") + (c-name "gst_object_get_name") + (return-type "gchar*") +) + +(define-method set_name_prefix + (of-object "GstObject") + (c-name "gst_object_set_name_prefix") (return-type "none") (parameters - '("gboolean" "active") + '("const-gchar*" "name_prefix") ) ) -(define-method is_active - (of-object "GstPad") - (c-name "gst_pad_is_active") +(define-method get_name_prefix + (of-object "GstObject") + (c-name "gst_object_get_name_prefix") + (return-type "gchar*") +) + +(define-method set_parent + (of-object "GstObject") + (c-name "gst_object_set_parent") (return-type "gboolean") + (parameters + '("GstObject*" "parent") + ) ) -(define-method set_element_private - (of-object "GstPad") - (c-name "gst_pad_set_element_private") +(define-method get_parent + (of-object "GstObject") + (c-name "gst_object_get_parent") + (return-type "GstObject*") +) + +(define-method unparent + (of-object "GstObject") + (c-name "gst_object_unparent") + (return-type "none") +) + +(define-function gst_object_default_deep_notify + (c-name "gst_object_default_deep_notify") (return-type "none") (parameters - '("gpointer" "priv") + '("GObject*" "object") + '("GstObject*" "orig") + '("GParamSpec*" "pspec") + '("gchar**" "excluded_props") ) ) -(define-method get_element_private - (of-object "GstPad") - (c-name "gst_pad_get_element_private") - (return-type "gpointer") +(define-method ref + (of-object "GstObject") + (c-name "gst_object_ref") + (return-type "GstObject*") ) -(define-method set_parent - (of-object "GstPad") - (c-name "gst_pad_set_parent") +(define-method unref + (of-object "GstObject") + (c-name "gst_object_unref") + (return-type "GstObject*") +) + +(define-method sink + (of-object "GstObject") + (c-name "gst_object_sink") + (return-type "none") +) + +(define-function gst_object_replace + (c-name "gst_object_replace") (return-type "none") (parameters - '("GstElement*" "parent") + '("GstObject**" "oldobj") + '("GstObject*" "newobj") + ) +) + +(define-method get_path_string + (of-object "GstObject") + (c-name "gst_object_get_path_string") + (return-type "gchar*") +) + +(define-function gst_object_check_uniqueness + (c-name "gst_object_check_uniqueness") + (return-type "gboolean") + (parameters + '("GList*" "list") + '("const-gchar*" "name") + ) +) + +(define-method save_thyself + (of-object "GstObject") + (c-name "gst_object_save_thyself") + (return-type "xmlNodePtr") + (parameters + '("xmlNodePtr" "parent") + ) +) + +(define-method restore_thyself + (of-object "GstObject") + (c-name "gst_object_restore_thyself") + (return-type "none") + (parameters + '("xmlNodePtr" "self") + ) +) + +(define-function gst_class_signal_connect + (c-name "gst_class_signal_connect") + (return-type "guint") + (parameters + '("GstObjectClass*" "klass") + '("const-gchar*" "name") + '("gpointer" "func") + '("gpointer" "func_data") + ) +) + +(define-function gst_class_signal_emit_by_name + (c-name "gst_class_signal_emit_by_name") + (return-type "none") + (parameters + '("GstObject*" "object") + '("const-gchar*" "name") + '("xmlNodePtr" "self") + ) +) + + + +;; From ../gstreamer/gst/gstpad.h + +(define-function gst_pad_get_type + (c-name "gst_pad_get_type") + (return-type "GType") +) + +(define-function gst_pad_new + (c-name "gst_pad_new") + (is-constructor-of "GstPad") + (return-type "GstPad*") + (parameters + '("const-gchar*" "name") + '("GstPadDirection" "direction") + ) +) + +(define-function gst_pad_new_from_template + (c-name "gst_pad_new_from_template") + (return-type "GstPad*") + (parameters + '("GstPadTemplate*" "templ") + '("const-gchar*" "name") ) ) @@ -2944,40 +2761,75 @@ (return-type "GstElement*") ) -(define-method get_real_parent +(define-method get_direction (of-object "GstPad") - (c-name "gst_pad_get_real_parent") - (return-type "GstElement*") + (c-name "gst_pad_get_direction") + (return-type "GstPadDirection") ) -(define-method get_scheduler +(define-method set_active (of-object "GstPad") - (c-name "gst_pad_get_scheduler") - (return-type "GstScheduler*") + (c-name "gst_pad_set_active") + (return-type "gboolean") + (parameters + '("GstActivateMode" "mode") + ) ) -(define-method add_ghost_pad +(define-method peer_set_active (of-object "GstPad") - (c-name "gst_pad_add_ghost_pad") - (return-type "none") + (c-name "gst_pad_peer_set_active") + (return-type "gboolean") + (parameters + '("GstActivateMode" "mode") + ) +) + +(define-method is_active + (of-object "GstPad") + (c-name "gst_pad_is_active") + (return-type "gboolean") +) + +(define-method set_blocked + (of-object "GstPad") + (c-name "gst_pad_set_blocked") + (return-type "gboolean") + (parameters + '("gboolean" "blocked") + ) +) + +(define-method set_blocked_async + (of-object "GstPad") + (c-name "gst_pad_set_blocked_async") + (return-type "gboolean") (parameters - '("GstPad*" "ghostpad") + '("gboolean" "blocked") + '("GstPadBlockCallback" "callback") + '("gpointer" "user_data") ) ) -(define-method remove_ghost_pad +(define-method is_blocked + (of-object "GstPad") + (c-name "gst_pad_is_blocked") + (return-type "gboolean") +) + +(define-method set_element_private (of-object "GstPad") - (c-name "gst_pad_remove_ghost_pad") + (c-name "gst_pad_set_element_private") (return-type "none") (parameters - '("GstPad*" "ghostpad") + '("gpointer" "priv") ) ) -(define-method get_ghost_pad_list +(define-method get_element_private (of-object "GstPad") - (c-name "gst_pad_get_ghost_pad_list") - (return-type "GList*") + (c-name "gst_pad_get_element_private") + (return-type "gpointer") ) (define-method get_pad_template @@ -2991,93 +2843,82 @@ (c-name "gst_pad_set_bufferalloc_function") (return-type "none") (parameters - '("GstPadBufferAllocFunction" "bufferalloc") + '("GstPadBufferAllocFunction" "bufalloc") ) ) (define-method alloc_buffer (of-object "GstPad") (c-name "gst_pad_alloc_buffer") - (return-type "GstBuffer*") + (return-type "GstFlowReturn") (parameters '("guint64" "offset") '("gint" "size") + '("GstCaps*" "caps") + '("GstBuffer**" "buf") ) ) -(define-method set_chain_function +(define-method set_activate_function (of-object "GstPad") - (c-name "gst_pad_set_chain_function") + (c-name "gst_pad_set_activate_function") (return-type "none") (parameters - '("GstPadChainFunction" "chain") + '("GstPadActivateFunction" "activate") ) ) -(define-method set_get_function +(define-method set_loop_function (of-object "GstPad") - (c-name "gst_pad_set_get_function") + (c-name "gst_pad_set_loop_function") (return-type "none") (parameters - '("GstPadGetFunction" "get") + '("GstPadLoopFunction" "loop") ) ) -(define-method set_event_function +(define-method set_chain_function (of-object "GstPad") - (c-name "gst_pad_set_event_function") + (c-name "gst_pad_set_chain_function") (return-type "none") (parameters - '("GstPadEventFunction" "event") + '("GstPadChainFunction" "chain") ) ) -(define-method set_event_mask_function +(define-method set_getrange_function (of-object "GstPad") - (c-name "gst_pad_set_event_mask_function") + (c-name "gst_pad_set_getrange_function") (return-type "none") (parameters - '("GstPadEventMaskFunction" "mask_func") + '("GstPadGetRangeFunction" "get") ) ) -(define-method get_event_masks - (of-object "GstPad") - (c-name "gst_pad_get_event_masks") - (return-type "const-GstEventMask*") -) - -(define-method get_event_masks_default - (of-object "GstPad") - (c-name "gst_pad_get_event_masks_default") - (return-type "const-GstEventMask*") -) - -(define-method set_link_function +(define-method set_checkgetrange_function (of-object "GstPad") - (c-name "gst_pad_set_link_function") + (c-name "gst_pad_set_checkgetrange_function") (return-type "none") (parameters - '("GstPadLinkFunction" "link") + '("GstPadCheckGetRangeFunction" "check") ) ) -(define-method can_link +(define-method set_event_function (of-object "GstPad") - (c-name "gst_pad_can_link") - (return-type "gboolean") + (c-name "gst_pad_set_event_function") + (return-type "none") (parameters - '("GstPad*" "sinkpad") + '("GstPadEventFunction" "event") ) ) -(define-method can_link_filtered +(define-method set_link_function (of-object "GstPad") - (c-name "gst_pad_can_link_filtered") - (return-type "gboolean") + (c-name "gst_pad_set_link_function") + (return-type "none") (parameters - '("GstPad*" "sinkpad") - '("const-GstCaps*" "filtercaps") + '("GstPadLinkFunction" "link") ) ) @@ -3093,26 +2934,16 @@ (define-method link (of-object "GstPad") (c-name "gst_pad_link") - (return-type "gboolean") - (parameters - '("GstPad*" "sinkpad") - ) -) - -(define-method link_filtered - (of-object "GstPad") - (c-name "gst_pad_link_filtered") - (return-type "gboolean") + (return-type "GstPadLinkReturn") (parameters '("GstPad*" "sinkpad") - '("const-GstCaps*" "filtercaps") ) ) (define-method unlink (of-object "GstPad") (c-name "gst_pad_unlink") - (return-type "none") + (return-type "gboolean") (parameters '("GstPad*" "sinkpad") ) @@ -3130,162 +2961,93 @@ (return-type "GstPad*") ) -(define-method get_negotiated_caps +(define-method set_getcaps_function (of-object "GstPad") - (c-name "gst_pad_get_negotiated_caps") - (return-type "const-GstCaps*") -) - -(define-method is_negotiated - (of-object "GstPad") - (c-name "gst_pad_is_negotiated") - (return-type "gboolean") -) - -(define-method get_caps - (of-object "GstPad") - (c-name "gst_pad_get_caps") - (caller-owns-return #t) - (return-type "GstCaps*") -) - -(define-method get_pad_template_caps - (of-object "GstPad") - (c-name "gst_pad_get_pad_template_caps") - (return-type "const-GstCaps*") -) - -(define-method try_set_caps - (of-object "GstPad") - (c-name "gst_pad_try_set_caps") - (return-type "GstPadLinkReturn") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-method try_set_caps_nonfixed - (of-object "GstPad") - (c-name "gst_pad_try_set_caps_nonfixed") - (return-type "GstPadLinkReturn") + (c-name "gst_pad_set_getcaps_function") + (return-type "none") (parameters - '("const-GstCaps*" "caps") + '("GstPadGetCapsFunction" "getcaps") ) ) -(define-method check_compatibility +(define-method set_acceptcaps_function (of-object "GstPad") - (c-name "gst_pad_check_compatibility") - (return-type "gboolean") + (c-name "gst_pad_set_acceptcaps_function") + (return-type "none") (parameters - '("GstPad*" "sinkpad") + '("GstPadAcceptCapsFunction" "acceptcaps") ) ) -(define-method set_getcaps_function +(define-method set_fixatecaps_function (of-object "GstPad") - (c-name "gst_pad_set_getcaps_function") + (c-name "gst_pad_set_fixatecaps_function") (return-type "none") (parameters - '("GstPadGetCapsFunction" "getcaps") + '("GstPadFixateCapsFunction" "fixatecaps") ) ) -(define-method set_fixate_function +(define-method set_setcaps_function (of-object "GstPad") - (c-name "gst_pad_set_fixate_function") + (c-name "gst_pad_set_setcaps_function") (return-type "none") (parameters - '("GstPadFixateFunction" "fixate") + '("GstPadSetCapsFunction" "setcaps") ) ) -(define-method proxy_getcaps - (of-object "GstPad") - (c-name "gst_pad_proxy_getcaps") - (return-type "GstCaps*") -) - -(define-method proxy_pad_link +(define-method get_pad_template_caps (of-object "GstPad") - (c-name "gst_pad_proxy_pad_link") - (return-type "GstPadLinkReturn") - (parameters - '("const-GstCaps*" "caps") - ) + (c-name "gst_pad_get_pad_template_caps") + (return-type "const-GstCaps*") ) -(define-method proxy_fixate +(define-method get_caps (of-object "GstPad") - (c-name "gst_pad_proxy_fixate") + (c-name "gst_pad_get_caps") (return-type "GstCaps*") - (parameters - '("const-GstCaps*" "caps") - ) -) - -(define-method proxy_link - (of-object "GstPad") - (c-name "gst_pad_proxy_link") - (return-type "GstPadLinkReturn") - (parameters - '("const-GstCaps*" "caps") - ) ) -(define-method set_explicit_caps +(define-method fixate_caps (of-object "GstPad") - (c-name "gst_pad_set_explicit_caps") - (return-type "gboolean") + (c-name "gst_pad_fixate_caps") + (return-type "GstCaps*") (parameters - '("const-GstCaps*" "caps") + '("GstCaps*" "caps") ) ) -(define-method use_explicit_caps - (of-object "GstPad") - (c-name "gst_pad_use_explicit_caps") - (return-type "none") -) - -(define-method relink_filtered +(define-method accept_caps (of-object "GstPad") - (c-name "gst_pad_relink_filtered") + (c-name "gst_pad_accept_caps") (return-type "gboolean") (parameters - '("GstPad*" "sinkpad") - '("const-GstCaps*" "filtercaps") + '("GstCaps*" "caps") ) ) -(define-method perform_negotiate +(define-method set_caps (of-object "GstPad") - (c-name "gst_pad_perform_negotiate") + (c-name "gst_pad_set_caps") (return-type "gboolean") (parameters - '("GstPad*" "sinkpad") + '("GstCaps*" "caps") ) ) -(define-method renegotiate - (of-object "GstPad") - (c-name "gst_pad_renegotiate") - (return-type "GstPadLinkReturn") -) - -(define-method unnegotiate +(define-method peer_get_caps (of-object "GstPad") - (c-name "gst_pad_unnegotiate") - (return-type "none") + (c-name "gst_pad_peer_get_caps") + (return-type "GstCaps*") ) -(define-method try_relink_filtered +(define-method peer_accept_caps (of-object "GstPad") - (c-name "gst_pad_try_relink_filtered") + (c-name "gst_pad_peer_accept_caps") (return-type "gboolean") (parameters - '("GstPad*" "sinkpad") - '("const-GstCaps*" "filtercaps") + '("GstCaps*" "caps") ) ) @@ -3295,39 +3057,41 @@ (return-type "GstCaps*") ) -(define-method caps_change_notify +(define-method get_negotiated_caps (of-object "GstPad") - (c-name "gst_pad_caps_change_notify") - (return-type "none") + (c-name "gst_pad_get_negotiated_caps") + (return-type "GstCaps*") ) -(define-method recover_caps_error +(define-method push (of-object "GstPad") - (c-name "gst_pad_recover_caps_error") - (return-type "gboolean") + (c-name "gst_pad_push") + (return-type "GstFlowReturn") (parameters - '("const-GstCaps*" "allowed") + '("GstBuffer*" "buffer") ) ) -(define-method push +(define-method check_pull_range (of-object "GstPad") - (c-name "gst_pad_push") - (return-type "none") - (parameters - '("GstData*" "data") - ) + (c-name "gst_pad_check_pull_range") + (return-type "gboolean") ) -(define-method pull +(define-method pull_range (of-object "GstPad") - (c-name "gst_pad_pull") - (return-type "GstData*") + (c-name "gst_pad_pull_range") + (return-type "GstFlowReturn") + (parameters + '("guint64" "offset") + '("guint" "size") + '("GstBuffer**" "buffer") + ) ) -(define-method send_event +(define-method push_event (of-object "GstPad") - (c-name "gst_pad_send_event") + (c-name "gst_pad_push_event") (return-type "gboolean") (parameters '("GstEvent*" "event") @@ -3343,93 +3107,76 @@ ) ) -(define-function pad_selectv - (c-name "gst_pad_selectv") - (return-type "GstPad*") +(define-method chain + (of-object "GstPad") + (c-name "gst_pad_chain") + (return-type "GstFlowReturn") (parameters - '("GList*" "padlist") + '("GstBuffer*" "buffer") ) ) -(define-method select +(define-method get_range (of-object "GstPad") - (c-name "gst_pad_select") - (return-type "GstPad*") + (c-name "gst_pad_get_range") + (return-type "GstFlowReturn") (parameters + '("guint64" "offset") + '("guint" "size") + '("GstBuffer**" "buffer") ) - (varargs #t) ) -(define-method select_valist +(define-method send_event (of-object "GstPad") - (c-name "gst_pad_select_valist") - (return-type "GstPad*") + (c-name "gst_pad_send_event") + (return-type "gboolean") (parameters - '("va_list" "varargs") + '("GstEvent*" "event") ) ) -(define-method set_formats_function +(define-method start_task (of-object "GstPad") - (c-name "gst_pad_set_formats_function") - (return-type "none") + (c-name "gst_pad_start_task") + (return-type "gboolean") (parameters - '("GstPadFormatsFunction" "formats") + '("GstTaskFunction" "func") + '("gpointer" "data") ) ) -(define-method get_formats +(define-method pause_task (of-object "GstPad") - (c-name "gst_pad_get_formats") - (return-type "const-GstFormat*") + (c-name "gst_pad_pause_task") + (return-type "gboolean") ) -(define-method get_formats_default +(define-method stop_task (of-object "GstPad") - (c-name "gst_pad_get_formats_default") - (return-type "const-GstFormat*") + (c-name "gst_pad_stop_task") + (return-type "gboolean") ) -(define-method set_convert_function +(define-method set_internal_link_function (of-object "GstPad") - (c-name "gst_pad_set_convert_function") + (c-name "gst_pad_set_internal_link_function") (return-type "none") (parameters - '("GstPadConvertFunction" "convert") - ) -) - -(define-method convert - (of-object "GstPad") - (c-name "gst_pad_convert") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_value") - '("GstFormat*" "dest_format") - '("gint64*" "dest_value") + '("GstPadIntLinkFunction" "intlink") ) ) -(define-method convert_default +(define-method get_internal_links (of-object "GstPad") - (c-name "gst_pad_convert_default") - (return-type "gboolean") - (parameters - '("GstFormat" "src_format") - '("gint64" "src_value") - '("GstFormat*" "dest_format") - '("gint64*" "dest_value") - ) + (c-name "gst_pad_get_internal_links") + (return-type "GList*") ) -(define-method set_query_function +(define-method get_internal_links_default (of-object "GstPad") - (c-name "gst_pad_set_query_function") - (return-type "none") - (parameters - '("GstPadQueryFunction" "query") - ) + (c-name "gst_pad_get_internal_links_default") + (return-type "GList*") ) (define-method set_query_type_function @@ -3458,44 +3205,28 @@ (c-name "gst_pad_query") (return-type "gboolean") (parameters - '("GstQueryType" "type") - '("GstFormat*" "format") - '("gint64*" "value") + '("GstQuery*" "query") ) ) -(define-method query_default +(define-method set_query_function (of-object "GstPad") - (c-name "gst_pad_query_default") - (return-type "gboolean") + (c-name "gst_pad_set_query_function") + (return-type "none") (parameters - '("GstQueryType" "type") - '("GstFormat*" "format") - '("gint64*" "value") + '("GstPadQueryFunction" "query") ) ) -(define-method set_internal_link_function +(define-method query_default (of-object "GstPad") - (c-name "gst_pad_set_internal_link_function") - (return-type "none") + (c-name "gst_pad_query_default") + (return-type "gboolean") (parameters - '("GstPadIntLinkFunction" "intlink") + '("GstQuery*" "query") ) ) -(define-method get_internal_links - (of-object "GstPad") - (c-name "gst_pad_get_internal_links") - (return-type "GList*") -) - -(define-method get_internal_links_default - (of-object "GstPad") - (c-name "gst_pad_get_internal_links_default") - (return-type "GList*") -) - (define-method dispatcher (of-object "GstPad") (c-name "gst_pad_dispatcher") @@ -3506,23 +3237,7 @@ ) ) -(define-method add_probe - (of-object "GstPad") - (c-name "gst_pad_add_probe") - (parameters - '("GstProbe" "probe") - ) -) - -(define-method remove_probe - (of-object "GstPad") - (c-name "gst_pad_remove_probe") - (parameters - '("GstProbe" "probe") - ) -) - -(define-function pad_load_and_link +(define-function gst_pad_load_and_link (c-name "gst_pad_load_and_link") (return-type "none") (parameters @@ -3531,22 +3246,12 @@ ) ) -(define-function ghost_pad_new - (c-name "gst_ghost_pad_new") - (is-constructor-of "GstGhostPad") - (return-type "GstPad*") - (parameters - '("const-gchar*" "name") - '("GstPad*" "pad") - ) -) - -(define-function pad_template_get_type +(define-function gst_pad_template_get_type (c-name "gst_pad_template_get_type") (return-type "GType") ) -(define-function pad_template_new +(define-function gst_pad_template_new (c-name "gst_pad_template_new") (is-constructor-of "GstPadTemplate") (return-type "GstPadTemplate*") @@ -3565,39 +3270,27 @@ ) (define-method get_caps - (of-object "GstPadTemplate") - (c-name "gst_pad_template_get_caps") - (return-type "const-GstCaps*") + (of-object "GstStaticPadTemplate") + (c-name "gst_static_pad_template_get_caps") + (return-type "GstCaps*") ) -(define-method get_caps_by_name +(define-method get_caps (of-object "GstPadTemplate") - (c-name "gst_pad_template_get_caps_by_name") - (return-type "const-GstCaps*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function ghost_pad_save_thyself - (c-name "gst_ghost_pad_save_thyself") - (return-type "xmlNodePtr") - (parameters - '("GstPad*" "pad") - '("xmlNodePtr" "parent") - ) + (c-name "gst_pad_template_get_caps") + (return-type "GstCaps*") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstparse.h +;; From ../gstreamer/gst/gstparse.h -(define-function parse_error_quark +(define-function gst_parse_error_quark (c-name "gst_parse_error_quark") (return-type "GQuark") ) -(define-function parse_launch +(define-function gst_parse_launch (c-name "gst_parse_launch") (return-type "GstElement*") (parameters @@ -3606,7 +3299,7 @@ ) ) -(define-function parse_launchv +(define-function gst_parse_launchv (c-name "gst_parse_launchv") (return-type "GstElement*") (parameters @@ -3617,109 +3310,78 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstpipeline.h +;; From ../gstreamer/gst/gstpipeline.h -(define-function pipeline_get_type +(define-function gst_pipeline_get_type (c-name "gst_pipeline_get_type") (return-type "GType") ) -(define-function pipeline_new +(define-function gst_pipeline_new (c-name "gst_pipeline_new") (is-constructor-of "GstPipeline") (return-type "GstElement*") (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) + '("const-gchar*" "name") ) ) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstpluginfeature.h - -(define-function plugin_feature_get_type - (c-name "gst_plugin_feature_get_type") - (return-type "GType") +(define-method get_scheduler + (of-object "GstPipeline") + (c-name "gst_pipeline_get_scheduler") + (return-type "GstScheduler*") ) -(define-method ensure_loaded - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_ensure_loaded") - (return-type "gboolean") +(define-method get_bus + (of-object "GstPipeline") + (c-name "gst_pipeline_get_bus") + (return-type "GstBus*") ) -(define-method unload_thyself - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_unload_thyself") +(define-method use_clock + (of-object "GstPipeline") + (c-name "gst_pipeline_use_clock") (return-type "none") -) - -(define-method type_name_filter - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_type_name_filter") - (return-type "gboolean") (parameters - '("GstTypeNameData*" "data") + '("GstClock*" "clock") ) ) -(define-method set_rank - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_set_rank") +(define-method set_clock + (of-object "GstPipeline") + (c-name "gst_pipeline_set_clock") (return-type "none") (parameters - '("guint" "rank") + '("GstClock*" "clock") ) ) -(define-method set_name - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_set_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method get_rank - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_get_rank") - (return-type "guint") +(define-method get_clock + (of-object "GstPipeline") + (c-name "gst_pipeline_get_clock") + (return-type "GstClock*") ) -(define-method get_name - (of-object "GstPluginFeature") - (c-name "gst_plugin_feature_get_name") - (return-type "const-gchar*") +(define-method auto_clock + (of-object "GstPipeline") + (c-name "gst_pipeline_auto_clock") + (return-type "none") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstplugin.h +;; From ../gstreamer/gst/gstplugin.h -(define-function plugin_error_quark +(define-function gst_plugin_error_quark (c-name "gst_plugin_error_quark") (return-type "GQuark") ) -(define-function plugin_get_type +(define-function gst_plugin_get_type (c-name "gst_plugin_get_type") (return-type "GType") ) -(define-function _gst_plugin_initialize - (c-name "_gst_plugin_initialize") - (return-type "none") -) - -(define-function _gst_plugin_register_static - (c-name "_gst_plugin_register_static") - (return-type "none") - (parameters - '("GstPluginDesc*" "desc") - ) -) - (define-method get_name (of-object "GstPlugin") (c-name "gst_plugin_get_name") @@ -3738,6 +3400,12 @@ (return-type "const-gchar*") ) +(define-method get_version + (of-object "GstPlugin") + (c-name "gst_plugin_get_version") + (return-type "const-gchar*") +) + (define-method get_license (of-object "GstPlugin") (c-name "gst_plugin_get_license") @@ -3756,12 +3424,6 @@ (return-type "const-gchar*") ) -(define-method get_version - (of-object "GstPlugin") - (c-name "gst_plugin_get_version") - (return-type "const-gchar*") -) - (define-method get_module (of-object "GstPlugin") (c-name "gst_plugin_get_module") @@ -3785,7 +3447,7 @@ ) ) -(define-function plugin_list_feature_filter +(define-function gst_plugin_list_feature_filter (c-name "gst_plugin_list_feature_filter") (return-type "GList*") (parameters @@ -3821,7 +3483,16 @@ ) ) -(define-function plugin_load_file +(define-function gst_plugin_check_file + (c-name "gst_plugin_check_file") + (return-type "gboolean") + (parameters + '("const-gchar*" "filename") + '("GError**" "error") + ) +) + +(define-function gst_plugin_load_file (c-name "gst_plugin_load_file") (return-type "GstPlugin*") (parameters @@ -3845,7 +3516,7 @@ ) ) -(define-function plugin_load +(define-function gst_plugin_load (c-name "gst_plugin_load") (return-type "gboolean") (parameters @@ -3853,19 +3524,76 @@ ) ) -(define-function library_load - (c-name "gst_library_load") + + +;; From ../gstreamer/gst/gstpluginfeature.h + +(define-function gst_plugin_feature_get_type + (c-name "gst_plugin_feature_get_type") + (return-type "GType") +) + +(define-method ensure_loaded + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_ensure_loaded") + (return-type "gboolean") +) + +(define-method unload_thyself + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_unload_thyself") + (return-type "none") +) + +(define-method type_name_filter + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_type_name_filter") (return-type "gboolean") (parameters + '("GstTypeNameData*" "data") + ) +) + +(define-method set_rank + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_set_rank") + (return-type "none") + (parameters + '("guint" "rank") + ) +) + +(define-method set_name + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_set_name") + (return-type "none") + (parameters '("const-gchar*" "name") ) ) +(define-method get_rank + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_get_rank") + (return-type "guint") +) + +(define-method get_name + (of-object "GstPluginFeature") + (c-name "gst_plugin_feature_get_name") + (return-type "const-gchar*") +) + + +;; From ../gstreamer/gst/gstprobe.h -;; From /opt/gnome/include/gstreamer-0.7/gst/gstprobe.h +(define-function gst_probe_get_type + (c-name "gst_probe_get_type") + (return-type "GType") +) -(define-function probe_new +(define-function gst_probe_new (c-name "gst_probe_new") (is-constructor-of "GstProbe") (return-type "GstProbe*") @@ -3887,11 +3615,11 @@ (c-name "gst_probe_perform") (return-type "gboolean") (parameters - '("GstData**" "data") + '("GstMiniObject**" "data") ) ) -(define-function probe_dispatcher_new +(define-function gst_probe_dispatcher_new (c-name "gst_probe_dispatcher_new") (is-constructor-of "GstProbeDispatcher") (return-type "GstProbeDispatcher*") @@ -3941,20 +3669,20 @@ (c-name "gst_probe_dispatcher_dispatch") (return-type "gboolean") (parameters - '("GstData**" "data") + '("GstMiniObject**" "data") ) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstquery.h +;; From ../gstreamer/gst/gstquery.h -(define-function _gst_query_type_initialize - (c-name "_gst_query_type_initialize") - (return-type "none") +(define-function gst_query_get_type + (c-name "gst_query_get_type") + (return-type "GType") ) -(define-function query_type_register +(define-function gst_query_type_register (c-name "gst_query_type_register") (return-type "GstQueryType") (parameters @@ -3963,7 +3691,7 @@ ) ) -(define-function query_type_get_by_nick +(define-function gst_query_type_get_by_nick (c-name "gst_query_type_get_by_nick") (return-type "GstQueryType") (parameters @@ -3986,25 +3714,151 @@ (return-type "const-GstQueryTypeDefinition*") ) -(define-function query_type_get_definitions - (c-name "gst_query_type_get_definitions") - (return-type "const-GList*") +(define-function gst_query_type_iterate_definitions + (c-name "gst_query_type_iterate_definitions") + (return-type "GstIterator*") +) + +(define-function gst_query_new_position + (c-name "gst_query_new_position") + (return-type "GstQuery*") + (parameters + '("GstFormat" "format") + ) +) + +(define-method set_position + (of-object "GstQuery") + (c-name "gst_query_set_position") + (return-type "none") + (parameters + '("GstFormat" "format") + '("gint64" "cur") + '("gint64" "end") + ) +) + +(define-method parse_position + (of-object "GstQuery") + (c-name "gst_query_parse_position") + (return-type "none") + (parameters + '("GstFormat*" "format") + '("gint64*" "cur") + '("gint64*" "end") + ) +) + +(define-function gst_query_new_convert + (c-name "gst_query_new_convert") + (return-type "GstQuery*") + (parameters + '("GstFormat" "src_fmt") + '("gint64" "value") + '("GstFormat" "dest_fmt") + ) +) + +(define-method set_convert + (of-object "GstQuery") + (c-name "gst_query_set_convert") + (return-type "none") + (parameters + '("GstFormat" "src_format") + '("gint64" "src_value") + '("GstFormat" "dest_format") + '("gint64" "dest_value") + ) +) + +(define-method parse_convert + (of-object "GstQuery") + (c-name "gst_query_parse_convert") + (return-type "none") + (parameters + '("GstFormat*" "src_format") + '("gint64*" "src_value") + '("GstFormat*" "dest_format") + '("gint64*" "dest_value") + ) +) + +(define-function gst_query_new_application + (c-name "gst_query_new_application") + (return-type "GstQuery*") + (parameters + '("GstQueryType" "type") + '("GstStructure*" "structure") + ) +) + +(define-method get_structure + (of-object "GstQuery") + (c-name "gst_query_get_structure") + (return-type "GstStructure*") +) + + + +;; From ../gstreamer/gst/gstqueryutils.h + +(define-method parse_seeking_query + (of-object "GstQuery") + (c-name "gst_query_parse_seeking_query") + (return-type "none") + (parameters + '("GstFormat*" "format") + ) +) + +(define-method set_seeking + (of-object "GstQuery") + (c-name "gst_query_set_seeking") + (return-type "none") + (parameters + '("GstFormat" "format") + '("gboolean" "seekable") + '("gint64" "segment_start") + '("gint64" "segment_end") + ) +) + +(define-method parse_seeking_response + (of-object "GstQuery") + (c-name "gst_query_parse_seeking_response") + (return-type "none") + (parameters + '("GstFormat*" "format") + '("gboolean*" "seekable") + '("gint64*" "segment_start") + '("gint64*" "segment_end") + ) +) + +(define-method set_formats + (of-object "GstQuery") + (c-name "gst_query_set_formats") + (return-type "none") + (parameters + '("gint" "n_formats") + ) + (varargs #t) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstqueue.h +;; From ../gstreamer/gst/gstqueue.h -(define-function queue_get_type +(define-function gst_queue_get_type (c-name "gst_queue_get_type") (return-type "GType") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstregistry.h +;; From ../gstreamer/gst/gstregistry.h -(define-function registry_get_type +(define-function gst_registry_get_type (c-name "gst_registry_get_type") (return-type "GType") ) @@ -4148,9 +4002,9 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstregistrypool.h +;; From ../gstreamer/gst/gstregistrypool.h -(define-function registry_pool_list +(define-function gst_registry_pool_list (c-name "gst_registry_pool_list") (return-type "GList*") ) @@ -4170,7 +4024,7 @@ (return-type "none") ) -(define-function registry_pool_add_plugin +(define-function gst_registry_pool_add_plugin (c-name "gst_registry_pool_add_plugin") (return-type "none") (parameters @@ -4178,12 +4032,12 @@ ) ) -(define-function registry_pool_load_all +(define-function gst_registry_pool_load_all (c-name "gst_registry_pool_load_all") (return-type "none") ) -(define-function registry_pool_plugin_filter +(define-function gst_registry_pool_plugin_filter (c-name "gst_registry_pool_plugin_filter") (return-type "GList*") (parameters @@ -4193,7 +4047,7 @@ ) ) -(define-function registry_pool_feature_filter +(define-function gst_registry_pool_feature_filter (c-name "gst_registry_pool_feature_filter") (return-type "GList*") (parameters @@ -4203,12 +4057,12 @@ ) ) -(define-function registry_pool_plugin_list +(define-function gst_registry_pool_plugin_list (c-name "gst_registry_pool_plugin_list") (return-type "GList*") ) -(define-function registry_pool_feature_list +(define-function gst_registry_pool_feature_list (c-name "gst_registry_pool_feature_list") (return-type "GList*") (parameters @@ -4216,7 +4070,7 @@ ) ) -(define-function registry_pool_find_plugin +(define-function gst_registry_pool_find_plugin (c-name "gst_registry_pool_find_plugin") (return-type "GstPlugin*") (parameters @@ -4224,7 +4078,7 @@ ) ) -(define-function registry_pool_find_feature +(define-function gst_registry_pool_find_feature (c-name "gst_registry_pool_find_feature") (return-type "GstPluginFeature*") (parameters @@ -4233,7 +4087,7 @@ ) ) -(define-function registry_pool_get_prefered +(define-function gst_registry_pool_get_prefered (c-name "gst_registry_pool_get_prefered") (return-type "GstRegistry*") (parameters @@ -4243,9 +4097,9 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstscheduler.h +;; From ../gstreamer/gst/gstscheduler.h -(define-function scheduler_get_type +(define-function gst_scheduler_get_type (c-name "gst_scheduler_get_type") (return-type "GType") ) @@ -4262,282 +4116,116 @@ (return-type "none") ) -(define-method add_element +(define-method create_task (of-object "GstScheduler") - (c-name "gst_scheduler_add_element") - (return-type "none") + (c-name "gst_scheduler_create_task") + (return-type "GstTask*") (parameters - '("GstElement*" "element") + '("GstTaskFunction" "func") + '("gpointer" "data") ) ) -(define-method remove_element - (of-object "GstScheduler") - (c-name "gst_scheduler_remove_element") - (return-type "none") +(define-function gst_scheduler_factory_get_type + (c-name "gst_scheduler_factory_get_type") + (return-type "GType") +) + +(define-function gst_scheduler_register + (c-name "gst_scheduler_register") + (return-type "gboolean") (parameters - '("GstElement*" "element") + '("GstPlugin*" "plugin") + '("const-gchar*" "name") + '("const-gchar*" "longdesc") + '("GType" "type") ) ) -(define-method add_scheduler - (of-object "GstScheduler") - (c-name "gst_scheduler_add_scheduler") - (return-type "none") +(define-function gst_scheduler_factory_new + (c-name "gst_scheduler_factory_new") + (is-constructor-of "GstSchedulerFactory") + (return-type "GstSchedulerFactory*") (parameters - '("GstScheduler*" "sched2") + '("const-gchar*" "name") + '("const-gchar*" "longdesc") + '("GType" "type") ) ) -(define-method remove_scheduler - (of-object "GstScheduler") - (c-name "gst_scheduler_remove_scheduler") +(define-method destroy + (of-object "GstSchedulerFactory") + (c-name "gst_scheduler_factory_destroy") (return-type "none") - (parameters - '("GstScheduler*" "sched2") - ) ) -(define-method state_transition - (of-object "GstScheduler") - (c-name "gst_scheduler_state_transition") - (return-type "GstElementStateReturn") +(define-function gst_scheduler_factory_find + (c-name "gst_scheduler_factory_find") + (return-type "GstSchedulerFactory*") (parameters - '("GstElement*" "element") - '("gint" "transition") + '("const-gchar*" "name") ) ) -(define-method scheduling_change - (of-object "GstScheduler") - (c-name "gst_scheduler_scheduling_change") - (return-type "none") +(define-method create + (of-object "GstSchedulerFactory") + (c-name "gst_scheduler_factory_create") + (return-type "GstScheduler*") (parameters - '("GstElement*" "element") + '("GstElement*" "parent") ) ) -(define-method lock_element - (of-object "GstScheduler") - (c-name "gst_scheduler_lock_element") - (return-type "none") +(define-function gst_scheduler_factory_make + (c-name "gst_scheduler_factory_make") + (return-type "GstScheduler*") (parameters - '("GstElement*" "element") + '("const-gchar*" "name") + '("GstElement*" "parent") ) ) -(define-method unlock_element - (of-object "GstScheduler") - (c-name "gst_scheduler_unlock_element") +(define-function gst_scheduler_factory_set_default_name + (c-name "gst_scheduler_factory_set_default_name") (return-type "none") (parameters - '("GstElement*" "element") + '("const-gchar*" "name") ) ) -(define-method yield - (of-object "GstScheduler") - (c-name "gst_scheduler_yield") - (return-type "gboolean") - (parameters - '("GstElement*" "element") - ) +(define-function gst_scheduler_factory_get_default_name + (c-name "gst_scheduler_factory_get_default_name") + (return-type "const-gchar*") ) -(define-method interrupt - (of-object "GstScheduler") - (c-name "gst_scheduler_interrupt") - (return-type "gboolean") + + +;; From ../gstreamer/gst/gststructure.h + +(define-function gst_structure_get_type + (c-name "gst_structure_get_type") + (return-type "GType") +) + +(define-function gst_structure_empty_new + (c-name "gst_structure_empty_new") + (is-constructor-of "GstStructureEmpty") + (return-type "GstStructure*") (parameters - '("GstElement*" "element") + '("const-gchar*" "name") ) ) -(define-method error - (of-object "GstScheduler") - (c-name "gst_scheduler_error") - (return-type "none") +(define-function gst_structure_id_empty_new + (c-name "gst_structure_id_empty_new") + (is-constructor-of "GstStructureIdEmpty") + (return-type "GstStructure*") (parameters - '("GstElement*" "element") + '("GQuark" "quark") ) ) -(define-method pad_link - (of-object "GstScheduler") - (c-name "gst_scheduler_pad_link") - (return-type "none") - (parameters - '("GstPad*" "srcpad") - '("GstPad*" "sinkpad") - ) -) - -(define-method pad_unlink - (of-object "GstScheduler") - (c-name "gst_scheduler_pad_unlink") - (return-type "none") - (parameters - '("GstPad*" "srcpad") - '("GstPad*" "sinkpad") - ) -) - -(define-method pad_select - (of-object "GstScheduler") - (c-name "gst_scheduler_pad_select") - (return-type "GstPad*") - (parameters - '("GList*" "padlist") - ) -) - -(define-method clock_wait - (of-object "GstScheduler") - (c-name "gst_scheduler_clock_wait") - (return-type "GstClockReturn") - (parameters - '("GstElement*" "element") - '("GstClockID" "id") - '("GstClockTimeDiff*" "jitter") - ) -) - -(define-method iterate - (of-object "GstScheduler") - (c-name "gst_scheduler_iterate") - (return-type "gboolean") -) - -(define-method use_clock - (of-object "GstScheduler") - (c-name "gst_scheduler_use_clock") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method set_clock - (of-object "GstScheduler") - (c-name "gst_scheduler_set_clock") - (return-type "none") - (parameters - '("GstClock*" "clock") - ) -) - -(define-method get_clock - (of-object "GstScheduler") - (c-name "gst_scheduler_get_clock") - (return-type "GstClock*") -) - -(define-method auto_clock - (of-object "GstScheduler") - (c-name "gst_scheduler_auto_clock") - (return-type "none") -) - -(define-method show - (of-object "GstScheduler") - (c-name "gst_scheduler_show") - (return-type "none") -) - -(define-function scheduler_factory_get_type - (c-name "gst_scheduler_factory_get_type") - (return-type "GType") -) - -(define-function scheduler_factory_new - (c-name "gst_scheduler_factory_new") - (is-constructor-of "GstSchedulerFactory") - (return-type "GstSchedulerFactory*") - (parameters - '("const-gchar*" "name") - '("const-gchar*" "longdesc") - '("GType" "type") - ) -) - -(define-method destroy - (of-object "GstSchedulerFactory") - (c-name "gst_scheduler_factory_destroy") - (return-type "none") -) - -(define-function scheduler_factory_find - (c-name "gst_scheduler_factory_find") - (return-type "GstSchedulerFactory*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-method create - (of-object "GstSchedulerFactory") - (c-name "gst_scheduler_factory_create") - (return-type "GstScheduler*") - (parameters - '("GstElement*" "parent") - ) -) - -(define-function scheduler_factory_make - (c-name "gst_scheduler_factory_make") - (return-type "GstScheduler*") - (parameters - '("const-gchar*" "name") - '("GstElement*" "parent") - ) -) - -(define-function scheduler_factory_set_default_name - (c-name "gst_scheduler_factory_set_default_name") - (return-type "none") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function scheduler_factory_get_default_name - (c-name "gst_scheduler_factory_get_default_name") - (return-type "const-gchar*") -) - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gststructure.h - -(define-function structure_get_type - (c-name "gst_structure_get_type") - (return-type "GType") -) - -(define-function _gst_structure_initialize - (c-name "_gst_structure_initialize") - (return-type "none") -) - -(define-function structure_empty_new - (c-name "gst_structure_empty_new") - (is-constructor-of "GstStructureEmpty") - (return-type "GstStructure*") - (parameters - '("const-gchar*" "name") - ) -) - -(define-function structure_id_empty_new - (c-name "gst_structure_id_empty_new") - (is-constructor-of "GstStructureIdEmpty") - (return-type "GstStructure*") - (parameters - '("GQuark" "quark") - ) -) - -(define-function structure_new +(define-function gst_structure_new (c-name "gst_structure_new") (is-constructor-of "GstStructure") (return-type "GstStructure*") @@ -4548,7 +4236,7 @@ (varargs #t) ) -(define-function structure_new_valist +(define-function gst_structure_new_valist (c-name "gst_structure_new_valist") (return-type "GstStructure*") (parameters @@ -4564,6 +4252,15 @@ (return-type "GstStructure*") ) +(define-method set_parent_refcount + (of-object "GstStructure") + (c-name "gst_structure_set_parent_refcount") + (return-type "none") + (parameters + '("gint*" "refcount") + ) +) + (define-method free (of-object "GstStructure") (c-name "gst_structure_free") @@ -4576,6 +4273,12 @@ (return-type "const-gchar*") ) +(define-method get_name_id + (of-object "GstStructure") + (c-name "gst_structure_get_name_id") + (return-type "GQuark") +) + (define-method set_name (of-object "GstStructure") (c-name "gst_structure_set_name") @@ -4697,6 +4400,16 @@ ) ) +(define-method map_in_place + (of-object "GstStructure") + (c-name "gst_structure_map_in_place") + (return-type "gboolean") + (parameters + '("GstStructureMapFunc" "func") + '("gpointer" "user_data") + ) +) + (define-method n_fields (of-object "GstStructure") (c-name "gst_structure_n_fields") @@ -4777,7 +4490,7 @@ (return-type "gchar*") ) -(define-function structure_from_string +(define-function gst_structure_from_string (c-name "gst_structure_from_string") (return-type "GstStructure*") (parameters @@ -4786,48 +4499,63 @@ ) ) +(define-function gst_caps_structure_fixate_field_nearest_int + (c-name "gst_caps_structure_fixate_field_nearest_int") + (return-type "gboolean") + (parameters + '("GstStructure*" "structure") + '("const-char*" "field_name") + '("int" "target") + ) +) + +(define-function gst_caps_structure_fixate_field_nearest_double + (c-name "gst_caps_structure_fixate_field_nearest_double") + (return-type "gboolean") + (parameters + '("GstStructure*" "structure") + '("const-char*" "field_name") + '("double" "target") + ) +) + -;; From /opt/gnome/include/gstreamer-0.7/gst/gstsystemclock.h +;; From ../gstreamer/gst/gstsystemclock.h -(define-function system_clock_get_type +(define-function gst_system_clock_get_type (c-name "gst_system_clock_get_type") (return-type "GType") ) -(define-function system_clock_obtain +(define-function gst_system_clock_obtain (c-name "gst_system_clock_obtain") (return-type "GstClock*") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttag.h +;; From ../gstreamer/gst/gsttag.h -(define-function _gst_tag_initialize - (c-name "_gst_tag_initialize") - (return-type "none") -) - -(define-function tag_list_get_type +(define-function gst_tag_list_get_type (c-name "gst_tag_list_get_type") (return-type "GType") ) -(define-function tag_register +(define-function gst_tag_register (c-name "gst_tag_register") (return-type "none") (parameters - '("gchar*" "name") + '("const-gchar*" "name") '("GstTagFlag" "flag") '("GType" "type") - '("gchar*" "nick") - '("gchar*" "blurb") + '("const-gchar*" "nick") + '("const-gchar*" "blurb") '("GstTagMergeFunc" "func") ) ) -(define-function tag_merge_use_first +(define-function gst_tag_merge_use_first (c-name "gst_tag_merge_use_first") (return-type "none") (parameters @@ -4836,7 +4564,7 @@ ) ) -(define-function tag_merge_strings_with_comma +(define-function gst_tag_merge_strings_with_comma (c-name "gst_tag_merge_strings_with_comma") (return-type "none") (parameters @@ -4845,7 +4573,7 @@ ) ) -(define-function tag_exists +(define-function gst_tag_exists (c-name "gst_tag_exists") (return-type "gboolean") (parameters @@ -4853,7 +4581,7 @@ ) ) -(define-function tag_get_type +(define-function gst_tag_get_type (c-name "gst_tag_get_type") (return-type "GType") (parameters @@ -4861,7 +4589,7 @@ ) ) -(define-function tag_get_nick +(define-function gst_tag_get_nick (c-name "gst_tag_get_nick") (return-type "const-gchar*") (parameters @@ -4869,7 +4597,7 @@ ) ) -(define-function tag_get_description +(define-function gst_tag_get_description (c-name "gst_tag_get_description") (return-type "const-gchar*") (parameters @@ -4877,7 +4605,15 @@ ) ) -(define-function tag_is_fixed +(define-function gst_tag_get_flag + (c-name "gst_tag_get_flag") + (return-type "GstTagFlag") + (parameters + '("const-gchar*" "tag") + ) +) + +(define-function gst_tag_is_fixed (c-name "gst_tag_is_fixed") (return-type "gboolean") (parameters @@ -4885,13 +4621,13 @@ ) ) -(define-function tag_list_new +(define-function gst_tag_list_new (c-name "gst_tag_list_new") (is-constructor-of "GstTagList") (return-type "GstTagList*") ) -(define-function is_tag_list +(define-function gst_is_tag_list (c-name "gst_is_tag_list") (return-type "gboolean") (parameters @@ -5013,7 +4749,7 @@ ) ) -(define-function tag_list_copy_value +(define-function gst_tag_list_copy_value (c-name "gst_tag_list_copy_value") (return-type "gboolean") (parameters @@ -5296,7 +5032,7 @@ ) ) -(define-function event_new_tag +(define-function gst_event_new_tag (c-name "gst_event_new_tag") (return-type "GstEvent*") (parameters @@ -5310,9 +5046,11 @@ (return-type "GstTagList*") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttaginterface.h -(define-function tag_setter_get_type + +;; From ../gstreamer/gst/gsttaginterface.h + +(define-function gst_tag_setter_get_type (c-name "gst_tag_setter_get_type") (return-type "GType") ) @@ -5327,464 +5065,771 @@ ) ) -(define-method add - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add") - (return-type "none") +(define-method add + (of-object "GstTagSetter") + (c-name "gst_tag_setter_add") + (return-type "none") + (parameters + '("GstTagMergeMode" "mode") + '("const-gchar*" "tag") + ) + (varargs #t) +) + +(define-method add_values + (of-object "GstTagSetter") + (c-name "gst_tag_setter_add_values") + (return-type "none") + (parameters + '("GstTagMergeMode" "mode") + '("const-gchar*" "tag") + ) + (varargs #t) +) + +(define-method add_valist + (of-object "GstTagSetter") + (c-name "gst_tag_setter_add_valist") + (return-type "none") + (parameters + '("GstTagMergeMode" "mode") + '("const-gchar*" "tag") + '("va_list" "var_args") + ) +) + +(define-method add_valist_values + (of-object "GstTagSetter") + (c-name "gst_tag_setter_add_valist_values") + (return-type "none") + (parameters + '("GstTagMergeMode" "mode") + '("const-gchar*" "tag") + '("va_list" "var_args") + ) +) + +(define-method get_list + (of-object "GstTagSetter") + (c-name "gst_tag_setter_get_list") + (return-type "const-GstTagList*") +) + +(define-method set_merge_mode + (of-object "GstTagSetter") + (c-name "gst_tag_setter_set_merge_mode") + (return-type "none") + (parameters + '("GstTagMergeMode" "mode") + ) +) + +(define-method get_merge_mode + (of-object "GstTagSetter") + (c-name "gst_tag_setter_get_merge_mode") + (return-type "GstTagMergeMode") +) + + + +;; From ../gstreamer/gst/gsttask.h + +(define-function gst_task_get_type + (c-name "gst_task_get_type") + (return-type "GType") +) + +(define-function gst_task_create + (c-name "gst_task_create") + (return-type "GstTask*") + (parameters + '("GstTaskFunction" "func") + '("gpointer" "data") + ) +) + +(define-method set_lock + (of-object "GstTask") + (c-name "gst_task_set_lock") + (return-type "none") + (parameters + '("GStaticRecMutex*" "mutex") + ) +) + +(define-method get_state + (of-object "GstTask") + (c-name "gst_task_get_state") + (return-type "GstTaskState") +) + +(define-method start + (of-object "GstTask") + (c-name "gst_task_start") + (return-type "gboolean") +) + +(define-method stop + (of-object "GstTask") + (c-name "gst_task_stop") + (return-type "gboolean") +) + +(define-method pause + (of-object "GstTask") + (c-name "gst_task_pause") + (return-type "gboolean") +) + + + +;; From ../gstreamer/gst/gsttrace.h + +(define-function gst_trace_new + (c-name "gst_trace_new") + (is-constructor-of "GstTrace") + (return-type "GstTrace*") + (parameters + '("gchar*" "filename") + '("gint" "size") + ) +) + +(define-method destroy + (of-object "GstTrace") + (c-name "gst_trace_destroy") + (return-type "none") +) + +(define-method flush + (of-object "GstTrace") + (c-name "gst_trace_flush") + (return-type "none") +) + +(define-method text_flush + (of-object "GstTrace") + (c-name "gst_trace_text_flush") + (return-type "none") +) + +(define-method set_default + (of-object "GstTrace") + (c-name "gst_trace_set_default") + (return-type "none") +) + +(define-function gst_trace_read_tsc + (c-name "gst_trace_read_tsc") + (return-type "none") + (parameters + '("gint64*" "dst") + ) +) + +(define-function gst_alloc_trace_available + (c-name "gst_alloc_trace_available") + (return-type "gboolean") +) + +(define-function gst_alloc_trace_list + (c-name "gst_alloc_trace_list") + (return-type "const-GList*") +) + +(define-function gst_alloc_trace_live_all + (c-name "gst_alloc_trace_live_all") + (return-type "int") +) + +(define-function gst_alloc_trace_print_all + (c-name "gst_alloc_trace_print_all") + (return-type "none") +) + +(define-function gst_alloc_trace_set_flags_all + (c-name "gst_alloc_trace_set_flags_all") + (return-type "none") + (parameters + '("GstAllocTraceFlags" "flags") + ) +) + +(define-function gst_alloc_trace_get + (c-name "gst_alloc_trace_get") + (return-type "GstAllocTrace*") + (parameters + '("const-gchar*" "name") + ) +) + +(define-method print + (of-object "GstAllocTrace") + (c-name "gst_alloc_trace_print") + (return-type "none") +) + +(define-method set_flags + (of-object "GstAllocTrace") + (c-name "gst_alloc_trace_set_flags") + (return-type "none") + (parameters + '("GstAllocTraceFlags" "flags") + ) +) + + + +;; From ../gstreamer/gst/gsttrashstack.h + + + +;; From ../gstreamer/gst/gsttypefind.h + +(define-method peek + (of-object "GstTypeFind") + (c-name "gst_type_find_peek") + (return-type "guint8*") + (parameters + '("gint64" "offset") + '("guint" "size") + ) +) + +(define-method suggest + (of-object "GstTypeFind") + (c-name "gst_type_find_suggest") + (return-type "none") + (parameters + '("guint" "probability") + '("const-GstCaps*" "caps") + ) +) + +(define-method get_length + (of-object "GstTypeFind") + (c-name "gst_type_find_get_length") + (return-type "guint64") +) + +(define-function gst_type_find_register + (c-name "gst_type_find_register") + (return-type "gboolean") + (parameters + '("GstPlugin*" "plugin") + '("const-gchar*" "name") + '("guint" "rank") + '("GstTypeFindFunction" "func") + '("gchar**" "extensions") + '("const-GstCaps*" "possible_caps") + '("gpointer" "data") + ) +) + +(define-function gst_type_find_factory_get_type + (c-name "gst_type_find_factory_get_type") + (return-type "GType") +) + +(define-function gst_type_find_factory_get_list + (c-name "gst_type_find_factory_get_list") + (return-type "GList*") +) + +(define-method get_extensions + (of-object "GstTypeFindFactory") + (c-name "gst_type_find_factory_get_extensions") + (return-type "gchar**") +) + +(define-method get_caps + (of-object "GstTypeFindFactory") + (c-name "gst_type_find_factory_get_caps") + (return-type "const-GstCaps*") +) + +(define-method call_function + (of-object "GstTypeFindFactory") + (c-name "gst_type_find_factory_call_function") + (return-type "none") + (parameters + '("GstTypeFind*" "find") + ) +) + + + +;; From ../gstreamer/gst/gsttypes.h + + + +;; From ../gstreamer/gst/gsturi.h + +(define-function gst_uri_protocol_is_valid + (c-name "gst_uri_protocol_is_valid") + (return-type "gboolean") + (parameters + '("const-gchar*" "protocol") + ) +) + +(define-function gst_uri_is_valid + (c-name "gst_uri_is_valid") + (return-type "gboolean") (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") + '("const-gchar*" "uri") ) - (varargs #t) ) -(define-method add_values - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_values") - (return-type "none") +(define-function gst_uri_get_protocol + (c-name "gst_uri_get_protocol") + (return-type "gchar*") (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") + '("const-gchar*" "uri") ) - (varargs #t) ) -(define-method add_valist - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_valist") - (return-type "none") +(define-function gst_uri_get_location + (c-name "gst_uri_get_location") + (return-type "gchar*") (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") + '("const-gchar*" "uri") ) ) -(define-method add_valist_values - (of-object "GstTagSetter") - (c-name "gst_tag_setter_add_valist_values") - (return-type "none") +(define-function gst_uri_construct + (c-name "gst_uri_construct") + (return-type "gchar*") (parameters - '("GstTagMergeMode" "mode") - '("const-gchar*" "tag") - '("va_list" "var_args") + '("const-gchar*" "protocol") + '("const-gchar*" "location") ) ) -(define-method get_list - (of-object "GstTagSetter") - (c-name "gst_tag_setter_get_list") - (return-type "const-GstTagList*") -) - -(define-method set_merge_mode - (of-object "GstTagSetter") - (c-name "gst_tag_setter_set_merge_mode") - (return-type "none") +(define-function gst_element_make_from_uri + (c-name "gst_element_make_from_uri") + (return-type "GstElement*") (parameters - '("GstTagMergeMode" "mode") + '("const-GstURIType" "type") + '("const-gchar*" "uri") + '("const-gchar*" "elementname") ) ) -(define-method get_merge_mode - (of-object "GstTagSetter") - (c-name "gst_tag_setter_get_merge_mode") - (return-type "GstTagMergeMode") +(define-function gst_uri_handler_get_type + (c-name "gst_uri_handler_get_type") + (return-type "GType") ) +(define-method get_uri_type + (of-object "GstURIHandler") + (c-name "gst_uri_handler_get_uri_type") + (return-type "guint") +) +(define-method get_protocols + (of-object "GstURIHandler") + (c-name "gst_uri_handler_get_protocols") + (return-type "gchar**") +) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstthread.h - -(define-function thread_get_type - (c-name "gst_thread_get_type") - (return-type "GType") +(define-method get_uri + (of-object "GstURIHandler") + (c-name "gst_uri_handler_get_uri") + (return-type "const-gchar*") ) -(define-function thread_new - (c-name "gst_thread_new") - (is-constructor-of "GstThread") - (return-type "GstElement*") +(define-method set_uri + (of-object "GstURIHandler") + (c-name "gst_uri_handler_set_uri") + (return-type "gboolean") (parameters - '("const-gchar*" "name" (null-ok) (default "NULL")) + '("const-gchar*" "uri") ) ) -(define-method set_priority - (of-object "GstThread") - (c-name "gst_thread_set_priority") +(define-method new_uri + (of-object "GstURIHandler") + (c-name "gst_uri_handler_new_uri") (return-type "none") (parameters - '("GThreadPriority" "priority") + '("const-gchar*" "uri") ) ) -(define-function thread_get_current - (c-name "gst_thread_get_current") - (return-type "GstThread*") + + +;; From ../gstreamer/gst/gsturitype.h + +(define-function gst_uri_get_uri_type + (c-name "gst_uri_get_uri_type") + (return-type "GType") ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttrace.h +;; From ../gstreamer/gst/gstutils.h -(define-function trace_new - (c-name "gst_trace_new") - (is-constructor-of "GstTrace") - (return-type "GstTrace*") +(define-function gst_util_set_value_from_string + (c-name "gst_util_set_value_from_string") + (return-type "none") (parameters - '("gchar*" "filename") - '("gint" "size") + '("GValue*" "value") + '("const-gchar*" "value_str") ) ) -(define-method destroy - (of-object "GstTrace") - (c-name "gst_trace_destroy") +(define-function gst_util_set_object_arg + (c-name "gst_util_set_object_arg") (return-type "none") + (parameters + '("GObject*" "object") + '("const-gchar*" "name") + '("const-gchar*" "value") + ) ) -(define-method flush - (of-object "GstTrace") - (c-name "gst_trace_flush") +(define-function gst_util_dump_mem + (c-name "gst_util_dump_mem") (return-type "none") + (parameters + '("const-guchar*" "mem") + '("guint" "size") + ) ) -(define-method text_flush - (of-object "GstTrace") - (c-name "gst_trace_text_flush") +(define-function gst_print_pad_caps + (c-name "gst_print_pad_caps") (return-type "none") + (parameters + '("GString*" "buf") + '("gint" "indent") + '("GstPad*" "pad") + ) ) -(define-method set_default - (of-object "GstTrace") - (c-name "gst_trace_set_default") +(define-function gst_print_element_args + (c-name "gst_print_element_args") (return-type "none") + (parameters + '("GString*" "buf") + '("gint" "indent") + '("GstElement*" "element") + ) ) -(define-method _add_entry - (of-object "GstTrace") - (c-name "_gst_trace_add_entry") +(define-method default_error + (of-object "GstObject") + (c-name "gst_object_default_error") (return-type "none") (parameters - '("guint32" "seq") - '("guint32" "data") - '("gchar*" "msg") + '("GError*" "error") + '("gchar*" "debug") ) ) -(define-function trace_read_tsc - (c-name "gst_trace_read_tsc") +(define-method abort_preroll + (of-object "GstElement") + (c-name "gst_element_abort_preroll") + (return-type "GstFlowReturn") +) + +(define-method finish_preroll + (of-object "GstElement") + (c-name "gst_element_finish_preroll") + (return-type "GstFlowReturn") + (parameters + '("GstPad*" "pad") + ) +) + +(define-method create_all_pads + (of-object "GstElement") + (c-name "gst_element_create_all_pads") (return-type "none") +) + +(define-method get_compatible_pad + (of-object "GstElement") + (c-name "gst_element_get_compatible_pad") + (return-type "GstPad*") (parameters - '("gint64*" "dst") + '("GstPad*" "pad") + '("const-GstCaps*" "caps") ) ) -(define-function alloc_trace_available - (c-name "gst_alloc_trace_available") - (return-type "gboolean") +(define-method get_compatible_pad_template + (of-object "GstElement") + (c-name "gst_element_get_compatible_pad_template") + (return-type "GstPadTemplate*") + (parameters + '("GstPadTemplate*" "compattempl") + ) ) -(define-function alloc_trace_list - (c-name "gst_alloc_trace_list") - (return-type "const-GList*") +(define-method get_name + (of-object "GstElementState") + (c-name "gst_element_state_get_name") + (return-type "const-gchar*") ) -(define-function _gst_alloc_trace_register - (c-name "_gst_alloc_trace_register") - (return-type "GstAllocTrace*") +(define-method link + (of-object "GstElement") + (c-name "gst_element_link") + (return-type "gboolean") (parameters - '("const-gchar*" "name") + '("GstElement*" "dest") ) ) -(define-function alloc_trace_live_all - (c-name "gst_alloc_trace_live_all") - (return-type "int") +(define-method link_many + (of-object "GstElement") + (c-name "gst_element_link_many") + (return-type "gboolean") + (parameters + '("GstElement*" "element_2") + ) + (varargs #t) ) -(define-function alloc_trace_print_all - (c-name "gst_alloc_trace_print_all") +(define-method unlink + (of-object "GstElement") + (c-name "gst_element_unlink") (return-type "none") + (parameters + '("GstElement*" "dest") + ) ) -(define-function alloc_trace_set_flags_all - (c-name "gst_alloc_trace_set_flags_all") +(define-method unlink_many + (of-object "GstElement") + (c-name "gst_element_unlink_many") (return-type "none") (parameters - '("GstAllocTraceFlags" "flags") + '("GstElement*" "element_2") ) + (varargs #t) ) -(define-function alloc_trace_get - (c-name "gst_alloc_trace_get") - (return-type "GstAllocTrace*") +(define-method link_pads + (of-object "GstElement") + (c-name "gst_element_link_pads") + (return-type "gboolean") (parameters - '("const-gchar*" "name") + '("const-gchar*" "srcpadname") + '("GstElement*" "dest") + '("const-gchar*" "destpadname") ) ) -(define-method print - (of-object "GstAllocTrace") - (c-name "gst_alloc_trace_print") +(define-method unlink_pads + (of-object "GstElement") + (c-name "gst_element_unlink_pads") (return-type "none") + (parameters + '("const-gchar*" "srcpadname") + '("GstElement*" "dest") + '("const-gchar*" "destpadname") + ) ) -(define-method set_flags - (of-object "GstAllocTrace") - (c-name "gst_alloc_trace_set_flags") - (return-type "none") +(define-method query_position + (of-object "GstElement") + (c-name "gst_element_query_position") + (return-type "gboolean") (parameters - '("GstAllocTraceFlags" "flags") + '("GstFormat*" "format") + '("gint64*" "cur") + '("gint64*" "end") ) ) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttrashstack.h - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttypefind.h - -(define-method peek - (of-object "GstTypeFind") - (c-name "gst_type_find_peek") - (return-type "guint8*") +(define-method query_convert + (of-object "GstElement") + (c-name "gst_element_query_convert") + (return-type "gboolean") (parameters - '("gint64" "offset") - '("guint" "size") + '("GstFormat" "src_format") + '("gint64" "src_val") + '("GstFormat*" "dest_fmt") + '("gint64*" "dest_val") ) ) -(define-method suggest - (of-object "GstTypeFind") - (c-name "gst_type_find_suggest") +(define-method install_std_props + (of-object "GstElementClass") + (c-name "gst_element_class_install_std_props") (return-type "none") (parameters - '("guint" "probability") - '("const-GstCaps*" "caps") + '("const-gchar*" "first_name") ) + (varargs #t) ) -(define-method get_length - (of-object "GstTypeFind") - (c-name "gst_type_find_get_length") - (return-type "guint64") -) - -(define-function type_find_register - (c-name "gst_type_find_register") +(define-method can_link + (of-object "GstPad") + (c-name "gst_pad_can_link") (return-type "gboolean") (parameters - '("GstPlugin*" "plugin") - '("const-gchar*" "name") - '("guint" "rank") - '("GstTypeFindFunction" "func") - '("gchar**" "extensions") - '("const-GstCaps*" "possible_caps") - '("gpointer" "data") + '("GstPad*" "sinkpad") ) ) -(define-function type_find_factory_get_type - (c-name "gst_type_find_factory_get_type") - (return-type "GType") -) - -(define-function type_find_factory_get_list - (c-name "gst_type_find_factory_get_list") - (return-type "GList*") +(define-method use_fixed_caps + (of-object "GstPad") + (c-name "gst_pad_use_fixed_caps") + (return-type "none") ) -(define-method get_extensions - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_get_extensions") - (return-type "gchar**") +(define-method get_fixed_caps_func + (of-object "GstPad") + (c-name "gst_pad_get_fixed_caps_func") + (return-type "GstCaps*") ) -(define-method get_caps - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_get_caps") - (return-type "const-GstCaps*") +(define-method proxy_getcaps + (of-object "GstPad") + (c-name "gst_pad_proxy_getcaps") + (return-type "GstCaps*") ) -(define-method call_function - (of-object "GstTypeFindFactory") - (c-name "gst_type_find_factory_call_function") - (return-type "none") +(define-method proxy_setcaps + (of-object "GstPad") + (c-name "gst_pad_proxy_setcaps") + (return-type "gboolean") (parameters - '("GstTypeFind*" "find") + '("GstCaps*" "caps") ) ) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gsttypes.h - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gsturi.h - -(define-function uri_protocol_is_valid - (c-name "gst_uri_protocol_is_valid") +(define-method query_position + (of-object "GstPad") + (c-name "gst_pad_query_position") (return-type "gboolean") (parameters - '("const-gchar*" "protocol") + '("GstFormat*" "format") + '("gint64*" "cur") + '("gint64*" "end") ) ) -(define-function uri_is_valid - (c-name "gst_uri_is_valid") +(define-method query_convert + (of-object "GstPad") + (c-name "gst_pad_query_convert") (return-type "gboolean") (parameters - '("const-gchar*" "uri") + '("GstFormat" "src_format") + '("gint64" "src_val") + '("GstFormat*" "dest_fmt") + '("gint64*" "dest_val") ) ) -(define-function uri_get_protocol - (c-name "gst_uri_get_protocol") - (return-type "gchar*") +(define-method add_many + (of-object "GstBin") + (c-name "gst_bin_add_many") + (return-type "none") (parameters - '("const-gchar*" "uri") + '("GstElement*" "element_1") ) + (varargs #t) ) -(define-function uri_get_location - (c-name "gst_uri_get_location") - (return-type "gchar*") +(define-method remove_many + (of-object "GstBin") + (c-name "gst_bin_remove_many") + (return-type "none") (parameters - '("const-gchar*" "uri") + '("GstElement*" "element_1") ) + (varargs #t) ) -(define-function uri_construct - (c-name "gst_uri_construct") - (return-type "gchar*") +(define-method merge + (of-object "GstBuffer") + (c-name "gst_buffer_merge") + (return-type "GstBuffer*") (parameters - '("const-gchar*" "protocol") - '("const-gchar*" "location") + '("GstBuffer*" "buf2") ) ) -(define-function element_make_from_uri - (c-name "gst_element_make_from_uri") - (return-type "GstElement*") +(define-method join + (of-object "GstBuffer") + (c-name "gst_buffer_join") + (return-type "GstBuffer*") (parameters - '("GstURIType" "type") - '("const-gchar*" "uri") - '("const-gchar*" "elementname") + '("GstBuffer*" "buf2") ) ) -(define-function uri_handler_get_type - (c-name "gst_uri_handler_get_type") - (return-type "GType") -) - -(define-method get_uri_type - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_uri_type") - (return-type "guint") -) - -(define-method get_protocols - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_protocols") - (return-type "gchar**") -) - -(define-method get_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_get_uri") - (return-type "const-gchar*") -) - -(define-method set_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_set_uri") - (return-type "gboolean") +(define-method stamp + (of-object "GstBuffer") + (c-name "gst_buffer_stamp") + (return-type "none") (parameters - '("const-gchar*" "uri") + '("const-GstBuffer*" "src") ) ) -(define-method new_uri - (of-object "GstURIHandler") - (c-name "gst_uri_handler_new_uri") +(define-function gst_atomic_int_set + (c-name "gst_atomic_int_set") (return-type "none") (parameters - '("const-gchar*" "uri") + '("gint*" "atomic_int") + '("gint" "value") ) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gsturitype.h - -(define-function uri_get_uri_type - (c-name "gst_uri_get_uri_type") - (return-type "GType") -) - - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstutils.h +;; From ../gstreamer/gst/gstvalue.h -(define-function util_set_value_from_string - (c-name "gst_util_set_value_from_string") +(define-function gst_value_register + (c-name "gst_value_register") (return-type "none") (parameters - '("GValue*" "value") - '("const-gchar*" "value_str") + '("const-GstValueTable*" "table") ) ) -(define-function util_set_object_arg - (c-name "gst_util_set_object_arg") +(define-function gst_value_init_and_copy + (c-name "gst_value_init_and_copy") (return-type "none") (parameters - '("GObject*" "object") - '("const-gchar*" "name") - '("const-gchar*" "value") + '("GValue*" "dest") + '("const-GValue*" "src") ) ) -(define-function util_dump_mem - (c-name "gst_util_dump_mem") - (return-type "none") +(define-function gst_value_serialize + (c-name "gst_value_serialize") + (return-type "gchar*") (parameters - '("guchar*" "mem") - '("guint" "size") + '("const-GValue*" "value") ) ) -(define-function print_pad_caps - (c-name "gst_print_pad_caps") - (return-type "none") +(define-function gst_value_deserialize + (c-name "gst_value_deserialize") + (return-type "gboolean") (parameters - '("GString*" "buf") - '("gint" "indent") - '("GstPad*" "pad") + '("GValue*" "dest") + '("const-gchar*" "src") ) ) -(define-function print_element_args - (c-name "gst_print_element_args") +(define-function gst_value_list_append_value + (c-name "gst_value_list_append_value") (return-type "none") (parameters - '("GString*" "buf") - '("gint" "indent") - '("GstElement*" "element") + '("GValue*" "value") + '("const-GValue*" "append_value") ) ) - - -;; From /opt/gnome/include/gstreamer-0.7/gst/gstvalue.h - -(define-function value_list_prepend_value +(define-function gst_value_list_prepend_value (c-name "gst_value_list_prepend_value") (return-type "none") (parameters @@ -5793,16 +5838,17 @@ ) ) -(define-function value_list_append_value - (c-name "gst_value_list_append_value") +(define-function gst_value_list_concat + (c-name "gst_value_list_concat") (return-type "none") (parameters - '("GValue*" "value") - '("const-GValue*" "append_value") + '("GValue*" "dest") + '("const-GValue*" "value1") + '("const-GValue*" "value2") ) ) -(define-function value_list_get_size +(define-function gst_value_list_get_size (c-name "gst_value_list_get_size") (return-type "guint") (parameters @@ -5810,7 +5856,7 @@ ) ) -(define-function value_list_get_value +(define-function gst_value_list_get_value (c-name "gst_value_list_get_value") (return-type "const-GValue*") (parameters @@ -5819,17 +5865,7 @@ ) ) -(define-function value_list_concat - (c-name "gst_value_list_concat") - (return-type "none") - (parameters - '("GValue*" "dest") - '("const-GValue*" "value1") - '("const-GValue*" "value2") - ) -) - -(define-function value_set_fourcc +(define-function gst_value_set_fourcc (c-name "gst_value_set_fourcc") (return-type "none") (parameters @@ -5838,7 +5874,7 @@ ) ) -(define-function value_get_fourcc +(define-function gst_value_get_fourcc (c-name "gst_value_get_fourcc") (return-type "guint32") (parameters @@ -5846,7 +5882,7 @@ ) ) -(define-function value_set_int_range +(define-function gst_value_set_int_range (c-name "gst_value_set_int_range") (return-type "none") (parameters @@ -5856,7 +5892,7 @@ ) ) -(define-function value_get_int_range_min +(define-function gst_value_get_int_range_min (c-name "gst_value_get_int_range_min") (return-type "int") (parameters @@ -5864,7 +5900,7 @@ ) ) -(define-function value_get_int_range_max +(define-function gst_value_get_int_range_max (c-name "gst_value_get_int_range_max") (return-type "int") (parameters @@ -5872,7 +5908,7 @@ ) ) -(define-function value_set_double_range +(define-function gst_value_set_double_range (c-name "gst_value_set_double_range") (return-type "none") (parameters @@ -5882,7 +5918,7 @@ ) ) -(define-function value_get_double_range_min +(define-function gst_value_get_double_range_min (c-name "gst_value_get_double_range_min") (return-type "double") (parameters @@ -5890,7 +5926,7 @@ ) ) -(define-function value_get_double_range_max +(define-function gst_value_get_double_range_max (c-name "gst_value_get_double_range_max") (return-type "double") (parameters @@ -5898,7 +5934,7 @@ ) ) -(define-function value_get_caps +(define-function gst_value_get_caps (c-name "gst_value_get_caps") (return-type "const-GstCaps*") (parameters @@ -5906,7 +5942,7 @@ ) ) -(define-function value_set_caps +(define-function gst_value_set_caps (c-name "gst_value_set_caps") (return-type "none") (parameters @@ -5915,16 +5951,43 @@ ) ) -(define-function value_can_compare - (c-name "gst_value_can_compare") +(define-function gst_value_set_fraction + (c-name "gst_value_set_fraction") + (return-type "none") + (parameters + '("GValue*" "value") + '("int" "numerator") + '("int" "denominator") + ) +) + +(define-function gst_value_get_fraction_numerator + (c-name "gst_value_get_fraction_numerator") + (return-type "int") + (parameters + '("const-GValue*" "value") + ) +) + +(define-function gst_value_get_fraction_denominator + (c-name "gst_value_get_fraction_denominator") + (return-type "int") + (parameters + '("const-GValue*" "value") + ) +) + +(define-function gst_value_fraction_multiply + (c-name "gst_value_fraction_multiply") (return-type "gboolean") (parameters - '("const-GValue*" "value1") - '("const-GValue*" "value2") + '("GValue*" "product") + '("const-GValue*" "factor1") + '("const-GValue*" "factor2") ) ) -(define-function value_compare +(define-function gst_value_compare (c-name "gst_value_compare") (return-type "int") (parameters @@ -5933,8 +5996,8 @@ ) ) -(define-function value_can_union - (c-name "gst_value_can_union") +(define-function gst_value_can_compare + (c-name "gst_value_can_compare") (return-type "gboolean") (parameters '("const-GValue*" "value1") @@ -5942,7 +6005,7 @@ ) ) -(define-function value_union +(define-function gst_value_union (c-name "gst_value_union") (return-type "gboolean") (parameters @@ -5952,7 +6015,16 @@ ) ) -(define-function value_register_union_func +(define-function gst_value_can_union + (c-name "gst_value_can_union") + (return-type "gboolean") + (parameters + '("const-GValue*" "value1") + '("const-GValue*" "value2") + ) +) + +(define-function gst_value_register_union_func (c-name "gst_value_register_union_func") (return-type "none") (parameters @@ -5962,26 +6034,26 @@ ) ) -(define-function value_can_intersect - (c-name "gst_value_can_intersect") +(define-function gst_value_intersect + (c-name "gst_value_intersect") (return-type "gboolean") (parameters + '("GValue*" "dest") '("const-GValue*" "value1") '("const-GValue*" "value2") ) ) -(define-function value_intersect - (c-name "gst_value_intersect") +(define-function gst_value_can_intersect + (c-name "gst_value_can_intersect") (return-type "gboolean") (parameters - '("GValue*" "dest") '("const-GValue*" "value1") '("const-GValue*" "value2") ) ) -(define-function value_register_intersect_func +(define-function gst_value_register_intersect_func (c-name "gst_value_register_intersect_func") (return-type "none") (parameters @@ -5991,50 +6063,56 @@ ) ) -(define-function value_register - (c-name "gst_value_register") - (return-type "none") +(define-function gst_value_subtract + (c-name "gst_value_subtract") + (return-type "gboolean") (parameters - '("const-GstValueTable*" "table") + '("GValue*" "dest") + '("const-GValue*" "minuend") + '("const-GValue*" "subtrahend") ) ) -(define-function value_init_and_copy - (c-name "gst_value_init_and_copy") - (return-type "none") +(define-function gst_value_can_subtract + (c-name "gst_value_can_subtract") + (return-type "gboolean") (parameters - '("GValue*" "dest") - '("const-GValue*" "src") + '("const-GValue*" "minuend") + '("const-GValue*" "subtrahend") ) ) -(define-function _gst_value_initialize - (c-name "_gst_value_initialize") +(define-function gst_value_register_subtract_func + (c-name "gst_value_register_subtract_func") (return-type "none") + (parameters + '("GType" "minuend_type") + '("GType" "subtrahend_type") + '("GstValueSubtractFunc" "func") + ) ) -(define-function value_serialize - (c-name "gst_value_serialize") - (return-type "gchar*") +(define-function gst_type_is_fixed + (c-name "gst_type_is_fixed") + (return-type "gboolean") (parameters - '("const-GValue*" "value") + '("GType" "type") ) ) -(define-function value_deserialize - (c-name "gst_value_deserialize") +(define-function gst_value_is_fixed + (c-name "gst_value_is_fixed") (return-type "gboolean") (parameters - '("GValue*" "dest") - '("const-gchar*" "src") + '("const-GValue*" "value") ) ) -;; From /opt/gnome/include/gstreamer-0.7/gst/gstversion.h +;; From ../gstreamer/gst/gstversion.h -(define-function version +(define-function gst_version (c-name "gst_version") (return-type "none") (parameters @@ -6046,14 +6124,14 @@ -;; From /opt/gnome/include/gstreamer-0.7/gst/gstxml.h +;; From ../gstreamer/gst/gstxml.h -(define-function xml_get_type +(define-function gst_xml_get_type (c-name "gst_xml_get_type") (return-type "GType") ) -(define-function xml_write +(define-function gst_xml_write (c-name "gst_xml_write") (return-type "xmlDocPtr") (parameters @@ -6061,7 +6139,7 @@ ) ) -(define-function xml_write_file +(define-function gst_xml_write_file (c-name "gst_xml_write_file") (return-type "gint") (parameters @@ -6070,9 +6148,9 @@ ) ) -(define-function xml_new +(define-function gst_xml_new (c-name "gst_xml_new") - (is-constructor-of "GstXML") + (is-constructor-of "GstXml") (return-type "GstXML*") ) @@ -6122,7 +6200,7 @@ (return-type "GList*") ) -(define-function xml_make_element +(define-function gst_xml_make_element (c-name "gst_xml_make_element") (return-type "GstElement*") (parameters @@ -6131,3 +6209,4 @@ ) ) + diff --git a/gst/gst.override b/gst/gst.override index 06e5288..7c7816f 100644 --- a/gst/gst.override +++ b/gst/gst.override @@ -22,6 +22,10 @@ */ %% headers +/* define this for all source files that don't run init_pygobject() + * before including pygobject.h */ +#define NO_IMPORT_PYGOBJECT + #ifdef HAVE_CONFIG_H # include #endif @@ -36,7 +40,13 @@ headers #include #include -extern gboolean pygst_data_from_pyobject (PyObject *object, GstData **data); +#include "pygstvalue.h" + +/* These headers have been included directly to get around multiple + * GetAttrString calls */ +#include +#include + PyObject *PyGstExc_LinkError = NULL; GSList *mainloops = NULL; @@ -65,16 +75,161 @@ _pygst_main(void) g_main_loop_run (loop); } +/* This function checks if a former Python code threw an exception and if + * so, transforms this exception into an error on the given GstElement. + * This allows code run on the element to just raise an exception instead of + * returning GStreamer specific return values. + * The exception is cleared afterwards. + */ +gboolean +_pygst_element_check_error (GstElement *element) +{ + PyObject *type, *value, *traceback, *lineno, *msg, *typemsg; + PyFrameObject *frame; + + if (!PyErr_Occurred()) + return FALSE; + + PyErr_Fetch (&type, &value, &traceback); + if (traceback) { + frame = (PyFrameObject *) PyObject_GetAttrString (traceback, "tb_frame"); + lineno = PyObject_GetAttrString (traceback, "tb_lineno"); + } else { + frame = NULL; + lineno = NULL; + } + msg = PyObject_Str (value); + typemsg = PyObject_Str (type); + if (msg && PyString_Check (msg)) { + gst_element_error_full (element, GST_LIBRARY_ERROR, + GST_LIBRARY_ERROR_FAILED, + g_strdup (PyString_AsString (msg)), + typemsg ? g_strconcat (PyString_AsString (typemsg), + ": ", PyString_AsString (msg), NULL) + : g_strdup (PyString_AsString (msg)), + frame ? PyString_AsString(frame->f_code->co_filename) : "???", + frame ? PyString_AsString(frame->f_code->co_name) : "???", + lineno ? PyInt_AsLong (lineno) : 0); + } else { + gst_element_error_full (element, GST_LIBRARY_ERROR, + GST_LIBRARY_ERROR_TOO_LAZY, + NULL, NULL, + frame ? PyString_AsString(frame->f_code->co_filename) : "???", + frame ? PyString_AsString(frame->f_code->co_name) : "???", + lineno ? PyInt_AsLong (lineno) : 0); + } + + PyErr_Clear (); + Py_XDECREF (frame); + Py_XDECREF (lineno); + Py_DECREF (msg); + Py_DECREF (typemsg); + + return TRUE; +} + +#ifdef pyg_register_class_init +PyTypeObject PyGstPadTemplate_Type; +static int +add_templates (gpointer gclass, PyObject *templates) +{ + gint i, len; + PyGObject *templ; + + if (pygobject_check(templates, &PyGstPadTemplate_Type)) { + gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (pygobject_get (templates))); + return 0; + } + + if (!PyTuple_Check(templates)) { + PyErr_SetString(PyExc_TypeError, "__gsttemplates__ attribute neither a tuple nor a GstPadTemplate!"); + return -1; + } + len = PyTuple_Size(templates); + if (len == 0) + return 0; + + for (i = 0; i < len; i++) { + templ = (PyGObject*) PyTuple_GetItem(templates, i); + if (!pygobject_check(templ, &PyGstPadTemplate_Type)) { + PyErr_SetString(PyExc_TypeError, "entries for __gsttemplates__ must be of type GstPadTemplate"); + return -1; + } + } + + for (i = 0; i < len; i++) { + templ = (PyGObject*) PyTuple_GetItem(templates, i); + gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (templ->obj)); + } + return 0; +} + +static int +_pygst_element_set_details (gpointer gclass, PyObject *details) +{ + GstElementDetails gstdetails = { 0, }; + + if (!PyTuple_Check (details)) { + PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be a tuple"); + return -1; + } + if (PyTuple_Size (details) != 4) { + PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be contain 4 elements"); + return -1; + } + if (!PyArg_ParseTuple (details, "ssss", &gstdetails.longname, &gstdetails.klass, + &gstdetails.description, &gstdetails.author)) { + PyErr_SetString (PyExc_TypeError, "__gstdetails__ must be contain 4 strings"); + return -1; + } + gst_element_class_set_details (gclass, &gstdetails); + return 0; +} + +static int +_pygst_element_init (gpointer gclass, PyTypeObject *pyclass) +{ + PyObject *templates, *details; + + templates = PyDict_GetItemString(pyclass->tp_dict, "__gsttemplates__"); + if (templates) { + if (add_templates(gclass, templates) != 0) + return -1; + } else { + PyErr_Clear(); + } + details = PyDict_GetItemString(pyclass->tp_dict, "__gstdetails__"); + if (details) { + if (_pygst_element_set_details (gclass, details) != 0) + return -1; + PyDict_DelItemString(pyclass->tp_dict, "__gstdetails__"); + } else { + PyErr_Clear(); + } + + return 0; +} +#endif + %% include gstbin.override gstbuffer.override gstcaps.override gstelement.override + gstevent.override gstpad.override gststructure.override %% init +{ +/* FIXME: new in pygtk-2.6 */ +#ifdef pyg_register_class_init + pyg_register_class_init (GST_TYPE_ELEMENT, _pygst_element_init); +#endif + if (!pygst_value_init()) + return; +} %% modulename gst %% @@ -126,7 +281,7 @@ tag_foreach_func_dict (const GstTagList *list, for (i = 0; i < count; i++) { gvalue = gst_tag_list_get_value_index(GST_TAG_LIST(list), tag, i); - value = pyg_value_as_pyobject(gvalue, TRUE); + value = pygst_value_as_pyobject(gvalue, TRUE); key = g_strdup (tag); PyDict_SetItemString(dict, key, value); g_free (key); @@ -184,7 +339,7 @@ _wrap_gst_tag_list_subscript(PyGObject *self, PyObject *py_key) } else if (count == 1) { const GValue *gvalue; gvalue = gst_tag_list_get_value_index(GST_TAG_LIST(self->obj), key, 0); - v = pyg_value_as_pyobject(gvalue, TRUE); + v = pygst_value_as_pyobject(gvalue, TRUE); } else { PyErr_SetString(PyExc_TypeError, "lists are currently unspported"); } @@ -235,7 +390,7 @@ _wrap_gst_tag_list_get(PyGObject *self, PyObject *args) PyErr_SetString(PyExc_KeyError, key); } else if (count == 1) { gvalue = gst_tag_list_get_value_index(GST_TAG_LIST(self->obj), key, 0); - val = pyg_value_as_pyobject(gvalue, TRUE); + val = pygst_value_as_pyobject(gvalue, TRUE); } else { PyErr_SetString(PyExc_TypeError, "lists are currently unspported"); } @@ -338,7 +493,73 @@ _wrap_gst_tag_list_get_value_index (PyGObject *self, tag, index); - return pyg_value_as_pyobject(gvalue, FALSE); + return pygst_value_as_pyobject(gvalue, FALSE); +} +%% +override-slot GstObject.tp_repr +static PyObject * +_wrap_gst_object_tp_repr(PyObject *self) +{ + gchar *repr; + PyObject *ret; + GstObject *object = GST_OBJECT (pygobject_get (self)); + + repr = g_strdup_printf ("<%s object (%s) at 0x%lx>", + self->ob_type->tp_name, + GST_OBJECT_NAME(object) ? GST_OBJECT_NAME(object) : "unnamed", + (long)self); + ret = PyString_FromString(repr); + g_free (repr); + return ret; +} +%% +override-slot GstObject.tp_str +static PyObject * +_wrap_gst_object_tp_str(PyObject *self) +{ + gchar *repr, *path; + PyObject *ret; + GstObject *object = GST_OBJECT (pygobject_get (self)); + + path = gst_object_get_path_string (object); + repr = g_strdup_printf ("%s (%s)", + path, self->ob_type->tp_name); + ret = PyString_FromString(repr); + g_free (repr); + g_free (path); + return ret; +} +%% +override-slot GstPluginFeature.tp_repr +static PyObject * +_wrap_gst_plugin_feature_tp_repr(PyObject *self) +{ + gchar *repr; + PyObject *ret; + GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self)); + + repr = g_strdup_printf ("<%s %s @ 0x%lx>", + self->ob_type->tp_name, gst_plugin_feature_get_name (feature), + (long) self); + ret = PyString_FromString(repr); + g_free (repr); + return ret; +} +%% +override-slot GstPluginFeature.tp_str +static PyObject * +_wrap_gst_plugin_feature_tp_str(PyObject *self) +{ + gchar *repr; + PyObject *ret; + GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self)); + + repr = g_strdup_printf ("<%s %s (%d)>", + self->ob_type->tp_name, gst_plugin_feature_get_name (feature), + gst_plugin_feature_get_rank (feature)); + ret = PyString_FromString(repr); + g_free (repr); + return ret; } %% override gst_type_find_factory_get_caps noargs @@ -627,6 +848,7 @@ probe_handler_marshal(GstProbe *probe, GstData **data, gpointer user_data) PyGILState_STATE state; PyObject *callback, *args; PyObject *ret; + PyObject *py_data; PyObject *py_user_data; gboolean res; gint len, i; @@ -637,10 +859,17 @@ probe_handler_marshal(GstProbe *probe, GstData **data, gpointer user_data) py_user_data = (PyObject *) user_data; + if (GST_IS_BUFFER(*data)) + py_data = pyg_boxed_new(GST_TYPE_BUFFER, *data, TRUE, TRUE); + else if (GST_IS_EVENT(*data)) + py_data = pyg_boxed_new(GST_TYPE_EVENT, *data, TRUE, TRUE); + else + py_data = pyg_boxed_new(GST_TYPE_DATA, *data, TRUE, TRUE); + callback = PyTuple_GetItem(py_user_data, 0); args = Py_BuildValue("(NN)", pyg_boxed_new(GST_TYPE_PROBE, probe, TRUE, TRUE), - pyg_boxed_new(GST_TYPE_DATA, *data, TRUE, TRUE)); + py_data); len = PyTuple_Size(py_user_data); for (i = 1; i < len; ++i) { @@ -657,6 +886,7 @@ probe_handler_marshal(GstProbe *probe, GstData **data, gpointer user_data) res = PyObject_IsTrue(ret); Py_DECREF(ret); } + Py_DECREF(args); pyg_gil_state_release(state); return res; @@ -765,3 +995,50 @@ _wrap_gst_plugin_get_version(PyGObject *self) g_strfreev(items); return tuple; } +%% +override gst_element_register kwargs + +static GstPlugin * +_pygst_get_plugin(void) +{ + PyObject *dict = NULL, *module = NULL, *pyplugin = NULL; + GstPlugin *ret; + + if (!(module = PyImport_ImportModule ("gst"))) + goto err; + if (!(dict = PyModule_GetDict (module))) + goto err; + if (!(pyplugin = PyDict_GetItemString (dict, "__plugin__"))) + goto err; + ret = pyg_boxed_get (pyplugin, GstPlugin); + + Py_DECREF (module); + return ret; + +err: + Py_XDECREF (module); + PyErr_Clear (); + return NULL; +} + +static PyObject * +_wrap_gst_element_register(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "type", "elementname", "rank", NULL }; + PyObject *py_type = NULL; + guint rank = GST_RANK_NONE; + char *elementname = NULL; + int ret; + GType type; + + /* FIXME: can we make the name optional, too? Anyone know a good default? */ + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|I:element_register", kwlist, + &py_type, &elementname, &rank)) + return NULL; + if ((type = pyg_type_from_object(py_type)) == 0) + return NULL; + + ret = gst_element_register(_pygst_get_plugin(), elementname, rank, type); + return PyBool_FromLong(ret); +} + diff --git a/gst/gstbuffer.override b/gst/gstbuffer.override index 32c6111..6656445 100644 --- a/gst/gstbuffer.override +++ b/gst/gstbuffer.override @@ -26,7 +26,6 @@ headers static int gst_buffer_getreadbuffer (PyGObject *self, int index, const void **ptr); -static int gst_buffer_length (PyGObject *self); static int gst_buffer_getwritebuf (PyGObject *self, int index, const void **ptr); @@ -42,7 +41,7 @@ _wrap_gst_buffer_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "data", "buffer_size", NULL }; char *data = NULL; - int size; + int size = 0; int buf_size = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z#i:GstBuffer.__init__", kwlist, @@ -53,10 +52,16 @@ _wrap_gst_buffer_new(PyGBoxed *self, PyObject *args, PyObject *kwargs) PyErr_SetString(PyExc_TypeError, "buffer size must be >= 0"); return -1; } + if (buf_size < 0) + buf_size = size; + if (buf_size < size) { + PyErr_SetString(PyExc_TypeError, "buffer size must be >= data size"); + return -1; + } self->gtype = GST_TYPE_BUFFER; - self->free_on_dealloc = FALSE; + self->free_on_dealloc = TRUE; - self->boxed = gst_buffer_new_and_alloc(buf_size > size ? buf_size : size); + self->boxed = gst_buffer_new_and_alloc(buf_size); if (!self->boxed) { PyErr_SetString(PyExc_RuntimeError, "could not create GstBuffer object"); @@ -77,7 +82,7 @@ static PyObject* _wrap_gst_buffer_get_data(PyObject *self) { GstBuffer *buf = pyg_boxed_get(self, GstBuffer); - return PyString_FromStringAndSize(GST_BUFFER_DATA(buf), + return PyString_FromStringAndSize((gchar *) GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf)); } %% @@ -103,7 +108,7 @@ _wrap_gst_buffer_set_data(PyObject *self, PyObject *args, PyObject *kwargs) return NULL; } GST_BUFFER_SIZE(buf) = PyString_Size(data); - GST_BUFFER_DATA(buf) = g_new0(char, GST_BUFFER_SIZE(buf)); + GST_BUFFER_DATA(buf) = (guint8 *) g_new0(char, GST_BUFFER_SIZE(buf)); memcpy(GST_BUFFER_DATA(buf), PyString_AsString(data), @@ -174,12 +179,33 @@ _wrap_gst_buffer__set_timestamp(PyGBoxed *self, PyObject *value, void *closure) return 0; } %% +override-attr GstBuffer.duration +static PyObject * +_wrap_gst_buffer__get_duration(PyGObject *self, void *closure) +{ + return PyInt_FromLong(GST_BUFFER(self->obj)->duration); +} +static int +_wrap_gst_buffer__set_duration(PyGBoxed *self, PyObject *value, void *closure) +{ + gint val; + + val = PyInt_AsLong(value); + if (PyErr_Occurred()) + return -1; + + pyg_boxed_get(self, GstBuffer)->duration = val; + return 0; +} +%% override-slot GstBuffer.tp_str static PyObject * _wrap_gst_buffer_tp_str(PyGObject *self) { - return PyString_FromStringAndSize(GST_BUFFER_DATA(self->obj), - GST_BUFFER_SIZE(self->obj)); + GstBuffer *buf = pyg_boxed_get(self, GstBuffer); + + return PyString_FromStringAndSize((const gchar*) GST_BUFFER_DATA(buf), + (gint) GST_BUFFER_SIZE(buf)); } %% override-slot GstBuffer.tp_as_buffer @@ -193,64 +219,164 @@ static PyBufferProcs _wrap_gst_buffer_tp_as_buffer = { static int gst_buffer_getreadbuffer(PyGObject *self, int index, const void **ptr) { + GstBuffer *buf = pyg_boxed_get(self, GstBuffer); + if ( index != 0 ) { PyErr_SetString(PyExc_SystemError, "accessing non-existent GstBuffer segment"); return -1; } - *ptr = GST_BUFFER_DATA(self->obj); - return GST_BUFFER_SIZE(self->obj); + *ptr = GST_BUFFER_DATA(buf); + return GST_BUFFER_SIZE(buf); } static int gst_buffer_getsegcount(PyGObject *self, int *lenp) { + GstBuffer *buf = pyg_boxed_get(self, GstBuffer); + if (lenp) - *lenp = GST_BUFFER_SIZE(self->obj); + *lenp = GST_BUFFER_SIZE(buf); return 1; } static int gst_buffer_getcharbuf(PyGObject *self, int index, const char **ptr) { + return gst_buffer_getreadbuffer (self, index, (const void **) ptr); +} + +static int +gst_buffer_getwritebuf(PyGObject *self, int index, const void **ptr) +{ + GstBuffer *buf = pyg_boxed_get(self, GstBuffer); + if ( index != 0 ) { PyErr_SetString(PyExc_SystemError, "accessing non-existent GstBuffer segment"); return -1; } - *ptr = GST_BUFFER_DATA(self->obj); - return GST_BUFFER_SIZE(self->obj); + if (!gst_buffer_is_writable (buf)) { + PyErr_SetString(PyExc_TypeError, + "buffer is not writable"); + return -1; + } + + *ptr = GST_BUFFER_DATA(buf); + return GST_BUFFER_SIZE(buf); } +%% +override-slot GstBuffer.tp_as_sequence +/* FIXME: should buffer parts be buffers or strings? */ + static int -gst_buffer_getwritebuf(PyGObject *self, int index, const void **ptr) +pygst_buffer_length(PyObject *self) { - PyErr_SetString(PyExc_TypeError, - "Cannot use GstBuffer as modifiable buffer"); - return -1; + return GST_BUFFER_SIZE(pygobject_get (self)); +} + +static PyObject * +pygst_buffer_slice(PyObject *self, int start, int end) +{ + GstBuffer *buf = GST_BUFFER (pygobject_get (self)); + if (start < 0) + start = 0; + if (end < 0) + end = 0; + if (end > GST_BUFFER_SIZE(buf)) + end = GST_BUFFER_SIZE(buf); + + if (end <= start) { + PyErr_SetString(PyExc_IndexError, "buffer index out of range"); + return NULL; + } + return PyString_FromStringAndSize((gchar *) GST_BUFFER_DATA (buf) + start, end - start); +} + +static PyObject * +pygst_buffer_item(PyObject *self, int index) +{ + return pygst_buffer_slice (self, index, index + 1); +} + +static int +pygst_buffer_ass_slice (PyObject *self, int start, int end, PyObject *val) +{ + GstBuffer *buf = GST_BUFFER (pygobject_get (self)); + const void *data; + int len; + + if (!gst_buffer_is_writable (buf)) { + PyErr_SetString(PyExc_TypeError, "buffer is not writable"); + return -1; + } + /* FIXME: policy? */ + if (start < 0 || end <= start || end > GST_BUFFER_SIZE (buf)) { + PyErr_SetString(PyExc_IndexError, "buffer index out of range"); + return -1; + } + end -= start; + if (PyObject_AsReadBuffer(val, &data, &len)) + return -1; + if (len > end) + len = end; + memcpy (GST_BUFFER_DATA (buf) + start, data, len); + return 0; +} + +static int +pygst_buffer_ass_item (PyObject *self, int index, PyObject *val) +{ + GstBuffer *buf = GST_BUFFER (pygobject_get (self)); + const void *data; + int len; + + if (!gst_buffer_is_writable (buf)) { + PyErr_SetString(PyExc_TypeError, "buffer is not writable"); + return -1; + } + if (index < 0 || index > GST_BUFFER_SIZE (buf)) { + PyErr_SetString(PyExc_IndexError, "buffer index out of range"); + return -1; + } + if (PyObject_AsReadBuffer(val, &data, &len)) + return -1; + /* FIXME: how do we handle this? */ + if (len > GST_BUFFER_SIZE (buf) - index) + len = GST_BUFFER_SIZE (buf) - index; + memcpy (GST_BUFFER_DATA (buf) + index, data, len); + return 0; } -%% -override-slot GstBuffer.tp_as_sequence static PySequenceMethods _wrap_gst_buffer_tp_as_sequence = { - (inquiry)gst_buffer_length, /* sq_length */ + pygst_buffer_length, /* sq_length */ NULL, /* sq_concat */ NULL, /* sq_repeat */ - NULL, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* sq_ass_slice */ + pygst_buffer_item, /* sq_item */ + pygst_buffer_slice, /* sq_slice */ + pygst_buffer_ass_item, /* sq_ass_item */ + pygst_buffer_ass_slice, /* sq_ass_slice */ NULL, /* sq_contains */ NULL, /* sq_inplace_concat */ NULL, /* sq_inplace_repeat */ }; - -static int -gst_buffer_length(PyGObject *self) +%% +define GstBuffer.copy_on_write +static PyObject * +_wrap_gst_buffer_copy_on_write (PyObject *self) { - return GST_BUFFER_SIZE(self->obj); + GstBuffer *buf = pyg_boxed_get(self, GstBuffer); + + if (gst_buffer_is_writable (buf)) { + Py_INCREF (self); + return self; + } + buf = gst_buffer_copy (buf); + self = pyg_boxed_new (GST_TYPE_BUFFER, buf, FALSE, TRUE); + return self; } /* %% diff --git a/gst/gstcaps.override b/gst/gstcaps.override index 439d56d..33455cb 100644 --- a/gst/gstcaps.override +++ b/gst/gstcaps.override @@ -1,6 +1,7 @@ /* -*- Mode: C; c-basic-offset: 4 -*- */ /* gst-python * Copyright (C) 2005 Johan Dahlin + * 2005 Benjamin Otte * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,13 +19,78 @@ * Boston, MA 02111-1307, USA. * * Author: Johan Dahlin + * Benjamin Otte */ %% +headers +/* This is a (hopefully) smart hack to allow access to a caps' + * structures without falling into traps when the caps get destroyed + * before the structures get. + * This Hash Table uses the structure PyObjects as keys and the caps + * PyObjects as values. No clue if this is a fast data structure but it + * probably doesn't matter anyway. + */ +static GHashTable *structure_caps_map = NULL; + +static void +pygst_caps_map_add (PyObject *structure, PyObject *caps) +{ + /* we can't have free_on_dealloc stuff in here */ + g_assert (((PyGBoxed *)structure)->free_on_dealloc == FALSE); + g_hash_table_insert (structure_caps_map, structure, caps); +} + +static void +pygst_caps_map_remove_structure (PyObject *structure) +{ + g_hash_table_remove (structure_caps_map, structure); +} + +static gboolean +pygst_caps_map_foreach (gpointer structure, gpointer caps, gpointer match) +{ + PyGBoxed *boxed = structure; + + if (match != caps) + return FALSE; + + /* we can't have free_on_dealloc stuff in here */ + g_assert (boxed->free_on_dealloc == FALSE); + boxed->boxed = gst_structure_copy (boxed->boxed); + boxed->free_on_dealloc = TRUE; + return TRUE; +} + +static void +pygst_caps_map_modified (PyObject *caps) +{ + g_hash_table_foreach_remove (structure_caps_map, pygst_caps_map_foreach, caps); +} + +%% +init + structure_caps_map = g_hash_table_new (g_direct_hash, g_direct_equal); +%% ignore gst_caps_new_simple gst_caps_new_full gst_caps_set_simple %% +override gst_caps_get_structure kwargs +static PyObject *pygst_caps_sq_item(PyObject *self, int i); +static PyObject * +_wrap_gst_caps_get_structure(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "index", NULL }; + int index; + + if (PyErr_Warn(PyExc_DeprecationWarning, "caps.get_structure(i) is deprecated, use caps[i]") < 0) + return NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GstCaps.get_structure", kwlist, &index)) + return NULL; + return pygst_caps_sq_item (self, index); +} +%% override gst_caps_new_empty kwargs static int _wrap_gst_caps_new_empty(PyGBoxed *self, PyObject *args, PyObject *kwargs) @@ -40,89 +106,325 @@ _wrap_gst_caps_new_empty(PyGBoxed *self, PyObject *args, PyObject *kwargs) if (len == 0) { /* 0 length creates a new empty caps */ self->boxed = gst_caps_new_empty(); - goto beach; } else if (len == 1) { - /* 1 length is either a string or a structure */ item = PyTuple_GetItem(args, 0); - if (PyString_Check(item)) { - self->boxed = gst_caps_from_string(PyString_AsString(item)); - goto beach; - } else if (!pyg_boxed_check(item, GST_TYPE_STRUCTURE)) { - PyErr_SetString(PyExc_TypeError, "argument must be a string or a GstStructure"); - return -1; - } - } - /* it's either one GstStructure or several whatevers */ - self->boxed = gst_caps_new_empty(); - for (i = 0; i < len; i++) - { - item = PyTuple_GetItem(args, i); - if (!pyg_boxed_check(item, GST_TYPE_STRUCTURE)) - { - PyErr_SetString(PyExc_TypeError, "argument must be a GstStructure"); - gst_caps_free(self->boxed); - return -1; + /* 1 length is either a string or a structure */ + self->boxed = pygst_caps_from_pyobject (item, NULL); + } else { + /* it's multiple arguments that can all be made to caps */ + GstCaps *append; + self->boxed = gst_caps_new_empty(); + for (i = 0; i < len; i++) + { + item = PyTuple_GetItem(args, i); + append = pygst_caps_from_pyobject (item, NULL); + if (!append) { + gst_caps_free (self->boxed); + self->boxed = NULL; + break; + } + gst_caps_append (self->boxed, append); } - gst_caps_append_structure(self->boxed, pyg_boxed_get(item, GstStructure)); } - -beach: if (!self->boxed) { - PyErr_SetString(PyExc_RuntimeError, "could not create GstCaps object"); + PyErr_SetString(PyExc_TypeError, "wrong arguemntes when creating GstCaps object"); return -1; } return 0; } + %% -override gst_caps_get_structure kwargs +override-slot GstCaps.tp_richcompare + +static gboolean +pygst_caps_is_true_subset (GstCaps *caps1, GstCaps *caps2) +{ + GstCaps *tmp; + gboolean ret; + + /* order is important here */ + if (gst_caps_is_any (caps1)) + return FALSE; + if (gst_caps_is_any (caps2)) + return TRUE; + if (gst_caps_is_empty (caps2)) + return FALSE; + if (gst_caps_is_empty (caps1)) + return TRUE; + + tmp = gst_caps_subtract (caps1, caps2); + ret = gst_caps_is_empty (tmp); + gst_caps_free (tmp); + if (!ret) + return FALSE; + tmp = gst_caps_subtract (caps2, caps1); + ret = gst_caps_is_empty (tmp); + gst_caps_free (tmp); + return !ret; +} + static PyObject * -_wrap_gst_caps_get_structure(PyObject *self, PyObject *args, PyObject *kwargs) +_wrap_gst_caps_tp_richcompare (PyObject *py_caps1, PyObject *py_caps2, int comparison) { - static char *kwlist[] = { "index", NULL }; - int index; - GstStructure *ret; + GstCaps *caps1, *caps2; + gboolean caps2_is_copy; + PyObject *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GstCaps.get_structure", kwlist, &index)) + caps1 = pyg_boxed_get (py_caps1, GstCaps); + caps2 = pygst_caps_from_pyobject (py_caps2, &caps2_is_copy); + if (PyErr_Occurred()) { + /* the second arg is not a caps */ + switch (comparison) { + case Py_EQ: + PyErr_Clear(); + ret = Py_False; + Py_INCREF (ret); + return ret; + case Py_NE: + PyErr_Clear(); + ret = Py_True; + Py_INCREF (ret); + return ret; + default: return NULL; - ret = gst_caps_get_structure(pyg_boxed_get(self, GstCaps), index); - - /* pyg_boxed_new handles NULL checking */ - return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, FALSE, FALSE); + } + } + + switch (comparison) { + case Py_LT: + ret = pygst_caps_is_true_subset (caps1, caps2) ? Py_True : Py_False; + break; + case Py_LE: + ret = gst_caps_is_subset (caps1, caps2) ? Py_True : Py_False; + break; + case Py_NE: + ret = gst_caps_is_equal (caps1, caps2) ? Py_False : Py_True; + break; + case Py_EQ: + ret = gst_caps_is_equal (caps1, caps2) ? Py_True : Py_False; + break; + case Py_GE: + ret = gst_caps_is_subset (caps2, caps1) ? Py_True : Py_False; + break; + case Py_GT: + ret = pygst_caps_is_true_subset (caps2, caps1) ? Py_True : Py_False; + break; + default: + PyErr_SetString (PyExc_RuntimeError, "invalid comparison operation"); + if (caps2 && caps2_is_copy) + gst_caps_free (caps2); + return NULL; + } + if (caps2 && caps2_is_copy) + gst_caps_free (caps2); + + Py_INCREF (ret); + return ret; +} + +%% +override-slot GstCaps.tp_as_number + +/* In this number code, we mimic the Python set.Set datatype. + * The same operations are supported. If you want to have an operation + * supported for caps, add it to Python's Set type first. + */ +#define BINARY_FUNC(name,func) \ +static PyObject * \ +name (PyObject *py_caps1, PyObject *py_caps2) \ +{ \ + GstCaps *caps1, *caps2, *ret; \ + gboolean caps2_is_copy; \ +\ + caps1 = pyg_boxed_get (py_caps1, GstCaps); \ + caps2 = pygst_caps_from_pyobject (py_caps2, &caps2_is_copy); \ + if (PyErr_Occurred()) \ + return NULL; \ + ret = func (caps1, caps2); \ + if (caps2 && caps2_is_copy) \ + gst_caps_free (caps2); \ + return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE); \ +} + +BINARY_FUNC (pygst_caps_nb_subtract, gst_caps_subtract) +BINARY_FUNC (pygst_caps_nb_and, gst_caps_intersect) +BINARY_FUNC (pygst_caps_nb_or, gst_caps_union) +static GstCaps * +pygst_caps_xor (const GstCaps *caps1, const GstCaps *caps2) +{ + GstCaps *intersect, *_union, *ret; + intersect = gst_caps_intersect (caps1, caps2); + _union = gst_caps_union (caps1, caps2); + ret = gst_caps_subtract (_union, intersect); + gst_caps_free (_union); + gst_caps_free (intersect); + gst_caps_do_simplify (ret); + return ret; +} +BINARY_FUNC (pygst_caps_nb_xor, pygst_caps_xor) + +static int +pygst_caps_nb_nonzero (PyObject *py_caps) +{ + GstCaps *caps = pyg_boxed_get (py_caps, GstCaps); + + if (gst_caps_is_empty (caps)) + return 0; + else + return 1; +} + +static int +pygst_caps_nb_coerce (PyObject **py_caps1, PyObject **py_caps2) +{ + GstCaps *caps1, *caps2 = NULL; + gboolean caps1_is_copy, caps2_is_copy; + + caps1 = pygst_caps_from_pyobject (*py_caps1, &caps1_is_copy); + if (!caps1) + goto error; + caps2 = pygst_caps_from_pyobject (*py_caps2, &caps2_is_copy); + if (!caps2) + goto error; + /* if they're not copies, they're caps already */ + if (caps1_is_copy) + *py_caps1 = pyg_boxed_new (GST_TYPE_CAPS, caps1, FALSE, TRUE); + else + Py_INCREF (*py_caps1); + if (caps2_is_copy) + *py_caps2 = pyg_boxed_new (GST_TYPE_CAPS, caps2, FALSE, TRUE); + else + Py_INCREF (*py_caps2); + return 0; + +error: + g_assert (PyErr_Occurred ()); + PyErr_Clear (); + if (caps1 && !caps1_is_copy) + gst_caps_free (caps1); + if (caps2 && !caps2_is_copy) + gst_caps_free (caps2); + return 1; } + +static PyNumberMethods _wrap_gst_caps_tp_as_number = { + 0, /* nb_add */ + pygst_caps_nb_subtract, /* nb_subtract */ + 0, /* nb_multiply */ + 0, /* nb_divide */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + pygst_caps_nb_nonzero, /* nb_nonzero */ + 0, /* nb_invert */ + 0, /* nb_lshift */ + 0, /* nb_rshift */ + pygst_caps_nb_and, /* nb_and */ + pygst_caps_nb_xor, /* nb_xor */ + pygst_caps_nb_or, /* nb_or */ + pygst_caps_nb_coerce, /* nb_coerce */ + 0, /* nb_int */ + 0, /* nb_long */ + 0, /* nb_float */ + 0, /* nb_oct */ + 0, /* nb_hex */ + 0, /* nb_inplace_add */ + 0, /* nb_inplace_subtract */ + 0, /* nb_inplace_multiply */ + 0, /* nb_inplace_divide */ + 0, /* nb_inplace_remainder */ + 0, /* nb_inplace_power */ + 0, /* nb_inplace_lshift */ + 0, /* nb_inplace_rshift */ + 0, /* nb_inplace_and */ + 0, /* nb_inplace_xor */ + 0, /* nb_inplace_or */ + 0, /* nb_floor_divide */ + 0, /* nb_true_divide */ + 0, /* nb_inplace_floor_divide */ + 0, /* nb_inplace_true_divide */ +}; %% override-slot GstCaps.tp_as_sequence static int -caps_length(PyGObject *self) +pygst_caps_sq_length(PyObject *self) { - return gst_caps_get_size((GstCaps*)self->obj); + GstCaps *caps = pyg_boxed_get (self, GstCaps); + return gst_caps_get_size(caps); } static PyObject * -caps_item(PyGObject *self, int i) - +pygst_caps_sq_item(PyObject *self, int i) { + GstCaps *caps = pyg_boxed_get (self, GstCaps); GstStructure *structure; + PyObject *ret; - if (i < 0 || i >= gst_caps_get_size((GstCaps*)self->obj)) { + if (i < 0 || i >= gst_caps_get_size(caps)) { PyErr_SetString(PyExc_IndexError, "list index out of range"); return NULL; } - structure = gst_caps_get_structure((GstCaps*)self->obj, i); - return pyg_boxed_new(GST_TYPE_STRUCTURE, structure, TRUE, TRUE); + structure = gst_caps_get_structure(caps, i); + + /* pyg_boxed_new handles NULL checking */ + ret = pyg_boxed_new(GST_TYPE_STRUCTURE, + gst_caps_get_structure(pyg_boxed_get(self, GstCaps), i), + FALSE, FALSE); + if (ret) + pygst_caps_map_add (ret, self); + return ret; +} + +/* FIXME: This syntax sucks */ +static PyObject * +pygst_caps_sq_slice(PyObject *self, int start, int end) +{ + GstCaps *caps = pyg_boxed_get (self, GstCaps); + GstCaps *ret = gst_caps_new_empty (); + int i; + + if (start < 0) + start = 0; + if (end > gst_caps_get_size (caps)) + end = gst_caps_get_size (caps); + + for (i = start; i < end; i++) + gst_caps_append_structure (ret, gst_structure_copy (gst_caps_get_structure (caps, i))); + + return pyg_boxed_new(GST_TYPE_CAPS, ret, FALSE, TRUE); } static PySequenceMethods _wrap_gst_caps_tp_as_sequence = { - (inquiry)caps_length, /* mp_length */ - NULL, - NULL, - (intargfunc)caps_item, - NULL, - NULL, - NULL, - NULL, + pygst_caps_sq_length, + NULL, /* not allowed for sets, use | instead of + */ + NULL, /* doesn't make sense, because it'd still be the same */ + pygst_caps_sq_item, + pygst_caps_sq_slice, + NULL, /* doesn't make sense, you can only append */ + NULL, /* doesn't make sense, you can only append */ + NULL, /* doesn't make sense really, unless you use is_subset */ + NULL, /* not allowed for sets, use | instead of + */ + NULL /* doesn't make sense, because it'd still be the same */ }; %% +override-slot GstCaps.tp_dealloc +static void +_wrap_gst_caps_tp_dealloc (PyObject *self) +{ + PyGBoxed *boxed = (PyGBoxed *) self; + + if (boxed->free_on_dealloc && boxed->boxed) { + pygst_caps_map_modified (self); + gst_caps_free (boxed->boxed); + } + + self->ob_type->tp_free((PyObject *)self); +} +%% override-slot GstCaps.tp_str static PyObject * _wrap_gst_caps_tp_str(PyGObject *self) diff --git a/gst/gstelement.override b/gst/gstelement.override index d473226..85ad9a8 100644 --- a/gst/gstelement.override +++ b/gst/gstelement.override @@ -188,14 +188,23 @@ override gst_element_link kwargs static PyObject * _wrap_gst_element_link(PyGObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "dest", NULL }; + static char *kwlist[] = { "dest", "filtercaps", NULL }; PyGObject *dest; + PyObject *py_caps = NULL; int ret; + GstCaps *caps = NULL; + gboolean caps_is_copy; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GstElement.link", - kwlist, &PyGstElement_Type, &dest)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!|O:GstElement.link", + kwlist, &PyGstElement_Type, &dest, &py_caps)) return NULL; - ret = gst_element_link(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj)); + if (py_caps == NULL) + caps = NULL; + else + caps = pygst_caps_from_pyobject (py_caps, &caps_is_copy); + ret = gst_element_link_filtered(GST_ELEMENT(self->obj), GST_ELEMENT(dest->obj), caps); + if (caps && caps_is_copy) + gst_caps_free (caps); if (!ret) { PyErr_Format(PyGstExc_LinkError, "failed to link %s with %s", @@ -212,52 +221,47 @@ static PyObject * _wrap_gst_element_link_filtered(PyGObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "dest", "filtercaps", NULL }; - PyGObject *dest; - PyObject *py_filtercaps; - int ret; - GstCaps *filtercaps = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O!O:GstElement.link_filtered", - kwlist, &PyGstElement_Type, - &dest, &py_filtercaps)) - return NULL; - if (pyg_boxed_check(py_filtercaps, GST_TYPE_CAPS)) - filtercaps = pyg_boxed_get(py_filtercaps, GstCaps); - else { - PyErr_SetString(PyExc_TypeError, "filtercaps should be a GstCaps"); - return NULL; - } - ret = gst_element_link_filtered(GST_ELEMENT(self->obj), - GST_ELEMENT(dest->obj), - filtercaps); - if (!ret) { - PyErr_Format(PyGstExc_LinkError, - "failed to link %s with %s", - GST_ELEMENT_NAME(self->obj), - GST_ELEMENT_NAME(dest->obj)); - return NULL; - } - return PyBool_FromLong(ret); - + if (PyErr_Warn(PyExc_DeprecationWarning, "element.link_filtered is deprecated, use element.link") < 0) + return NULL; + return _wrap_gst_element_link (self, args, kwargs); } %% override gst_element_link_pads kwargs +static gboolean +pad_name_from_object (PyObject *object, const gchar **name) +{ + if (object == Py_None) { + *name = NULL; + return TRUE; + } else if (PyString_Check (object)) { + *name = PyString_AsString (object); + return TRUE; + } else if (pygobject_check (object, &PyGstPad_Type)) { + *name = gst_object_get_name (GST_OBJECT (pygobject_get (object))); + return TRUE; + } + PyErr_SetString(PyExc_TypeError, "argument could not be converted to a pad"); + return FALSE; +} + static PyObject * _wrap_gst_element_link_pads(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "srcpadname", "dest", "destpadname", NULL }; - char *srcpadname, *destpadname; + const char *srcpadname, *destpadname; PyGObject *dest; + PyObject *srcpad, *destpad; int ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "sO!s:GstElement.link_pads", kwlist, - &srcpadname, &PyGstElement_Type, &dest, - &destpadname)) + "OO!O:GstElement.link_pads", kwlist, + &srcpad, &PyGstElement_Type, &dest, + &destpad)) return NULL; + if (!pad_name_from_object (srcpad, &srcpadname) || + !pad_name_from_object (destpad, &destpadname)) + return NULL; ret = gst_element_link_pads(GST_ELEMENT(self->obj), srcpadname, GST_ELEMENT(dest->obj), destpadname); if (!ret) { @@ -374,3 +378,19 @@ _wrap_gst_element_send_event(PyGObject *self, PyObject *args, PyObject *kwargs) return PyBool_FromLong(ret); } +%% +override gst_element_factory_get_pad_templates +static PyObject * +_wrap_gst_element_factory_get_pad_templates(PyGObject *self) +{ + const GList *pads; + PyObject *list; + + pads = gst_element_factory_get_pad_templates(GST_ELEMENT_FACTORY(self->obj)); + + list = PyList_New(0); + for (; pads; pads = g_list_next (pads)) + PyList_Append(list, pygobject_new(pads->data)); + + return list; +} diff --git a/gst/gstevent.override b/gst/gstevent.override new file mode 100644 index 0000000..2797487 --- /dev/null +++ b/gst/gstevent.override @@ -0,0 +1,49 @@ +/* -*- Mode: C; ; c-file-style: "python" -*- */ +/* gst-python + * Copyright (C) 2005 Edward Hervey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Johan Dahlin + */ +%% +override-attr GstEvent.data_type +static PyObject* +_wrap_gst_event__get_data_type(PyGObject *self, void *closure) +{ + return pyg_type_wrapper_new(GST_DATA_TYPE(GST_DATA(self->obj))); +} +%% +override-attr GstEvent.flags +static PyObject* +_wrap_gst_event__get_flags(PyGObject *self, void *closure) +{ + return PyInt_FromLong(GST_DATA_FLAGS(self->obj)); +} +%% +override-attr GstEvent.type +static PyObject* +_wrap_gst_event__get_type(PyGObject *self, void *closure) +{ + return pyg_enum_from_gtype(GST_TYPE_EVENT_TYPE, GST_EVENT_TYPE(GST_EVENT(self->obj))); +} +%% +override-attr GstEvent.timestamp +static PyObject * +_wrap_gst_event__get_timestamp(PyGObject *self, void *closure) +{ + return PyInt_FromLong(GST_EVENT(self->obj)->timestamp); +} diff --git a/gst/gstmodule.c b/gst/gstmodule.c index a2a1d21..fd5250e 100644 --- a/gst/gstmodule.c +++ b/gst/gstmodule.c @@ -33,6 +33,7 @@ void pygst_register_classes (PyObject *d); void pygst_add_constants(PyObject *module, const gchar *strip_prefix); +void _pygst_register_boxed_types(PyObject *moddict); extern PyMethodDef pygst_functions[]; extern GSList *mainloops; @@ -114,6 +115,7 @@ init_gst (void) g_free (argv); } + _pygst_register_boxed_types (NULL); pygobject_register_sinkfunc(GST_TYPE_OBJECT, sink_gstobject); m = Py_InitModule ("_gst", pygst_functions); diff --git a/gst/gstpad.override b/gst/gstpad.override index c1f8c47..07076e6 100644 --- a/gst/gstpad.override +++ b/gst/gstpad.override @@ -22,66 +22,169 @@ %% headers -static PyGstPadPrivate* -pad_private(GstPad *pad) +/* we need to do this until PyClosures get exception handlers */ +#ifndef pyg_closure_set_exception_handler +# define pyg_closure_set_exception_handler(ig, nore) +# define EXCEPTION_HANDLER G_GNUC_UNUSED +#else +# define EXCEPTION_HANDLER +#endif +#define SET_PAD_CLOSURE(self, args, kwargs, name) \ + static char *kwlist[] = { G_STRINGIFY (name), NULL }; \ + PyObject *function; \ + GstPad *pad; \ + GClosure *closure; \ + PyGstPadPrivate *priv; \ +\ + if (!PyArg_ParseTupleAndKeywords(args, kwargs, \ + "O:GstPad.set_" G_STRINGIFY (name), \ + kwlist, \ + &function)) { \ + return NULL; \ + } \ +\ + if (!PyCallable_Check(function)) { \ + PyErr_SetString(PyExc_TypeError, G_STRINGIFY (name) " not callable"); \ + return NULL; \ + } \ +\ + closure = pyg_closure_new (function, NULL, NULL); \ + pyg_closure_set_exception_handler (closure, handle_ ## name ## _exception); \ + pygobject_watch_closure((PyObject *)self, closure); \ + priv = py_pad_private(self);\ + if (priv->name) { \ + g_closure_invalidate (priv->name); \ + g_closure_unref (priv->name); \ + } \ + priv->name = closure; \ + pad = (GstPad*)pygobject_get(self); \ + gst_pad_set_ ## name (pad, call_ ## name); \ +\ + Py_INCREF(Py_None); \ + return Py_None; + +static void +free_pad_private (gpointer data) { - return (PyGstPadPrivate*)gst_pad_get_element_private(pad); + PyGstPadPrivate *private = data; +#define INVALIDATE_CLOSURE(closure) \ + if (closure) { \ + g_closure_invalidate (closure); \ + g_closure_unref (closure); \ + closure = NULL; \ + } + INVALIDATE_CLOSURE (private->link_function) + INVALIDATE_CLOSURE (private->event_function) + INVALIDATE_CLOSURE (private->chain_function) + INVALIDATE_CLOSURE (private->get_function) + INVALIDATE_CLOSURE (private->getcaps_function) +#undef INVALIDATE_CLOSURE } - + static PyGstPadPrivate* -py_pad_private(PyGObject *pad) +pad_private(GstPad *pad) { PyGstPadPrivate *private; - GstPad *gpad; + static GQuark padprivate = 0; - gpad = (GstPad*)pygobject_get(pad); - private = (PyGstPadPrivate*)gst_pad_get_element_private(gpad); + if (!padprivate) + padprivate = g_quark_from_static_string ("PyGst::PadPrivate"); + private = g_object_get_qdata (G_OBJECT (pad), padprivate); 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); + private->pad = (PyGObject *) pygobject_new (G_OBJECT (pad)); + Py_DECREF (private->pad); + g_object_set_qdata_full (G_OBJECT (pad), padprivate, private, free_pad_private); } return private; } + +static PyGstPadPrivate* +py_pad_private(PyGObject *pad) +{ + return pad_private ((GstPad *)pygobject_get(pad)); +} %% ignore gst_pad_select gst_pad_selectv + gst_pad_new_from_template gst_pad_load_and_link %% -override gst_pad_set_link_function kwargs +override gst_pad_set_getcaps_function kwargs -static GstPadLinkReturn -call_link_function (GstPad *pad, GstCaps *caps) +static void EXCEPTION_HANDLER +handle_getcaps_function_exception (GValue *ret, guint n, const GValue *params) { - PyObject *function; - PyObject *retval; - GstPadLinkReturn ret; - PyGILState_STATE state; + g_value_set_boxed (ret, gst_pad_get_pad_template_caps ( + GST_PAD (g_value_get_object (¶ms[0])))); + PyErr_Clear (); +} + +static GstCaps * +call_getcaps_function (GstPad *pad) +{ + GClosure *closure; + GValue ret = { 0, }; + GValue args = { 0, }; + GstCaps *caps; + + g_value_init (&ret, GST_TYPE_CAPS); + g_value_init (&args, GST_TYPE_REAL_PAD); + g_value_set_object (&args, pad); - function = pad_private(pad)->link_function; + closure = pad_private(pad)->getcaps_function; - state = pyg_gil_state_ensure(); + g_closure_invoke (closure, &ret, 1, &args, NULL); - retval = (PyObject*)PyObject_CallFunction (function, - "OO", - pad_private(pad)->pad, - pyg_boxed_new(GST_TYPE_CAPS, caps, TRUE, TRUE)); + caps = g_value_dup_boxed (&ret); + g_value_unset (&ret); + g_value_unset (&args); + return caps; +} - if (PyErr_Occurred ()) { - PyErr_Print (); - pyg_gil_state_release(state); - return GST_PAD_LINK_REFUSED; - } +static PyObject* +_wrap_gst_pad_set_getcaps_function (PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + SET_PAD_CLOSURE (self, args, kwargs, getcaps_function) +} - ret = PyInt_AsLong(retval); +%% +override gst_pad_set_link_function kwargs + +static void EXCEPTION_HANDLER +handle_link_function_exception (GValue *ret, guint n, const GValue *params) +{ + g_value_set_enum (ret, GST_PAD_LINK_REFUSED); + PyErr_Clear (); +} - pyg_gil_state_release(state); +static GstPadLinkReturn +call_link_function (GstPad *pad, const GstCaps *caps) +{ + GClosure *closure; + GValue ret = { 0, }; + GValue args[2] = { { 0, }, {0, } }; + GstPadLinkReturn i; + + g_value_init (&ret, GST_TYPE_PAD_LINK_RETURN); + g_value_init (&args[0], GST_TYPE_REAL_PAD); + g_value_init (&args[1], GST_TYPE_CAPS); + g_value_set_object (&args[0], pad); + g_value_set_boxed (&args[1], caps); + + closure = pad_private(pad)->link_function; + + g_closure_invoke (closure, &ret, 2, args, NULL); - return ret; + i = g_value_get_enum (&ret); + g_value_unset (&ret); + g_value_unset (&args[0]); + g_value_unset (&args[1]); + return i; } static PyObject* @@ -89,55 +192,43 @@ _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, (GstPadLinkFunction)call_link_function); - - Py_INCREF(Py_None); - return Py_None; + SET_PAD_CLOSURE (self, args, kwargs, link_function) } + %% override gst_pad_set_chain_function kwargs -static void -call_chain_function(GstPad *pad, GstBuffer *buf) +static void EXCEPTION_HANDLER +handle_chain_function_exception (GValue *ret, guint n, const GValue *params) { - PyObject *function; - PyGILState_STATE state; - - function = pad_private(pad)->chain_function; - - state = pyg_gil_state_ensure(); - - PyObject_CallFunction (function, - "OO", - pad_private(pad)->pad, - pyg_boxed_new(GST_TYPE_BUFFER, buf, TRUE, TRUE)); + GstElement *element = gst_pad_get_parent (g_value_get_object (¶ms[0])); + + if (!_pygst_element_check_error (element)) + g_assert_not_reached (); /* only returns FALSE when there's no error */ +} - if (PyErr_Occurred ()) { - PyErr_Print (); - pyg_gil_state_release(state); - return; +static void +call_chain_function(GstPad *pad, GstData *data) +{ + GClosure *closure; + GValue args[2] = { { 0, }, { 0, } }; + + g_value_init (&args[0], GST_TYPE_REAL_PAD); + if (GST_IS_BUFFER (data)) { + g_value_init (&args[1], GST_TYPE_BUFFER); + } else if (GST_IS_EVENT (data)) { + g_value_init (&args[1], GST_TYPE_EVENT); + } else { + g_value_init (&args[1], GST_TYPE_DATA); } + g_value_set_object (&args[0], pad); + g_value_take_boxed (&args[1], data); + closure = pad_private(pad)->chain_function; + + g_closure_invoke (closure, NULL, 2, args, NULL); - pyg_gil_state_release(state); + g_value_unset (&args[0]); + g_value_unset (&args[1]); } static PyObject* @@ -145,61 +236,44 @@ _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, (GstPadChainFunction)call_chain_function); - - Py_INCREF(Py_None); - return Py_None; + SET_PAD_CLOSURE (self, args, kwargs, chain_function) } %% override gst_pad_set_event_function kwargs +static void EXCEPTION_HANDLER +handle_event_function_exception (GValue *ret, guint n, const GValue *params) +{ + GstElement *element = gst_pad_get_parent (g_value_get_object (¶ms[0])); + + if (!_pygst_element_check_error (element)) + g_assert_not_reached (); /* only returns FALSE when there's no error */ +} + static gboolean call_event_function (GstPad *pad, GstEvent *event) { - PyObject *function; - PyObject *retval; - gboolean ret; - PyGILState_STATE state; + GClosure *closure; + GValue ret = { 0, }; + GValue args[2] = { { 0, }, { 0, } }; + gboolean bool; - function = pad_private(pad)->event_function; + g_value_init (&ret, G_TYPE_BOOLEAN); + g_value_set_boolean (&ret, FALSE); + g_value_init (&args[0], GST_TYPE_REAL_PAD); + g_value_init (&args[1], GST_TYPE_EVENT); + g_value_set_object (&args[0], pad); + g_value_set_boxed (&args[1], event); + closure = pad_private(pad)->event_function; - state = pyg_gil_state_ensure(); - - retval = PyObject_CallFunction (function, - "OO", - pad_private(pad)->pad, - pyg_boxed_new(GST_TYPE_EVENT, event, TRUE, TRUE)); - - if (PyErr_Occurred ()) { - PyErr_Print (); - pyg_gil_state_release(state); - return FALSE; - } + g_closure_invoke (closure, &ret, 2, args, NULL); - ret = PyInt_AsLong(retval); + bool = g_value_get_boolean (&ret); - pyg_gil_state_release(state); - - return ret; + g_value_unset (&ret); + g_value_unset (&args[0]); + g_value_unset (&args[1]); + return bool; } static PyObject* @@ -207,58 +281,41 @@ _wrap_gst_pad_set_event_function (PyGObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "event_function", NULL }; - PyObject *event_function; - GstPad *pad; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O:GstPad.set_event_funcion", - kwlist, - &event_function)) { - return NULL; - } - - if (!PyCallable_Check(event_function)) { - PyErr_SetString(PyExc_TypeError, "event_function not callable"); - return NULL; - } - - Py_INCREF(event_function); - py_pad_private(self)->event_function = event_function; - pad = (GstPad*)pygobject_get(self); - gst_pad_set_event_function(pad, (GstPadEventFunction)call_event_function); - - Py_INCREF(Py_None); - return Py_None; + SET_PAD_CLOSURE (self, args, kwargs, event_function) } + %% override gst_pad_set_get_function kwargs +static void EXCEPTION_HANDLER +handle_get_function_exception (GValue *ret, guint n, const GValue *params) +{ + GstElement *element = gst_pad_get_parent (g_value_get_object (¶ms[0])); + + if (!_pygst_element_check_error (element)) + g_assert_not_reached (); /* only returns FALSE when there's no error */ +} + static GstData* call_get_function (GstPad *pad) { - PyObject *function; - PyObject *retval; + GClosure *closure; + GValue ret = { 0, }; + GValue args = { 0, }; GstData *data = NULL; - PyGILState_STATE state; - function = pad_private(pad)->get_function; + g_value_init (&ret, GST_TYPE_DATA); + g_value_init (&args, GST_TYPE_REAL_PAD); + g_value_set_object (&args, pad); + closure = pad_private(pad)->get_function; - state = pyg_gil_state_ensure(); - - retval = PyObject_CallFunction(function, "O", pad_private(pad)->pad); + g_closure_invoke (closure, &ret, 1, &args, NULL); - if (PyErr_Occurred()) { - PyErr_Print(); - goto bail; - } else if (retval == Py_None) { - goto bail; - } - - pygst_data_from_pyobject(retval, &data); + data = g_value_get_boxed (&ret); + gst_data_ref (data); -bail: - pyg_gil_state_release(state); + g_value_unset (&ret); + g_value_unset (&args); return data; } @@ -267,29 +324,7 @@ _wrap_gst_pad_set_get_function (PyGObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "get_function", NULL }; - PyObject *get_function; - GstPad *pad; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O:GstPad.set_get_funcion", - kwlist, - &get_function)) { - return NULL; - } - - if (!PyCallable_Check(get_function)) { - PyErr_SetString(PyExc_TypeError, "get_function not callable"); - return NULL; - } - - Py_INCREF(get_function); - py_pad_private(self)->get_function = get_function; - pad = (GstPad*)pygobject_get(self); - gst_pad_set_get_function(pad, (GstPadGetFunction)call_get_function); - - Py_INCREF(Py_None); - return Py_None; + SET_PAD_CLOSURE (self, args, kwargs, get_function) } %% override-slot GstPad.tp_repr @@ -305,7 +340,7 @@ _wrap_gst_pad_tp_repr (PyGObject *self) parent = gst_pad_get_parent (pad); buf = g_strdup_printf ("", - gst_element_get_name (parent), + parent ? gst_element_get_name (parent) : "---", gst_pad_get_name (pad), (long) self->obj); retval = PyString_FromString(buf); @@ -457,3 +492,56 @@ _wrap_gst_pad_template_get_caps_by_name(PyGObject *self, PyObject *args, PyObjec /* pyg_boxed_new handles NULL checking */ return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE); } +%% +override gst_pad_new kwargs +static int +_wrap_gst_pad_new(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", "direction", NULL }; + static char *kwlist2[] = { "template", "name", NULL }; + PyGObject *templ; + char *name = NULL; + PyObject *py_direction = NULL; + GstPadDirection direction; + + if (PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GstPad.__init__", kwlist, &name, &py_direction)) { + if (pyg_enum_get_value(GST_TYPE_PAD_DIRECTION, py_direction, (gint *)&direction)) + return -1; + self->obj = (GObject *)gst_pad_new(name, direction); + } else { + PyErr_Clear (); + if (PyArg_ParseTupleAndKeywords(args, kwargs, "O!|s:GstPad.__init__", kwlist2, &PyGstPadTemplate_Type, &templ, &name)) { + if (name == NULL) + name = GST_PAD_TEMPLATE_NAME_TEMPLATE (GST_PAD_TEMPLATE(templ->obj)); + self->obj = (GObject *)gst_pad_new_from_template(GST_PAD_TEMPLATE(templ->obj), name); + } + } + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create GstPad object"); + return -1; + } + pygobject_register_wrapper((PyObject *)self); + return 0; +} +%% +override-slot GstPadTemplate.tp_getattr +#define IS_ATTR(name) (strcmp (name, attr) == 0) +PyObject * +_wrap_gst_pad_template_tp_getattr(PyObject *self, char *attr) +{ + GstPadTemplate *templ = GST_PAD_TEMPLATE (pygobject_get (self)); + + if (IS_ATTR ("__members__")) { + return Py_BuildValue("[ssss]", "name_template", "direction", "presence", "caps" ); + } else if (IS_ATTR ("name_template")) { + return PyString_FromString (GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)); + } else if (IS_ATTR ("direction")) { + return pyg_enum_from_gtype(GST_TYPE_PAD_DIRECTION, GST_PAD_TEMPLATE_DIRECTION(templ)); + } else if (IS_ATTR ("presence")) { + return pyg_enum_from_gtype(GST_TYPE_PAD_PRESENCE, GST_PAD_TEMPLATE_PRESENCE(templ)); + } else if (IS_ATTR ("caps")) { + return pyg_boxed_new (GST_TYPE_CAPS, GST_PAD_TEMPLATE_CAPS(templ), TRUE, TRUE); + } + return Py_FindMethod(_PyGstPadTemplate_methods, self, attr); +} + diff --git a/gst/gststructure.override b/gst/gststructure.override index c0d13ac..1b2aa89 100644 --- a/gst/gststructure.override +++ b/gst/gststructure.override @@ -100,7 +100,7 @@ _wrap_gst_structure_set_value(PyObject *self, PyObject *args, PyObject *kwargs) } g_value_init(&value, type); - if (pyg_value_from_pyobject(&value, py_value) != 0) { + if (pygst_value_from_pyobject(&value, py_value) != 0) { return NULL; } gst_structure_set_value(pyg_boxed_get(self, GstStructure), field, @@ -131,6 +131,27 @@ _wrap_gst_structure_get_int(PyObject *self, PyObject *args, PyObject *kwargs) return Py_None; } %% +override gst_structure_get_double kwargs +static PyObject * +_wrap_gst_structure_get_double(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "fieldname", NULL }; + char *fieldname; + gdouble value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s:GstStructure.get_double", + kwlist, &fieldname)) + return NULL; + + if (gst_structure_get_double(pyg_boxed_get(self, GstStructure), fieldname, &value)) + return PyFloat_FromDouble(value); + + /* XXX: Raise exception? */ + Py_INCREF(Py_None); + return Py_None; +} +%% define GstStructure.has_key args static PyObject* _wrap_gst_structure_has_key(PyGObject *self, PyObject *args) @@ -163,7 +184,7 @@ _wrap_gst_structure_subscript(PyGObject *self, PyObject *py_key) const GValue *gvalue; gvalue = gst_structure_get_value((GstStructure*)self->obj, field); g_assert(gvalue != NULL); - v = pyg_value_as_pyobject(gvalue, TRUE); + v = pygst_value_as_pyobject(gvalue, TRUE); } else { PyErr_SetString(PyExc_KeyError, field); } @@ -184,37 +205,13 @@ _wrap_gst_structure_ass_subscript(PyGObject *self, structure = (GstStructure*)self->obj; key = PyString_AsString(py_key); if (py_value != NULL) { - if (PyString_Check(py_value)) { -#if 0 - GValue *value = NULL; - gst_structure_field_from_string(PyString_AsString(py_value), value); - g_print ("gvalue: %s %s %s\n", - PyString_AsString(py_value), - gst_value_serialize(value), - G_VALUE_TYPE_NAME(value)); - gst_structure_set_value(structure, key, value); -#else - GValue value = { 0, }; - g_value_init (&value, G_TYPE_STRING); - gst_value_deserialize(&value, PyString_AsString(py_value)); - gst_structure_set_value(structure, key, &value); - g_value_unset(&value); -#endif - // gst_structure_set(structure, key, G_TYPE_STRING, PyString_AsString(py_value), NULL); - } else if (PyInt_Check(py_value)) - gst_structure_set(structure, key, G_TYPE_INT, PyInt_AsLong(py_value), NULL); - else if (PyFloat_Check(py_value)) - gst_structure_set(structure, key, G_TYPE_DOUBLE, PyFloat_AsDouble(py_value), NULL); -#if 0 - g_value_init(&value, g_type_from_name("PyObject")); - if (pyg_value_from_pyobject(&value, py_value)) { - PyErr_SetString(PyExc_TypeError, "can't convert value"); + GValue v = { 0, }; + if (!pygst_value_init_for_pyobject (&v, py_value)) + return -1; + if (pygst_value_from_pyobject(&v, py_value)) return -1; - } - - gst_structure_set_value(structure, key, &value); - g_value_unset(&value); -#endif + gst_structure_set_value(structure, key, &v); + g_value_unset(&v); } else { gst_structure_remove_field(structure, key); } @@ -245,7 +242,7 @@ pygst_structure_foreach_marshal(GQuark field_id, state = pyg_gil_state_ensure(); py_field = Py_BuildValue("s", g_quark_to_string(field_id)); - py_value = pyg_value_as_pyobject(value, FALSE); + py_value = pygst_value_as_pyobject(value, FALSE); if (cunote->data) retobj = PyEval_CallFunction(cunote->func, "(NNO)", py_field, py_value, @@ -331,3 +328,18 @@ _wrap_gst_structure_from_string(PyObject *self, PyObject *args, PyObject *kwargs /* pyg_boxed_new handles NULL checking */ return pyg_boxed_new(GST_TYPE_STRUCTURE, ret, TRUE, TRUE); } +%% +override-slot GstStructure.tp_dealloc +static void +_wrap_gst_structure_tp_dealloc (PyObject *self) +{ + PyGBoxed *boxed = (PyGBoxed *) self; + + if (boxed->free_on_dealloc && boxed->boxed) { + gst_structure_free (boxed->boxed); + } else if (boxed->boxed) { + pygst_caps_map_remove_structure (self); + } + + self->ob_type->tp_free((PyObject *)self); +} diff --git a/gst/pygstvalue.c b/gst/pygstvalue.c new file mode 100644 index 0000000..bb11976 --- /dev/null +++ b/gst/pygstvalue.c @@ -0,0 +1,301 @@ +/* gst-python + * Copyright (C) 2004 Andy Wingo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Andy Wingo + */ + +/* define this for all source files that don't run init_pygobject() + * before including pygobject.h */ +#define NO_IMPORT_PYGOBJECT + +#include "pygstvalue.h" + + +static PyObject *gstvalue_class = NULL; +static PyObject *gstfourcc_class = NULL; +static PyObject *gstintrange_class = NULL; +static PyObject *gstdoublerange_class = NULL; +static PyObject *gstfraction_class = NULL; + + +/** + * pygst_value_as_pyobject: + * @value: the GValue object. + * @copy_boxed: true if boxed values should be copied. + * + * This function creates/returns a Python wrapper object that + * represents the GValue passed as an argument. + * + * Returns: a PyObject representing the value. + */ +PyObject * +pygst_value_as_pyobject(const GValue *value, gboolean copy_boxed) +{ + PyObject *ret = pyg_value_as_pyobject(value, copy_boxed); + if (!ret) { + PyErr_Clear(); + if (GST_VALUE_HOLDS_FOURCC (value)) { + gchar str[5]; + g_snprintf (str, 5, GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (gst_value_get_fourcc (value))); + ret = PyObject_Call (gstfourcc_class, Py_BuildValue ("(s)", str), NULL); + } else if (GST_VALUE_HOLDS_INT_RANGE (value)) { + ret = PyObject_Call + (gstintrange_class, + Py_BuildValue ("ii", + gst_value_get_int_range_min (value), + gst_value_get_int_range_max (value)), + NULL); + } else if (GST_VALUE_HOLDS_DOUBLE_RANGE (value)) { + ret = PyObject_Call + (gstdoublerange_class, + Py_BuildValue ("dd", + gst_value_get_double_range_min (value), + gst_value_get_double_range_max (value)), + NULL); + } else if (GST_VALUE_HOLDS_LIST (value)) { + int i, len; + len = gst_value_list_get_size (value); + ret = PyList_New (len); + for (i=0; iob_type))) { + if (PyObject_IsInstance (obj, gstvalue_class)) { + PyErr_Clear (); + if (PyObject_IsInstance (obj, gstfourcc_class)) + t = GST_TYPE_FOURCC; + else if (PyObject_IsInstance (obj, gstintrange_class)) + t = GST_TYPE_INT_RANGE; + else if (PyObject_IsInstance (obj, gstdoublerange_class)) + t = GST_TYPE_DOUBLE_RANGE; + else if (PyObject_IsInstance (obj, gstfraction_class)) + t = GST_TYPE_FRACTION; + else { + PyErr_SetString(PyExc_TypeError, "Unexpected gst.Value instance"); + return FALSE; + } + } else if (PyTuple_Check (obj)) { + PyErr_Clear (); + t = GST_TYPE_FIXED_LIST; + } else if (PyList_Check (obj)) { + PyErr_Clear (); + t = GST_TYPE_LIST; + } else { + /* pyg_type_from_object already set the error */ + return FALSE; + } + } + g_value_init (value, t); + return TRUE; +} + +/** + * pygst_value_from_pyobject: + * @value: the GValue object to store the converted value in. + * @obj: the Python object to convert. + * + * This function converts a Python object and stores the result in a + * GValue. The GValue must be initialised in advance with + * g_value_init(). If the Python object can't be converted to the + * type of the GValue, then an error is returned. + * + * Returns: 0 on success, -1 on error. + */ +int +pygst_value_from_pyobject (GValue *value, PyObject *obj) +{ + GType f = g_type_fundamental (G_VALUE_TYPE (value)); + + /* work around a bug in pygtk whereby pyg_value_from_pyobject claims success + for unknown fundamental types without actually doing anything */ + if (f < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST) + && pyg_value_from_pyobject (value, obj) == 0) { + return 0; + } else if (PyObject_IsInstance (obj, gstvalue_class)) { + PyErr_Clear (); + + if (PyObject_IsInstance (obj, gstfourcc_class)) { + PyObject *pystr; + gchar *str; + VALUE_TYPE_CHECK (value, GST_TYPE_FOURCC); + if (!(pystr = PyObject_GetAttrString (obj, "fourcc"))) + return -1; + if (!(str = PyString_AsString (pystr))) + return -1; + g_assert (strlen (str) == 4); + gst_value_set_fourcc (value, GST_STR_FOURCC (str)); + } else if (PyObject_IsInstance (obj, gstintrange_class)) { + PyObject *pyval; + long low, high; + VALUE_TYPE_CHECK (value, GST_TYPE_INT_RANGE); + if (!(pyval = PyObject_GetAttrString (obj, "low"))) + return -1; + low = PyInt_AsLong (pyval); + g_assert (G_MININT <= low && low <= G_MAXINT); + if (!(pyval = PyObject_GetAttrString (obj, "high"))) + return -1; + high = PyInt_AsLong (pyval); + g_assert (G_MININT <= high && high <= G_MAXINT); + gst_value_set_int_range (value, (int)low, (int)high); + } else if (PyObject_IsInstance (obj, gstdoublerange_class)) { + PyObject *pyval; + double low, high; + VALUE_TYPE_CHECK (value, GST_TYPE_DOUBLE_RANGE); + if (!(pyval = PyObject_GetAttrString (obj, "low"))) + return -1; + low = PyFloat_AsDouble (pyval); + if (!(pyval = PyObject_GetAttrString (obj, "high"))) + return -1; + high = PyFloat_AsDouble (pyval); + gst_value_set_double_range (value, low, high); + } else if (PyObject_IsInstance (obj, gstfraction_class)) { + PyObject *pyval; + long num, denom; + VALUE_TYPE_CHECK (value, GST_TYPE_FRACTION); + if (!(pyval = PyObject_GetAttrString (obj, "num"))) + return -1; + num = PyInt_AsLong (pyval); + g_assert (G_MININT <= num && num <= G_MAXINT); + if (!(pyval = PyObject_GetAttrString (obj, "denom"))) + return -1; + denom = PyInt_AsLong (pyval); + g_assert (G_MININT <= denom && denom <= G_MAXINT); + gst_value_set_fraction (value, (int)num, (int)denom); + } else { + gchar buf[256]; + gchar *str = PyString_AsString (PyObject_Repr(obj)); + g_snprintf(buf, 256, "Unknown gst.Value type: %s", str); + PyErr_SetString(PyExc_TypeError, buf); + return -1; + } + return 0; + } else if (PyTuple_Check (obj)) { + gint i, len; + PyErr_Clear (); + VALUE_TYPE_CHECK (value, GST_TYPE_FIXED_LIST); + len = PyTuple_Size (obj); + for (i = 0; i < len; i++) { + PyObject *o; + GValue new = {0,}; + o = PyTuple_GetItem (obj, i); + if (!pygst_value_init_for_pyobject (&new, o)) + return -1; + if (pygst_value_from_pyobject (&new, o) != 0) { + g_value_unset (&new); + return -1; + } + gst_value_list_append_value (value, &new); + g_value_unset (&new); + } + return 0; + } else if (PyList_Check (obj)) { + gint i, len; + PyErr_Clear (); + VALUE_TYPE_CHECK (value, GST_TYPE_LIST); + len = PyList_Size (obj); + for (i = 0; i < len; i++) { + PyObject *o; + GValue new = {0,}; + o = PyList_GetItem (obj, i); + if (!pygst_value_init_for_pyobject (&new, o)) + return -1; + if (pygst_value_from_pyobject (&new, o) != 0) { + g_value_unset (&new); + return -1; + } + gst_value_list_append_value (value, &new); + g_value_unset (&new); + } + return 0; + } else { + return -1; + } +} + +#define NULL_CHECK(o) if (!o) goto err + +gboolean +pygst_value_init(void) +{ + PyObject *module, *dict; + + if ((module = PyImport_ImportModule("gst")) == NULL) + return FALSE; + + dict = PyModule_GetDict (module); + + gstvalue_class = (PyObject*)PyDict_GetItemString (dict, "Value"); + NULL_CHECK (gstvalue_class); + gstfourcc_class = (PyObject*)PyDict_GetItemString (dict, "Fourcc"); + NULL_CHECK (gstfourcc_class); + gstintrange_class = (PyObject*)PyDict_GetItemString (dict, "IntRange"); + NULL_CHECK (gstintrange_class); + gstdoublerange_class = (PyObject*)PyDict_GetItemString (dict, "DoubleRange"); + NULL_CHECK (gstdoublerange_class); + gstfraction_class = (PyObject*)PyDict_GetItemString (dict, "Fraction"); + NULL_CHECK (gstfraction_class); + return TRUE; + +err: + PyErr_SetString (PyExc_ImportError, + "Failed to get GstValue classes from gst module"); + return FALSE; +} diff --git a/gst/pygstvalue.h b/gst/pygstvalue.h new file mode 100644 index 0000000..6083f59 --- /dev/null +++ b/gst/pygstvalue.h @@ -0,0 +1,29 @@ +/* gst-python + * Copyright (C) 2004 Andy Wingo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Andy Wingo + */ + +#include "common.h" +#include + + +PyObject *pygst_value_as_pyobject(const GValue *value, gboolean copy_boxed); +gboolean pygst_value_init_for_pyobject (GValue *value, PyObject *obj); +int pygst_value_from_pyobject(GValue *value, PyObject *obj); +gboolean pygst_value_init(void); diff --git a/gst/ltihooks.py b/ltihooks.py similarity index 100% rename from gst/ltihooks.py rename to ltihooks.py diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 10d3734..b349fc3 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -31,7 +31,7 @@ tests = \ test_xml.py check-local: testhelper.la - @PYTHONPATH=$(PYTHONPATH):$(top_builddir):$(top_builddir)/gst/.libs $(PYTHON) $(srcdir)/runtests.py + @G_DEBUG=fatal_warnings GST_DEBUG=*:0 PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py @rm -fr *.pyc EXTRA_DIST = $(tests) common.py runtests.py test-object.h diff --git a/testsuite/common.py b/testsuite/common.py index 49b64d7..145228a 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -1,4 +1,11 @@ -import dl +try: + from dl import RTLD_LAZY, RTLD_GLOBAL +except ImportError: + # dl doesn't seem to be available on 64bit systems + try: + from DLFCN import RTLD_LAZY, RTLD_GLOBAL + except ImportError: + pass import os import sys import unittest @@ -13,36 +20,51 @@ except: print "WARNING: gobject doesn't have threads_init, no threadsafety" # Don't insert before . -sys.path.insert(1, os.path.join('..')) +# sys.path.insert(1, os.path.join('..')) # Load GST and make sure we load it from the current build -sys.setdlopenflags(dl.RTLD_LAZY | dl.RTLD_GLOBAL) +sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL) # Hack sys.argv.append('--gst-debug-no-color') -path = os.path.abspath(os.path.join('..', 'gst')) +topbuilddir = os.path.abspath(os.path.join('..')) +topsrcdir = os.path.abspath(os.path.join('..')) +if topsrcdir.endswith('_build'): + topsrcdir = os.path.dirname(topsrcdir) + +# gst's __init__.py is in topsrcdir/gst +path = os.path.abspath(os.path.join(topsrcdir, 'gst')) import gst +file = gst.__file__ +assert file.startswith(path), 'bad gst path: %s' % file +# gst's interfaces and play are in topbuilddir/gst +path = os.path.abspath(os.path.join(topbuilddir, 'gst')) try: import gst.interfaces - assert os.path.basename(gst.interfaces.__file__) != path, 'bad path' except ImportError: - pass + # hack: we import it from our builddir/gst/.libs instead; ugly + import interfaces + gst.interfaces = interfaces +file = gst.interfaces.__file__ +assert file.startswith(path), 'bad gst.interfaces path: %s' % file try: import gst.play assert os.path.basename(gst.play.__file__) != path, 'bad path' except ImportError: + # hack: we import it from our builddir/gst/.libs instead; ugly + import play + gst.play = play pass +file = gst.play.__file__ +assert file.startswith(path), 'bad gst.play path: %s' % file # testhelper needs ltihooks -import gst.ltihooks - +import ltihooks import testhelper - -# finally remove ltihooks -gst.ltihooks.uninstall() +ltihooks.uninstall() _stderr = None diff --git a/testsuite/runtests.py b/testsuite/runtests.py index 83b6013..dd0a9d2 100644 --- a/testsuite/runtests.py +++ b/testsuite/runtests.py @@ -6,11 +6,9 @@ import unittest SKIP_FILES = ['common', 'runtests'] -dir = os.path.split(os.path.abspath(__file__))[0] -os.chdir(dir) - def gettestnames(): - files = glob.glob('*.py') + dir = os.path.split(os.path.abspath(__file__))[0] + files = [os.path.basename(p) for p in glob.glob('%s/*.py' % dir)] names = map(lambda x: x[:-3], files) map(names.remove, SKIP_FILES) return names @@ -22,4 +20,6 @@ for name in gettestnames(): suite.addTest(loader.loadTestsFromName(name)) testRunner = unittest.TextTestRunner() -testRunner.run(suite) +result = testRunner.run(suite) +if result.failures or result.errors: + sys.exit(1) diff --git a/testsuite/test_buffer.py b/testsuite/test_buffer.py index 97178a8..1621723 100644 --- a/testsuite/test_buffer.py +++ b/testsuite/test_buffer.py @@ -1,4 +1,5 @@ import sys +import gc from common import gobject, gst, unittest class BufferTest(unittest.TestCase): @@ -9,7 +10,13 @@ class BufferTest(unittest.TestCase): def testBufferStr(self): buffer = gst.Buffer('test') assert str(buffer) == 'test' - + + def testBufferAlloc(self): + bla = 'mooooooo' + buffer = gst.Buffer(bla + '12345') + gc.collect () + assert str(buffer) == 'mooooooo12345' + def testBufferBadConstructor(self): self.assertRaises(TypeError, gst.Buffer, 'test', 0) diff --git a/testsuite/test_caps.py b/testsuite/test_caps.py index cc5cc75..282bdcc 100644 --- a/testsuite/test_caps.py +++ b/testsuite/test_caps.py @@ -4,7 +4,9 @@ from common import gst, unittest class CapsTest(unittest.TestCase): def setUp(self): self.caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5.0;video/x-raw-rgb,width=15,framerate=10.0') - self.structure = self.caps.get_structure(0) + self.structure = self.caps[0] + self.any = gst.Caps("ANY") + self.empty = gst.Caps() def testCapsMime(self): mime = self.structure.get_name() @@ -61,6 +63,14 @@ class CapsTest(unittest.TestCase): assert isinstance(struct['height'], float) assert struct['height'] == 20.0 + def testCapsRefernceStructs(self): + 'test that shows why it\'s not a good idea to use structures by reference' + caps = gst.Caps('hi/mom,width=0') + structure = caps[0] + del caps + assert structure['width'] == 0 + + def testCapsStructureChange(self): 'test if changing the structure of the caps works by reference' assert self.structure['width'] == 10 @@ -80,6 +90,57 @@ class CapsTest(unittest.TestCase): # This causes segfault! #self.assertRaises(TypeError, gst.Caps, struct, 10, None) + + def testTrueFalse(self): + 'test that comparisons using caps work the intended way' + assert self.any # not empty even though it has no structures + assert not self.empty + assert not gst.Caps('EMPTY') # also empty + assert gst.Caps('your/mom') + + def testComparisons(self): + assert self.empty < self.any + assert self.empty < self.structure + assert self.empty < self.caps + assert self.caps < self.any + assert self.empty <= self.empty + assert self.caps <= self.caps + assert self.caps <= self.any + assert self.empty == "EMPTY" + assert self.caps != self.any + assert self.empty != self.any + assert self.any > self.empty + assert self.any >= self.empty + + def testFilters(self): + name = 'video/x-raw-yuv' + filtercaps = gst.Caps(*[struct for struct in self.caps if struct.get_name() == name]) + intersection = self.caps & 'video/x-raw-yuv' + assert filtercaps == intersection + + def doSubtract(self, set, subset): + '''mimic the test in GStreamer core's testsuite/caps/subtract.c''' + assert not set - set + assert not subset - subset + assert not subset - set + test = set - subset + assert test + test2 = test | subset + test = test2 - set + assert not test + #our own extensions foolow here + assert subset == set & subset + assert set == set | subset + assert set - subset == set ^ subset + + def testSubtract(self): + self.doSubtract( + gst.Caps ("some/mime, _int = [ 1, 2 ], list = { \"A\", \"B\", \"C\" }"), + gst.Caps ("some/mime, _int = 1, list = \"A\"")) + self.doSubtract( + gst.Caps ("some/mime, _double = (double) 1.0; other/mime, _int = { 1, 2 }"), + gst.Caps ("some/mime, _double = (double) 1.0")) + if __name__ == "__main__": unittest.main() diff --git a/testsuite/test_element.py b/testsuite/test_element.py index 5da7c1d..561740a 100644 --- a/testsuite/test_element.py +++ b/testsuite/test_element.py @@ -2,7 +2,6 @@ # # testsuite for gstreamer.Element -import common from common import gst, unittest class ElementTest(unittest.TestCase): @@ -44,7 +43,7 @@ class FakeSinkTest(ElementTest): self.error = True self.element.connect('error', error_cb) - common.run_silent(self.element.set_state, state) + self.element.set_state (state) assert self.error, 'error not set' #assert error_message.find('ERROR') != -1 diff --git a/testsuite/test_interface.py b/testsuite/test_interface.py index 198ab67..0270372 100644 --- a/testsuite/test_interface.py +++ b/testsuite/test_interface.py @@ -12,7 +12,10 @@ class Availability(unittest.TestCase): assert issubclass(gst.interfaces.Mixer, gobject.GInterface) class FunctionCall(unittest.TestCase): - def testXOverlay(self): + def FIXME_testXOverlay(self): + # obviously a testsuite is not allowed to instantiate this + # since it needs a running X or will fail. find some way to + # deal with that. element = gst.element_factory_make('xvimagesink') assert isinstance(element, gst.Element) assert isinstance(element, gst.interfaces.XOverlay) diff --git a/testsuite/test_struct.py b/testsuite/test_struct.py index f12cf44..11ee4f4 100644 --- a/testsuite/test_struct.py +++ b/testsuite/test_struct.py @@ -5,9 +5,6 @@ class StructureTest(unittest.TestCase): def setUp(self): self.struct = gst.structure_from_string('video/x-raw-yuv,width=10,foo="bar",pixel-aspect-ratio=1/2,framerate=5.0') - #def foo(self): - # gst.structure_from_string("foo") - def testName(self): assert self.struct.get_name() == 'video/x-raw-yuv' self.struct.set_name('foobar') @@ -37,30 +34,39 @@ class StructureTest(unittest.TestCase): assert isinstance(self.struct['integer'], int) assert self.struct['integer'] == 5, self.struct['integer'] - def testCreateFourCC(self): - self.struct['fourcc'] = "(fourcc)XVID" - #assert self.struct.has_key('fourcc') - #print self.struct.to_string() - #assert isinstance(self.struct['fourcc'], int) - #assert self.struct['integer'] == 5, self.struct['integer'] + def testGstValue(self): + s = self.struct + s['fourcc'] = gst.Fourcc('XVID') + assert s['fourcc'].fourcc == 'XVID' + s['frac'] = gst.Fraction(3,4) + assert s['frac'].num == 3 + assert s['frac'].denom == 4 + s['intrange'] = gst.IntRange(5,21) + assert s['intrange'].low == 5 + assert s['intrange'].high == 21 + s['doublerange'] = gst.DoubleRange(6.,21.) + assert s['doublerange'].low == 6. + assert s['doublerange'].high == 21. + s['fixedlist'] = (4, 5, 6) + assert isinstance(s['fixedlist'], tuple) + assert s['fixedlist'] == (4, 5, 6) + s['list'] = [4, 5, 6] + assert isinstance(s['list'], list) + assert s['list'] == [4, 5, 6] + # finally, some recursive tests + s['rflist'] = ([(['a', 'b'], ['c', 'd']),'e'], ['f', 'g']) + assert s['rflist'] == ([(['a', 'b'], ['c', 'd']),'e'], ['f', 'g']) + s['rlist'] = [([(['a', 'b'], ['c', 'd']),'e'], ['f', 'g']), 'h'] + assert s['rlist'] == [([(['a', 'b'], ['c', 'd']),'e'], ['f', 'g']), 'h'] + def testStructureChange(self): - #assert structure['pixel-aspect-ratio'].numerator == 1 - #assert structure['pixel-aspect-ratio'].denominator == 2 - #assert float(structure['pixel-aspect-ratio']) == 0.5 - #structure['pixel-aspect-ratio'] = gst.Fraction(3, 4) - #assert structure['pixel-aspect-ratio'].numerator == 3 - #assert structure['pixel-aspect-ratio'].denominator == 4 - #assert float(structure['pixel-aspect-ratio']) == 0.75 - assert self.struct['framerate'] == 5.0 self.struct['framerate'] = 10.0 assert self.struct['framerate'] == 10.0 - - # a list of heights - #structure['height'] = (20, 40, 60) - #assert structure['width'] == (20, 40, 60) - # FIXME: add ranges + self.struct['pixel-aspect-ratio'] = gst.Fraction(4, 2) + assert self.struct['pixel-aspect-ratio'].num == 2 + assert self.struct['pixel-aspect-ratio'].denom == 1 if __name__ == "__main__": unittest.main() -- 2.7.4