Re: gstmm add element to pipeline test



Murray Cumming wrote:
On Mon, 2007-12-03 at 23:51 -0500, José Alburquerque wrote:
 Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
 {
-  GstElement* pipeline = gst_pipeline_new(name.c_str());
-  return Glib::wrap((GstPipeline*) pipeline);
+  GstElement* gstPipeline = gst_pipeline_new(name.c_str());
+  Glib::RefPtr<Pipeline> pipeline = Glib::wrap((GstPipeline*)
gstPipeline);
+  Glib::RefPtr<Bus> bus = pipeline->get_bus();
+  gst_bus_add_signal_watch(bus->gobj());
+  bus->unreference();
+  return pipeline;
 }

What is happening here? You should never need to do a manual
reference(). And you should add a comment near the extra
gst_bus_add_signal_watch() because we can't otherwise know what is
happening.

I'm sorry, let me explain: The gst_bus_add_signal_watch() call sort of "enables" the "message" signal of Gst::Bus (see gst_bus_add_signal_watch <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-add-signal-watch>) (I'll add a comment as you say). Without the call, the "message" signal of the bus is never emitted so this call is necessary (I guess).

As you say, it doesn't make sense that an "unreference()" is used, but I stepped through the code and noticed that gst_bus_add_signal_watch() calls gst_bus_add_signal_watch_full() which calls gst_bus_add_watch_full(). This last function (gst_bus_add_watch_full) calls gst_bus_create_watch() which "references()" the bus and does not unreference() it (it appears as if the bus has an "extra" sort of "unneeded?" reference).

I noticed that the Bus was not being "destroyed" at the end of the ogg player program I submitted yesterday because I tried to have a gst_bus_remove_signal_watch() <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-remove-signal-watch> in the Bus destructor and noticed that the destructor was never called. However when I placed the gst_bus_remove_signal_watch() call in the Gst::Pipeline destructor, the pipeline destructor is called because I get the following error when the pipeline destructor is called:

(gstreamer-ogg-player:21179): GStreamer-CRITICAL **: gst_element_get_bus: assertion `GST_IS_ELEMENT (element)' failed

I've attached 3 diffs so you can test: The first has the gst_bus_remove_signal_watch() in the Gst::Bus destructor and does *not* have the "unreference()". This is my output:

[12:16][jose sweety:~/Projects/Programming/C++/Tests]$ g++ -g -o gstreamer-ogg-player `pkg-config --cflags --libs gstmm-1.0` gstreamer-ogg-player.cc [12:18][jose sweety:~/Projects/Programming/C++/Tests]$ ./gstreamer-ogg-player /usr/share/gnome-games/sounds/land.ogg
Setting to PLAYING.
Running.
Dynamic pad created, linking parser/decoder.
End of stream
Returned, stopping playback.
[12:18][jose sweety:~/Projects/Programming/C++/Tests]$


The second diff still has the gst_bus_remove_signal_watch() in Gst::Bus::~Bus() but the "unreference()" is added. This the output:

[12:18][jose sweety:~/Projects/Programming/C++/Tests]$ g++ -g -o gstreamer-ogg-player `pkg-config --cflags --libs gstmm-1.0` gstreamer-ogg-player.cc [12:27][jose sweety:~/Projects/Programming/C++/Tests]$ ./gstreamer-ogg-player /usr/share/gnome-games/sounds/land.ogg
Setting to PLAYING.
Running.
Dynamic pad created, linking parser/decoder.
End of stream
Returned, stopping playback.

(gstreamer-ogg-player:6708): GStreamer-CRITICAL **: gst_bus_remove_signal_watch: assertion `GST_IS_BUS (bus)' failed
[12:27][jose sweety:~/Projects/Programming/C++/Tests]$

The last diff has the gst_bus_remove_signal_watch() in the Gst::Pipeline destructor (without the unreference()) and here is the output:

[12:27][jose sweety:~/Projects/Programming/C++/Tests]$ g++ -g -o gstreamer-ogg-player `pkg-config --cflags --libs gstmm-1.0` gstreamer-ogg-player.cc [12:33][jose sweety:~/Projects/Programming/C++/Tests]$ ./gstreamer-ogg-player /usr/share/gnome-games/sounds/land.ogg
Setting to PLAYING.
Running.
Dynamic pad created, linking parser/decoder.
End of stream
Returned, stopping playback.

