gnomemm r1829 - in gstreamermm/trunk: . gstreamer/src tests
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1829 - in gstreamermm/trunk: . gstreamer/src tests
- Date: Wed, 10 Dec 2008 05:41:55 +0000 (UTC)
Author: jaalburqu
Date: Wed Dec 10 05:41:55 2008
New Revision: 1829
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1829&view=rev
Log:
2008-12-10 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/basesink.hg:
* gstreamer/src/basesrc.hg:
* gstreamer/src/basetransform.hg: Temporarily "un-wrap" the vfuncs
that return bool because they cause errors when using plug-ins that
derive from these classes (see related bug #530416 and comments in
element.hg about the bug).
* tests/Makefile.am:
* tests/test-plugin-signals.cc: Added a test for generated plug-in
signals. They work as long as the bool vfuncs are not wrapped or the
patch in bug #530416 (or something similar) is accepted.
Added:
gstreamermm/trunk/tests/test-plugin-signals.cc
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/src/basesink.hg
gstreamermm/trunk/gstreamer/src/basesrc.hg
gstreamermm/trunk/gstreamer/src/basetransform.hg
gstreamermm/trunk/tests/Makefile.am
Modified: gstreamermm/trunk/gstreamer/src/basesink.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesink.hg (original)
+++ gstreamermm/trunk/gstreamer/src/basesink.hg Wed Dec 10 05:41:55 2008
@@ -171,15 +171,23 @@
_WRAP_PROPERTY("sync", bool)
_WRAP_PROPERTY("ts-offset", gint64)
+ //TODO: bool vfuncs are a problem because if the base class does not
+ //implement one (which occurs often in GStreamer -- don't know why) the
+ //default generated callback returns false because of the "typedef RType;
+ //return RType()" statements (see discussion about bug #530416 in element.hg
+ //for more). I've filed a patch for the bug which will allow a custom return
+ //to be specified for the callback, in which case the bool vfuncs can be made
+ //to return true which would then work.
+
#m4 _CONVERSION(`Glib::RefPtr<Caps>', `GstCaps*', `($3)->gobj()')
/** Called to get sink pad caps from the subclass.
*/
_WRAP_VFUNC(Glib::RefPtr<Caps> get_caps(), "get_caps")
#m4 _CONVERSION(`GstCaps*', `const Glib::RefPtr<Caps>&', `Glib::wrap($3)')
- /** Notify subclass of changed caps.
- */
- _WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& caps), "set_caps")
+ ///** Notify subclass of changed caps.
+ //*/
+ //_WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& caps), "set_caps")
//TODO: #m4 _CONVERSION(`Glib::RefPtr<Buffer>&', `GstBuffer**', `*($3)')
//_WRAP_VFUNC(FlowReturn buffer_alloc(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer), "buffer_alloc")
@@ -191,22 +199,22 @@
*/
_WRAP_VFUNC(void get_times(const Glib::RefPtr<Buffer>& buffer, ClockTime& start, ClockTime& end), "get_times")
- /** Start processing. Ideal for opening resources in the subclass.
- */
- _WRAP_VFUNC(bool start(), "start")
-
- /** Stop processing. Subclasses should use this to close resources.
- */
- _WRAP_VFUNC(bool stop(), "stop")
-
- /** Unlock any pending access to the resource. Subclasses should unblock any
- * blocked function ASAP.
- */
- _WRAP_VFUNC(bool unlock(), "unlock")
-
- /** Override this to handle events arriving on the sink pad.
- */
- _WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
+ ///** Start processing. Ideal for opening resources in the subclass.
+ //*/
+ //_WRAP_VFUNC(bool start(), "start")
+
+ ///** Stop processing. Subclasses should use this to close resources.
+ //*/
+ //_WRAP_VFUNC(bool stop(), "stop")
+
+ ///** Unlock any pending access to the resource. Subclasses should unblock any
+ //* blocked function ASAP.
+ //*/
+ //_WRAP_VFUNC(bool unlock(), "unlock")
+
+ ///** Override this to handle events arriving on the sink pad.
+ //*/
+ //_WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
/** Called to present the preroll buffer if desired.
*/
@@ -223,13 +231,13 @@
*/
_WRAP_VFUNC(StateChangeReturn async_play(), "async_play")
- /** Subclasses should override this when they can provide an alternate method
- * of spawning a thread to drive the pipeline in pull mode. Should start or
- * stop the pulling thread, depending on the value of the "active" argument.
- * Called after actually activating the sink pad in pull mode. The default
- * implementation starts a task on the sink pad.
- */
- _WRAP_VFUNC(bool activate_pull(bool active), "activate_pull")
+ ///** Subclasses should override this when they can provide an alternate method
+ //* of spawning a thread to drive the pipeline in pull mode. Should start or
+ //* stop the pulling thread, depending on the value of the "active" argument.
+ //* Called after actually activating the sink pad in pull mode. The default
+ //* implementation starts a task on the sink pad.
+ //*/
+ //_WRAP_VFUNC(bool activate_pull(bool active), "activate_pull")
/** Only useful in pull mode, this vmethod will be called in response to
* Gst::Pad::fixate_caps() being called on the sink pad. Implement if you
@@ -238,10 +246,10 @@
*/
_WRAP_VFUNC(void fixate(const Glib::RefPtr<Caps>& caps), "fixate")
- /** Clear the previous unlock request. Subclasses should clear any state they
- * set during unlock_vfunc(), such as clearing command queues.
- */
- _WRAP_VFUNC(bool unlock_stop(), "unlock_stop")
+ ///** Clear the previous unlock request. Subclasses should clear any state they
+ //* set during unlock_vfunc(), such as clearing command queues.
+ //*/
+ //_WRAP_VFUNC(bool unlock_stop(), "unlock_stop")
};
} //namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/basesrc.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesrc.hg (original)
+++ gstreamermm/trunk/gstreamer/src/basesrc.hg Wed Dec 10 05:41:55 2008
@@ -161,32 +161,40 @@
_WRAP_PROPERTY("num-buffers", int)
_WRAP_PROPERTY("typefind", bool)
+ //TODO: bool vfuncs are a problem because if the base class does not
+ //implement one (which occurs often in GStreamer -- don't know why) the
+ //default generated callback returns false because of the "typedef RType;
+ //return RType()" statements (see discussion about bug #530416 in element.hg
+ //for more). I've filed a patch for the bug which will allow a custom return
+ //to be specified for the callback, in which case the bool vfuncs can be made
+ //to return true which would then work.
+
#m4 _CONVERSION(`Glib::RefPtr<Caps>', `GstCaps*', `($3)->gobj()')
/** Called to get the caps to report.
*/
_WRAP_VFUNC(Glib::RefPtr<Caps> get_caps(), "get_caps")
#m4 _CONVERSION(`GstCaps*', `const Glib::RefPtr<Caps>&', `Glib::wrap($3)')
- /** Notify subclass of changed output caps.
- */
- _WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& caps), "set_caps")
-
- /** Negotiated the caps with the peer.
- */
- _WRAP_VFUNC(bool negotiate(), "negotiate")
-
- /** Generate and send a new_segment event (UNUSED).
- */
- _WRAP_VFUNC(bool new_segment(), "newsegment")
-
- /** Start processing. Subclasses should open resources and prepare to produce
- * data.
- */
- _WRAP_VFUNC(bool start(), "start")
-
- /** Stop processing. Subclasses should use this to close resources.
- */
- _WRAP_VFUNC(bool stop(), "stop")
+ ///** Notify subclass of changed output caps.
+ //*/
+ //_WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& caps), "set_caps")
+
+ ///** Negotiated the caps with the peer.
+ //*/
+ //_WRAP_VFUNC(bool negotiate(), "negotiate")
+
+ ///** Generate and send a new_segment event (UNUSED).
+ //*/
+ //_WRAP_VFUNC(bool new_segment(), "newsegment")
+
+ ///** Start processing. Subclasses should open resources and prepare to produce
+ //* data.
+ //*/
+ //_WRAP_VFUNC(bool start(), "start")
+
+ ///** Stop processing. Subclasses should use this to close resources.
+ //*/
+ //_WRAP_VFUNC(bool stop(), "stop")
#m4 _CONVERSION(`GstBuffer*', `const Glib::RefPtr<Buffer>&', `Gst::wrap($3)')
#m4 _CONVERSION(`GstClockTime*', `ClockTime&', `*($3)')
@@ -197,61 +205,61 @@
#m4 _CONVERSION(`guint64&', `guint64*', `&($3)')
#m4 _CONVERSION(`guint64*', `guint64&', `*($3)')
- /** Return the total size of the resource, in the configured format.
- */
- _WRAP_VFUNC(bool get_size(guint64& size), "get_size")
-
- /** Check if the source can seek.
- */
- _WRAP_VFUNC(bool is_seekable(), "is_seekable")
-
- /** Unlock any pending access to the resource. Subclasses should unblock any
- * blocked function ASAP.
- */
- _WRAP_VFUNC(bool unlock(), "unlock")
-
- /** Override this to implement custom event handling.
- */
- _WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
+ ///** Return the total size of the resource, in the configured format.
+ //*/
+ //_WRAP_VFUNC(bool get_size(guint64& size), "get_size")
+
+ ///** Check if the source can seek.
+ //*/
+ //_WRAP_VFUNC(bool is_seekable(), "is_seekable")
+
+ ///** Unlock any pending access to the resource. Subclasses should unblock any
+ //* blocked function ASAP.
+ //*/
+ //_WRAP_VFUNC(bool unlock(), "unlock")
+
+ ///** Override this to implement custom event handling.
+ //*/
+ //_WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
//TODO: #m4 _CONVERSION(`Glib::RefPtr<Buffer>&', `GstBuffer**', `*($3)')
//_WRAP_VFUNC(FlowReturn create(guint64 offset, guint size, Glib::RefPtr<Buffer>& buffer), "create")
#m4 _CONVERSION(`Segment', `GstSegment*', `($3).gobj()')
#m4 _CONVERSION(`GstSegment*', `Segment', `Glib::wrap($3)')
- /** Perform seeking on the resource to the indicated segment.
- */
- _WRAP_VFUNC(bool do_seek(Segment segment), "do_seek")
-
- /** Handle a requested query.
- */
- _WRAP_VFUNC(bool query(const Glib::RefPtr<Query>& query), "query")
-
- /** Check whether the source would support pull-based operation if it were to
- * be opened now. This vfunc is optional, but should be implemented if
- * possible to avoid unnecessary start/stop cycles. The default
- * implementation will open and close the resource to find out whether
- * get_range() is supported, and that is usually undesirable.
- */
- _WRAP_VFUNC(bool check_get_range(), "check_get_range")
+ ///** Perform seeking on the resource to the indicated segment.
+ //*/
+ //_WRAP_VFUNC(bool do_seek(Segment segment), "do_seek")
+
+ ///** Handle a requested query.
+ //*/
+ //_WRAP_VFUNC(bool query(const Glib::RefPtr<Query>& query), "query")
+
+ ///** Check whether the source would support pull-based operation if it were to
+ //* be opened now. This vfunc is optional, but should be implemented if
+ //* possible to avoid unnecessary start/stop cycles. The default
+ //* implementation will open and close the resource to find out whether
+ //* get_range() is supported, and that is usually undesirable.
+ //*/
+ //_WRAP_VFUNC(bool check_get_range(), "check_get_range")
/** Called during negotiation if caps need fixating. Implement instead of
* setting a fixate function on the source pad.
*/
_WRAP_VFUNC(void fixate(const Glib::RefPtr<Caps>& caps), "fixate")
- /** Clear the previous unlock request. Subclasses should clear any state they
- * set during unlock_vfunc(), such as clearing command queues.
- */
- _WRAP_VFUNC(bool unlock_stop(), "unlock_stop")
-
- /** Prepare the GstSegment that will be passed to the do_seek_vfunc() vmethod
- * for executing a seek request. Sub-classes should override this if they
- * support seeking in formats other than the configured native format. By
- * default, it tries to convert the seek arguments to the configured native
- * format and prepare a segment in that format.
- */
- _WRAP_VFUNC(bool prepare_seek_segment(const Glib::RefPtr<Event>& seek, Segment segment), "prepare_seek_segment")
+ ///** Clear the previous unlock request. Subclasses should clear any state they
+ //* set during unlock_vfunc(), such as clearing command queues.
+ //*/
+ //_WRAP_VFUNC(bool unlock_stop(), "unlock_stop")
+
+ ///** Prepare the GstSegment that will be passed to the do_seek_vfunc() vmethod
+ //* for executing a seek request. Sub-classes should override this if they
+ //* support seeking in formats other than the configured native format. By
+ //* default, it tries to convert the seek arguments to the configured native
+ //* format and prepare a segment in that format.
+ //*/
+ //_WRAP_VFUNC(bool prepare_seek_segment(const Glib::RefPtr<Event>& seek, Segment segment), "prepare_seek_segment")
};
} //namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/basetransform.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basetransform.hg (original)
+++ gstreamermm/trunk/gstreamer/src/basetransform.hg Wed Dec 10 05:41:55 2008
@@ -169,6 +169,14 @@
_WRAP_PROPERTY("qos", bool)
+ //TODO: bool vfuncs are a problem because if the base class does not
+ //implement one (which occurs often in GStreamer -- don't know why) the
+ //default generated callback returns false because of the "typedef RType;
+ //return RType()" statements (see discussion about bug #530416 in element.hg
+ //for more). I've filed a patch for the bug which will allow a custom return
+ //to be specified for the callback, in which case the bool vfuncs can be made
+ //to return true which would then work.
+
#m4 _CONVERSION(`Glib::RefPtr<Caps>', `GstCaps*', `($3)->gobj()')
#m4 _CONVERSION(`GstCaps*', `const Glib::RefPtr<Caps>&', `Glib::wrap($3)')
/** Optional. Given the pad in this direction and the given caps, what caps
@@ -181,36 +189,36 @@
*/
_WRAP_VFUNC(void fixate_caps(PadDirection direction, const Glib::RefPtr<Caps>& caps, const Glib::RefPtr<Caps>& othercaps), "fixate_caps")
- /** Optional. Given the size of a buffer in the given direction with the
- * given caps, calculate the size in bytes of a buffer on the other pad with
- * the given other caps. The default implementation uses
- * get_unit_size_vfunc() and keeps the number of units the same.
- */
- _WRAP_VFUNC(bool transform_size(PadDirection direction, const Glib::RefPtr<Caps>& caps, guint size, const Glib::RefPtr<Caps>& othercaps, guint* othersize), "transform_size")
-
- /** Required if the transform is not in-place. Get the size in bytes of one
- * unit for the given caps.
- */
- _WRAP_VFUNC(bool get_unit_size(const Glib::RefPtr<Caps>& caps, guint* size), "get_unit_size")
-
- /** Allows the subclass to be notified of the actual caps set.
- */
- _WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& incaps, const Glib::RefPtr<Caps>& outcaps), "set_caps")
-
- /** Optional. Called when the element starts processing. Allows opening
- * external resources.
- */
- _WRAP_VFUNC(bool start(), "start")
-
- /** Optional. Called when the element stops processing. Allows closing
- * external resources.
- */
- _WRAP_VFUNC(bool stop(), "stop")
-
- /** Optional. Event handler on the sink pad. This function should return TRUE
- * if the base class should forward the event.
- */
- _WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
+ ///** Optional. Given the size of a buffer in the given direction with the
+ //* given caps, calculate the size in bytes of a buffer on the other pad with
+ //* the given other caps. The default implementation uses
+ //* get_unit_size_vfunc() and keeps the number of units the same.
+ //*/
+ //_WRAP_VFUNC(bool transform_size(PadDirection direction, const Glib::RefPtr<Caps>& caps, guint size, const Glib::RefPtr<Caps>& othercaps, guint* othersize), "transform_size")
+
+ ///** Required if the transform is not in-place. Get the size in bytes of one
+ //* unit for the given caps.
+ //*/
+ //_WRAP_VFUNC(bool get_unit_size(const Glib::RefPtr<Caps>& caps, guint* size), "get_unit_size")
+
+ ///** Allows the subclass to be notified of the actual caps set.
+ //*/
+ //_WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Caps>& incaps, const Glib::RefPtr<Caps>& outcaps), "set_caps")
+
+ ///** Optional. Called when the element starts processing. Allows opening
+ //* external resources.
+ //*/
+ //_WRAP_VFUNC(bool start(), "start")
+
+ ///** Optional. Called when the element stops processing. Allows closing
+ //* external resources.
+ //*/
+ //_WRAP_VFUNC(bool stop(), "stop")
+
+ ///** Optional. Event handler on the sink pad. This function should return TRUE
+ //* if the base class should forward the event.
+ //*/
+ //_WRAP_VFUNC(bool event(const Glib::RefPtr<Event>& event), "event")
#m4 _CONVERSION(`GstBuffer*', `const Glib::RefPtr<Buffer>&', `Gst::wrap($3)')
/** Required if the element does not operate in-place. Transforms one
@@ -231,9 +239,9 @@
//#m4 _CONVERSION(`GstBuffer**', `Glib::RefPtr<Buffer>&', `Gst::wrap(*($3))')
//_WRAP_VFUNC(FlowReturn prepare_output_buffer(const Glib::RefPtr<Buffer>& input, int size, const Glib::RefPtr<Caps>& caps, Glib::RefPtr<Buffer>&), "prepare_output_buffer")
- /** Optional. Event handler on the source pad.
- */
- _WRAP_VFUNC(bool src_event(const Glib::RefPtr<Event>& event), "src_event")
+ ///** Optional. Event handler on the source pad.
+ //*/
+ //_WRAP_VFUNC(bool src_event(const Glib::RefPtr<Event>& event), "src_event")
};
} //namespace Gst
Modified: gstreamermm/trunk/tests/Makefile.am
==============================================================================
--- gstreamermm/trunk/tests/Makefile.am (original)
+++ gstreamermm/trunk/tests/Makefile.am Wed Dec 10 05:41:55 2008
@@ -11,7 +11,7 @@
test-create-bus test-taglist test-tagsetter test-pad \
test-init-check test-init test-init-check-noargs \
test-init-noargs test-iterator test-property-caps \
- test-plugin-gen
+ test-plugin-gen test-plugin-signals
#TODO: Add test-ghost-pad to tests when bug #539108 is fixed.
@@ -86,3 +86,6 @@
test_plugin_gen_SOURCES=test-plugin-gen.cc
test_plugin_gen_LDFLAGS= GSTREAMERMM_LIBS@
+
+test_plugin_signals_SOURCES=test-plugin-signals.cc
+test_plugin_signals_LDFLAGS= GSTREAMERMM_LIBS@
Added: gstreamermm/trunk/tests/test-plugin-signals.cc
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/tests/test-plugin-signals.cc Wed Dec 10 05:41:55 2008
@@ -0,0 +1,71 @@
+#include <gstreamermm.h>
+#include <gstreamermm/filesrc.h>
+#include <gstreamermm/fakesink.h>
+#include <iostream>
+
+void on_handoff(const Glib::RefPtr<Gst::Buffer>& buffer,
+ const Glib::RefPtr<Gst::Pad>& pad)
+{
+ std::cout << "Gst::FakeSink's handoff signal triggered." << std::endl <<
+ "Exiting abruptly to stop execution." << std::endl;
+
+ exit(0);
+}
+
+int main(int argc, char* argv[])
+{
+ Gst::init(argc, argv);
+
+ if (argc != 2)
+ {
+ std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
+ return -1;
+ }
+
+ Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create();
+
+ // Create elements:
+ Glib::RefPtr<Gst::Pipeline> pipeline = Gst::Pipeline::create("audio-player");
+ Glib::RefPtr<Gst::FileSrc> source = Gst::FileSrc::create();
+ Glib::RefPtr<Gst::FakeSink> sink = Gst::FakeSink::create();
+
+ if (!pipeline || !source || !sink) {
+ std::cerr << "One element could not be created" << std::endl;
+ return -1;
+ }
+
+ // Set filename property on the file source.
+ source->property_location() = argv[1];
+
+ // Put all elements in a bin:
+ try
+ {
+ pipeline->add(source)->add(sink);
+ }
+ catch(const Glib::Error& ex)
+ {
+ std::cerr << "Error while adding elements to the pipeline: " <<
+ ex.what() << std::endl;
+
+ return -1;
+ }
+
+ // Link together:
+ source->link(sink);
+
+ // Enable the handoff signal emition and connect slot:
+ sink->property_signal_handoffs() = true;
+ sink->signal_handoff().connect(sigc::ptr_fun(on_handoff));
+
+ // Now set to playing and iterate:
+ std::cout << "Setting to PLAYING." << std::endl;
+ pipeline->set_state(Gst::STATE_PLAYING);
+ std::cout << "Running." << std::endl;
+ mainloop->run();
+
+ // Clean up nicely:
+ std::cout << "Returned. Stopping playback." << std::endl;
+ pipeline->set_state(Gst::STATE_NULL);
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]