(gstreamer-ogg-player:13686): GStreamer-CRITICAL **: gst_element_get_bus: assertion `GST_IS_ELEMENT (element)' failed
Segmentation fault
[12:33][jose sweety:~/Projects/Programming/C++/Tests]$

Am I going about this the wrong way?  What do you think?  Thanks.

-Jose
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 95)
+++ ChangeLog	(working copy)
@@ -1,3 +1,18 @@
+2007-12-03  José Alburquerque  <jaalburquerque yahoo com>
+
+	* gst/src/bus.hg: added signal "message"
+	* gst/src/gst_signals.defs: sync-message and message had wrong
+	parameter type (GstMessage instead of GstMessage*)
+	* gst/src/message.hg: changed get_type() to be public
+	* gst/src/pipeline.ccg: modified Gst::Pipeline::create() to call
+	gst_bus_add_signal_watch() so Bus transmits "message" signal
+	* tests/Makefile.am: modified to include test-create-bin
+	* tests/test-create-bin.cc: added this test to create a bin and add
+	elements to it (to "catch" errors as API changes)
+	* tests/test-link-elements.cc: Removed a blank line
+	* tools/m4/convert_gst.m4: Added conversion from GstMessageType to
+	Gst::MessageType (for Gst::Message::get_type())
+
 2007-12-03  Murray Cumming  <murrayc murrayc com>
 
 	* gst/src/element.ccg: get_compatible_pad((): Clarify 
Index: gst/src/gst_signals.defs
===================================================================
--- gst/src/gst_signals.defs	(revision 95)
+++ gst/src/gst_signals.defs	(working copy)
@@ -5,7 +5,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
@@ -14,7 +14,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
Index: gst/src/pipeline.ccg
===================================================================
--- gst/src/pipeline.ccg	(revision 95)
+++ gst/src/pipeline.ccg	(working copy)
@@ -5,8 +5,11 @@
 
 Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
 {
-  GstElement* pipeline = gst_pipeline_new(name.c_str());
-  return Glib::wrap((GstPipeline*) pipeline);
+  GstElement* gstPipeline = gst_pipeline_new(name.c_str());
+  Glib::RefPtr<Pipeline> pipeline = Glib::wrap((GstPipeline*) gstPipeline);
+  Glib::RefPtr<Bus> bus = pipeline->get_bus();
+  gst_bus_add_signal_watch(bus->gobj());
+  return pipeline;
 }
 
 } //namespace Gst
Index: gst/src/message.hg
===================================================================
--- gst/src/message.hg	(revision 95)
+++ gst/src/message.hg	(working copy)
@@ -138,9 +138,11 @@
       _CLASS_OPAQUE_REFCOUNTED(Message, GstMessage, NONE, gst_message_ref, gst_message_unref)
       _IGNORE(gst_message_ref, gst_message_unref)
 
-      MessageType get_type();
       const Structure& get_structure();
 
+    public:
+      _MEMBER_GET(type, type, MessageType, GstMessageType)
+
     protected: 
 
       GstMessage * cobj_;
Index: gst/src/bus.ccg
===================================================================
--- gst/src/bus.ccg	(revision 95)
+++ gst/src/bus.ccg	(working copy)
@@ -8,4 +8,8 @@
   return Glib::wrap(bus, false);
 }
 
+Bus::~Bus() {
+  gst_bus_remove_signal_watch(gobj());
+}
+
 } //namespace Gst
Index: gst/src/bus.hg
===================================================================
--- gst/src/bus.hg	(revision 95)
+++ gst/src/bus.hg	(working copy)
@@ -13,13 +13,12 @@
 class Bus : public Object
 {
   _CLASS_GOBJECT(Bus, GstBus, GST_BUS, Object, GstObject)
+  _CUSTOM_DTOR
 
 protected:
-
   _CTOR_DEFAULT()
 
 public:
-
   static Glib::RefPtr<Bus> create();
   _WRAP_METHOD(bool post(const Glib::RefPtr<Message>& message), gst_bus_post)
   _WRAP_METHOD(bool have_pending() const, gst_bus_have_pending)
@@ -36,7 +35,7 @@
   _WRAP_METHOD(void enable_sync_message_emission(), gst_bus_enable_sync_message_emission)
 
 #m4 _CONVERSION(`GstMessage*',`const Glib::RefPtr<Message>&', `Glib::wrap($3, true)')
-  //TODO: _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
+  _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
   //TODO: _WRAP_SIGNAL(void sync_message(const Glib::RefPtr<Message>& message), "sync-message")
 };
 
Index: tools/m4/convert_gst.m4
===================================================================
--- tools/m4/convert_gst.m4	(revision 95)
+++ tools/m4/convert_gst.m4	(working copy)
@@ -55,6 +55,7 @@
 _CONVERSION(`const gint64&',`gint64',`$3')
 _CONVERSION(`gint64&',`gint64*',`&($3)')
 _CONVERSION(`const double&',`gdouble',`$3')
+_CONVERSION(`GstMessageType',`MessageType',`MessageType($3)')
 
 _CONV_ENUM(Gst,State)
 _CONV_ENUM(Gst,StateChangeReturn)
Index: tests/test-link-elements.cc
===================================================================
--- tests/test-link-elements.cc	(revision 95)
+++ tests/test-link-elements.cc	(working copy)
@@ -8,7 +8,6 @@
   Glib::RefPtr<Gst::Pipeline> pipeline;
   Glib::RefPtr<Gst::Element> source, filter, sink;
 
-
   pipeline = Gst::Pipeline::create("my-pipeline");
 
   source = Gst::Element::create("fakesrc", "source");
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 95)
+++ tests/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 LDADD=$(top_builddir)/gst/gstmm/libgstmm-1.0.la
 
-noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements
+noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements test-create-bin
 
 test_create_element_SOURCES=test-create-element.cc
 test_create_element_LDFLAGS= GSTMM_LIBS@
@@ -13,6 +13,9 @@
 test_link_elements_SOURCES=test-link-elements.cc
 test_link_elements_LDFLAGS= GSTMM_LIBS@
 
+test_create_bin_SOURCES=test-create-bin.cc
+test_create_bin_LDFLAGS= GSTMM_LIBS@
+
 #runtestbasic runtestlangs \
 #runtestsearch runtestmimetypes \
 #runtestgetbuffer
Index: tests/test-create-bin.cc
===================================================================
--- tests/test-create-bin.cc	(revision 0)
+++ tests/test-create-bin.cc	(revision 0)
@@ -0,0 +1,26 @@
+#include <gstmm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+  Gst::init(argc, argv);
+
+  Glib::RefPtr<Gst::Pipeline> pipeline;
+  Glib::RefPtr<Gst::Bin> bin;
+  Glib::RefPtr<Gst::Element> source, sink;
+
+  pipeline = Gst::Pipeline::create("my-pipeline");
+  bin = Gst::Bin::create("my-bin");
+
+  source = Gst::Element::create("fakesrc", "source");
+  sink = Gst::Element::create("fakesink", "sink");
+
+  bin->add(source)->add(sink);
+
+  pipeline->add(bin);
+  source->link(sink);
+
+  std::cout << "Successfully added elements '" << source->get_name() <<
+    "' and '" << sink->get_name() << "' to bin '" <<
+      bin->get_name() << "'." << std::endl;
+}
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 95)
+++ ChangeLog	(working copy)
@@ -1,3 +1,18 @@
+2007-12-03  José Alburquerque  <jaalburquerque yahoo com>
+
+	* gst/src/bus.hg: added signal "message"
+	* gst/src/gst_signals.defs: sync-message and message had wrong
+	parameter type (GstMessage instead of GstMessage*)
+	* gst/src/message.hg: changed get_type() to be public
+	* gst/src/pipeline.ccg: modified Gst::Pipeline::create() to call
+	gst_bus_add_signal_watch() so Bus transmits "message" signal
+	* tests/Makefile.am: modified to include test-create-bin
+	* tests/test-create-bin.cc: added this test to create a bin and add
+	elements to it (to "catch" errors as API changes)
+	* tests/test-link-elements.cc: Removed a blank line
+	* tools/m4/convert_gst.m4: Added conversion from GstMessageType to
+	Gst::MessageType (for Gst::Message::get_type())
+
 2007-12-03  Murray Cumming  <murrayc murrayc com>
 
 	* gst/src/element.ccg: get_compatible_pad((): Clarify 
Index: gst/src/gst_signals.defs
===================================================================
--- gst/src/gst_signals.defs	(revision 95)
+++ gst/src/gst_signals.defs	(working copy)
@@ -5,7 +5,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
@@ -14,7 +14,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
Index: gst/src/pipeline.ccg
===================================================================
--- gst/src/pipeline.ccg	(revision 95)
+++ gst/src/pipeline.ccg	(working copy)
@@ -5,8 +5,12 @@
 
 Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
 {
-  GstElement* pipeline = gst_pipeline_new(name.c_str());
-  return Glib::wrap((GstPipeline*) pipeline);
+  GstElement* gstPipeline = gst_pipeline_new(name.c_str());
+  Glib::RefPtr<Pipeline> pipeline = Glib::wrap((GstPipeline*) gstPipeline);
+  Glib::RefPtr<Bus> bus = pipeline->get_bus();
+  gst_bus_add_signal_watch(bus->gobj());
+  bus->unreference();
+  return pipeline;
 }
 
 } //namespace Gst
Index: gst/src/message.hg
===================================================================
--- gst/src/message.hg	(revision 95)
+++ gst/src/message.hg	(working copy)
@@ -138,9 +138,11 @@
       _CLASS_OPAQUE_REFCOUNTED(Message, GstMessage, NONE, gst_message_ref, gst_message_unref)
       _IGNORE(gst_message_ref, gst_message_unref)
 
-      MessageType get_type();
       const Structure& get_structure();
 
+    public:
+      _MEMBER_GET(type, type, MessageType, GstMessageType)
+
     protected: 
 
       GstMessage * cobj_;
Index: gst/src/bus.ccg
===================================================================
--- gst/src/bus.ccg	(revision 95)
+++ gst/src/bus.ccg	(working copy)
@@ -8,4 +8,8 @@
   return Glib::wrap(bus, false);
 }
 
+Bus::~Bus() {
+  gst_bus_remove_signal_watch(gobj());
+}
+
 } //namespace Gst
Index: gst/src/bus.hg
===================================================================
--- gst/src/bus.hg	(revision 95)
+++ gst/src/bus.hg	(working copy)
@@ -13,13 +13,12 @@
 class Bus : public Object
 {
   _CLASS_GOBJECT(Bus, GstBus, GST_BUS, Object, GstObject)
+  _CUSTOM_DTOR
 
 protected:
-
   _CTOR_DEFAULT()
 
 public:
-
   static Glib::RefPtr<Bus> create();
   _WRAP_METHOD(bool post(const Glib::RefPtr<Message>& message), gst_bus_post)
   _WRAP_METHOD(bool have_pending() const, gst_bus_have_pending)
@@ -36,7 +35,7 @@
   _WRAP_METHOD(void enable_sync_message_emission(), gst_bus_enable_sync_message_emission)
 
 #m4 _CONVERSION(`GstMessage*',`const Glib::RefPtr<Message>&', `Glib::wrap($3, true)')
-  //TODO: _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
+  _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
   //TODO: _WRAP_SIGNAL(void sync_message(const Glib::RefPtr<Message>& message), "sync-message")
 };
 
Index: tools/m4/convert_gst.m4
===================================================================
--- tools/m4/convert_gst.m4	(revision 95)
+++ tools/m4/convert_gst.m4	(working copy)
@@ -55,6 +55,7 @@
 _CONVERSION(`const gint64&',`gint64',`$3')
 _CONVERSION(`gint64&',`gint64*',`&($3)')
 _CONVERSION(`const double&',`gdouble',`$3')
+_CONVERSION(`GstMessageType',`MessageType',`MessageType($3)')
 
 _CONV_ENUM(Gst,State)
 _CONV_ENUM(Gst,StateChangeReturn)
Index: tests/test-link-elements.cc
===================================================================
--- tests/test-link-elements.cc	(revision 95)
+++ tests/test-link-elements.cc	(working copy)
@@ -8,7 +8,6 @@
   Glib::RefPtr<Gst::Pipeline> pipeline;
   Glib::RefPtr<Gst::Element> source, filter, sink;
 
-
   pipeline = Gst::Pipeline::create("my-pipeline");
 
   source = Gst::Element::create("fakesrc", "source");
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 95)
+++ tests/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 LDADD=$(top_builddir)/gst/gstmm/libgstmm-1.0.la
 
-noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements
+noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements test-create-bin
 
 test_create_element_SOURCES=test-create-element.cc
 test_create_element_LDFLAGS= GSTMM_LIBS@
@@ -13,6 +13,9 @@
 test_link_elements_SOURCES=test-link-elements.cc
 test_link_elements_LDFLAGS= GSTMM_LIBS@
 
+test_create_bin_SOURCES=test-create-bin.cc
+test_create_bin_LDFLAGS= GSTMM_LIBS@
+
 #runtestbasic runtestlangs \
 #runtestsearch runtestmimetypes \
 #runtestgetbuffer
Index: tests/test-create-bin.cc
===================================================================
--- tests/test-create-bin.cc	(revision 0)
+++ tests/test-create-bin.cc	(revision 0)
@@ -0,0 +1,26 @@
+#include <gstmm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+  Gst::init(argc, argv);
+
+  Glib::RefPtr<Gst::Pipeline> pipeline;
+  Glib::RefPtr<Gst::Bin> bin;
+  Glib::RefPtr<Gst::Element> source, sink;
+
+  pipeline = Gst::Pipeline::create("my-pipeline");
+  bin = Gst::Bin::create("my-bin");
+
+  source = Gst::Element::create("fakesrc", "source");
+  sink = Gst::Element::create("fakesink", "sink");
+
+  bin->add(source)->add(sink);
+
+  pipeline->add(bin);
+  source->link(sink);
+
+  std::cout << "Successfully added elements '" << source->get_name() <<
+    "' and '" << sink->get_name() << "' to bin '" <<
+      bin->get_name() << "'." << std::endl;
+}
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 95)
+++ ChangeLog	(working copy)
@@ -1,3 +1,18 @@
+2007-12-03  José Alburquerque  <jaalburquerque yahoo com>
+
+	* gst/src/bus.hg: added signal "message"
+	* gst/src/gst_signals.defs: sync-message and message had wrong
+	parameter type (GstMessage instead of GstMessage*)
+	* gst/src/message.hg: changed get_type() to be public
+	* gst/src/pipeline.ccg: modified Gst::Pipeline::create() to call
+	gst_bus_add_signal_watch() so Bus transmits "message" signal
+	* tests/Makefile.am: modified to include test-create-bin
+	* tests/test-create-bin.cc: added this test to create a bin and add
+	elements to it (to "catch" errors as API changes)
+	* tests/test-link-elements.cc: Removed a blank line
+	* tools/m4/convert_gst.m4: Added conversion from GstMessageType to
+	Gst::MessageType (for Gst::Message::get_type())
+
 2007-12-03  Murray Cumming  <murrayc murrayc com>
 
 	* gst/src/element.ccg: get_compatible_pad((): Clarify 
Index: gst/src/gst_signals.defs
===================================================================
--- gst/src/gst_signals.defs	(revision 95)
+++ gst/src/gst_signals.defs	(working copy)
@@ -5,7 +5,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
@@ -14,7 +14,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstMessage" "p0")
+    '("GstMessage*" "p0")
   )
 )
 
Index: gst/src/pipeline.ccg
===================================================================
--- gst/src/pipeline.ccg	(revision 95)
+++ gst/src/pipeline.ccg	(working copy)
@@ -5,8 +5,15 @@
 
 Glib::RefPtr<Pipeline> Pipeline::create(const std::string& name)
 {
-  GstElement* pipeline = gst_pipeline_new(name.c_str());
-  return Glib::wrap((GstPipeline*) pipeline);
+  GstElement* gstPipeline = gst_pipeline_new(name.c_str());
+  Glib::RefPtr<Pipeline> pipeline = Glib::wrap((GstPipeline*) gstPipeline);
+  Glib::RefPtr<Bus> bus = pipeline->get_bus();
+  gst_bus_add_signal_watch(bus->gobj());
+  return pipeline;
 }
 
+Pipeline::~Pipeline() {
+  gst_bus_remove_signal_watch(get_bus()->gobj());
+}
+
 } //namespace Gst
Index: gst/src/pipeline.hg
===================================================================
--- gst/src/pipeline.hg	(revision 95)
+++ gst/src/pipeline.hg	(working copy)
@@ -12,6 +12,7 @@
 class Pipeline : public Bin 
 {
   _CLASS_GOBJECT(Pipeline, GstPipeline, GST_PIPELINE, Bin, GstBin)
+  _CUSTOM_DTOR
 
 protected:
 
Index: gst/src/message.hg
===================================================================
--- gst/src/message.hg	(revision 95)
+++ gst/src/message.hg	(working copy)
@@ -138,9 +138,11 @@
       _CLASS_OPAQUE_REFCOUNTED(Message, GstMessage, NONE, gst_message_ref, gst_message_unref)
       _IGNORE(gst_message_ref, gst_message_unref)
 
-      MessageType get_type();
       const Structure& get_structure();
 
+    public:
+      _MEMBER_GET(type, type, MessageType, GstMessageType)
+
     protected: 
 
       GstMessage * cobj_;
Index: gst/src/bus.hg
===================================================================
--- gst/src/bus.hg	(revision 95)
+++ gst/src/bus.hg	(working copy)
@@ -15,11 +15,9 @@
   _CLASS_GOBJECT(Bus, GstBus, GST_BUS, Object, GstObject)
 
 protected:
-
   _CTOR_DEFAULT()
 
 public:
-
   static Glib::RefPtr<Bus> create();
   _WRAP_METHOD(bool post(const Glib::RefPtr<Message>& message), gst_bus_post)
   _WRAP_METHOD(bool have_pending() const, gst_bus_have_pending)
@@ -36,7 +34,7 @@
   _WRAP_METHOD(void enable_sync_message_emission(), gst_bus_enable_sync_message_emission)
 
 #m4 _CONVERSION(`GstMessage*',`const Glib::RefPtr<Message>&', `Glib::wrap($3, true)')
-  //TODO: _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
+  _WRAP_SIGNAL(void message(const Glib::RefPtr<Message>& message), "message")
   //TODO: _WRAP_SIGNAL(void sync_message(const Glib::RefPtr<Message>& message), "sync-message")
 };
 
Index: tools/m4/convert_gst.m4
===================================================================
--- tools/m4/convert_gst.m4	(revision 95)
+++ tools/m4/convert_gst.m4	(working copy)
@@ -55,6 +55,7 @@
 _CONVERSION(`const gint64&',`gint64',`$3')
 _CONVERSION(`gint64&',`gint64*',`&($3)')
 _CONVERSION(`const double&',`gdouble',`$3')
+_CONVERSION(`GstMessageType',`MessageType',`MessageType($3)')
 
 _CONV_ENUM(Gst,State)
 _CONV_ENUM(Gst,StateChangeReturn)
Index: tests/test-link-elements.cc
===================================================================
--- tests/test-link-elements.cc	(revision 95)
+++ tests/test-link-elements.cc	(working copy)
@@ -8,7 +8,6 @@
   Glib::RefPtr<Gst::Pipeline> pipeline;
   Glib::RefPtr<Gst::Element> source, filter, sink;
 
-
   pipeline = Gst::Pipeline::create("my-pipeline");
 
   source = Gst::Element::create("fakesrc", "source");
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 95)
+++ tests/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 LDADD=$(top_builddir)/gst/gstmm/libgstmm-1.0.la
 
-noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements
+noinst_PROGRAMS = test-create-element test-pipeline-add-element test-link-elements test-create-bin
 
 test_create_element_SOURCES=test-create-element.cc
 test_create_element_LDFLAGS= GSTMM_LIBS@
@@ -13,6 +13,9 @@
 test_link_elements_SOURCES=test-link-elements.cc
 test_link_elements_LDFLAGS= GSTMM_LIBS@
 
+test_create_bin_SOURCES=test-create-bin.cc
+test_create_bin_LDFLAGS= GSTMM_LIBS@
+
 #runtestbasic runtestlangs \
 #runtestsearch runtestmimetypes \
 #runtestgetbuffer
Index: tests/test-create-bin.cc
===================================================================
--- tests/test-create-bin.cc	(revision 0)
+++ tests/test-create-bin.cc	(revision 0)
@@ -0,0 +1,26 @@
+#include <gstmm.h>
+#include <iostream>
+
+int main (int argc, char* argv[])
+{
+  Gst::init(argc, argv);
+
+  Glib::RefPtr<Gst::Pipeline> pipeline;
+  Glib::RefPtr<Gst::Bin> bin;
+  Glib::RefPtr<Gst::Element> source, sink;
+
+  pipeline = Gst::Pipeline::create("my-pipeline");
+  bin = Gst::Bin::create("my-bin");
+
+  source = Gst::Element::create("fakesrc", "source");
+  sink = Gst::Element::create("fakesink", "sink");
+
+  bin->add(source)->add(sink);
+
+  pipeline->add(bin);
+  source->link(sink);
+
+  std::cout << "Successfully added elements '" << source->get_name() <<
+    "' and '" << sink->get_name() << "' to bin '" <<
+      bin->get_name() << "'." << std::endl;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]