gnomemm r1585 - in gstreamermm/trunk: . gstreamer/src tests



Author: jaalburqu
Date: Tue Jun 24 17:28:37 2008
New Revision: 1585
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1585&view=rev

Log:
2008-06-24  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/bin.ccg: Had to re-add the extra referencing code when
	adding Gst::Bin's to a Gst::Bin.  I thought that this referencing
	problem was caused by bug #539805 but that report was rejected so the
	extra reference is necessary to avoid error when child bin is
	destroyed before parent bin is.

	* gstreamer/src/padtemplate.ccg:
	* gstreamer/src/padtemplate.hg: Used _WRAP_CTOR to wrap constructor
	with construction properties "name-template", "direction", "presence"
	and "caps".  According to bug #539772 it looks like the GStreamer
	developers will be making gst_pad_template_new() work with these
	construction properties. Creating Gst::PadTemplates will still provide
	missing construction properties warnings, but when GStreamer patch is
	applied warnings will be gone and Gst::PadTemplate creation will work
	correctly.
	* tests/test-pad.cc: Modified test to use
	Gst::PadTemplate::get_template_name() instead of
	Gst::PadTemplate::get_name() and print pad directions (to ensure pad
	was created correctly).

	* tests/test-create-bus.cc:
	* tests/test-create-element.cc:
	* tests/test-ghost-pad.cc:
	* tests/test-interface.cc:
	* tests/test-link-elements.cc:
	* tests/test-pipeline-add-element.cc: Added missing main() return
	statements and corrected w/s.

	* gstreamer/src/basesrc.ccg: Removed unused namespace definition.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/basesrc.ccg
   gstreamermm/trunk/gstreamer/src/bin.ccg
   gstreamermm/trunk/gstreamer/src/padtemplate.ccg
   gstreamermm/trunk/gstreamer/src/padtemplate.hg
   gstreamermm/trunk/tests/test-create-bus.cc
   gstreamermm/trunk/tests/test-create-element.cc
   gstreamermm/trunk/tests/test-ghost-pad.cc
   gstreamermm/trunk/tests/test-interface.cc
   gstreamermm/trunk/tests/test-link-elements.cc
   gstreamermm/trunk/tests/test-pad.cc
   gstreamermm/trunk/tests/test-pipeline-add-element.cc

Modified: gstreamermm/trunk/gstreamer/src/basesrc.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesrc.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesrc.ccg	Tue Jun 24 17:28:37 2008
@@ -23,8 +23,3 @@
 
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(gstreamermm/private/element_p.h)
-
-namespace Gst
-{
-} //namespace Gst
-

Modified: gstreamermm/trunk/gstreamer/src/bin.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/bin.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/bin.ccg	Tue Jun 24 17:28:37 2008
@@ -37,7 +37,15 @@
   // If addition successful, return RefPtr<..> to this bin, otherwise return
   // NULL RefPtr<...>
   if(result)
-    return Glib::wrap(gobj(), true);
+   {
+     // When adding bins to a bin/pipeline (yes this is possible), an extra ref
+     // is needed because parent bin takes ownership of element and wants to
+     // unref the child bin itself when the parent bin is destroyed.
+     if (GST_IS_BIN(element->gobj()))
+       element->reference();
+
+      return Glib::wrap(gobj(), true);
+   }
   else
     throw std::runtime_error("Failed to add " + element->get_name() + " element");
 }

Modified: gstreamermm/trunk/gstreamer/src/padtemplate.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/padtemplate.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/padtemplate.ccg	Tue Jun 24 17:28:37 2008
@@ -25,12 +25,3 @@
 
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(gstreamermm/private/object_p.h)
-
-namespace Gst
-{
-
-PadTemplate::PadTemplate(const Glib::ustring& name, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
-  : _CONSTRUCT("name", name.c_str())
-{}
-
-} // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/padtemplate.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/padtemplate.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/padtemplate.hg	Tue Jun 24 17:28:37 2008
@@ -64,31 +64,21 @@
   _CLASS_GOBJECT(PadTemplate, GstPadTemplate, GST_PAD_TEMPLATE, Object, GstObject)
 
 protected:
-  /** Creates a new pad template with a name according to the given template
-   * and with the given arguments. This functions takes ownership of the
-   * provided caps, so be sure to not use them afterwards.
-   * @param name The name template.
-   * @param direction The Gst::PadDirection of the template.
-   * @param presence The Gst::PadPresence of the pad.
-   * @param caps A Gst::Caps set for the template. The caps are taken ownership
-   * of. 
-   * @return A new Gst::PadTemplate.
-   */
-  PadTemplate(const Glib::ustring& name, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps);
+  _WRAP_CTOR(PadTemplate(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps), gst_pad_template_new)
 
 public:
   /** Creates a new pad template with a name according to the given template
    * and with the given arguments. This functions takes ownership of the
    * provided caps, so be sure to not use them afterwards.
    *
-   * @param name The name template.
+   * @param name_template The name template.
    * @param direction The Gst::PadDirection of the template.
    * @param presence The Gst::PadPresence of the pad.
    * @param caps A Gst::Caps set for the template. The caps are taken ownership
    * of.
    * @return A new Gst::PadTemplate.
    */
-  _WRAP_CREATE(const Glib::ustring& name, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
+  _WRAP_CREATE(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
 
   _WRAP_METHOD(Glib::RefPtr<Caps> get_caps(), gst_pad_template_get_caps)
   _WRAP_METHOD(Glib::RefPtr<const Caps> get_caps() const, gst_pad_template_get_caps, constversion)

Modified: gstreamermm/trunk/tests/test-create-bus.cc
==============================================================================
--- gstreamermm/trunk/tests/test-create-bus.cc	(original)
+++ gstreamermm/trunk/tests/test-create-bus.cc	Tue Jun 24 17:28:37 2008
@@ -30,4 +30,6 @@
 
   if(bus)
     std::cout << "Successfully created gst bus." << std::endl;
+
+  return 0;
 }

Modified: gstreamermm/trunk/tests/test-create-element.cc
==============================================================================
--- gstreamermm/trunk/tests/test-create-element.cc	(original)
+++ gstreamermm/trunk/tests/test-create-element.cc	Tue Jun 24 17:28:37 2008
@@ -31,4 +31,6 @@
   if(element)
     std::cout << "Successfully created gst element '" <<
       element->get_name() << "'." << std::endl;
+
+  return 0;
 }

Modified: gstreamermm/trunk/tests/test-ghost-pad.cc
==============================================================================
--- gstreamermm/trunk/tests/test-ghost-pad.cc	(original)
+++ gstreamermm/trunk/tests/test-ghost-pad.cc	Tue Jun 24 17:28:37 2008
@@ -25,9 +25,13 @@
 int main (int argc, char* argv[])
 {
   Gst::init (argc, argv);
+
   Glib::RefPtr<Gst::GhostPad> gpad
     = Gst::GhostPad::create ("gpad", Gst::PAD_SINK);
+
   std::cout << "direction " << gpad->get_direction() << std::endl;
+
   // gpad->reference();
+
   return 0;
 }

Modified: gstreamermm/trunk/tests/test-interface.cc
==============================================================================
--- gstreamermm/trunk/tests/test-interface.cc	(original)
+++ gstreamermm/trunk/tests/test-interface.cc	Tue Jun 24 17:28:37 2008
@@ -70,4 +70,6 @@
     // Use interface methods
     xoverlay->handle_events(false);
   }
+
+  return 0;
 }

Modified: gstreamermm/trunk/tests/test-link-elements.cc
==============================================================================
--- gstreamermm/trunk/tests/test-link-elements.cc	(original)
+++ gstreamermm/trunk/tests/test-link-elements.cc	Tue Jun 24 17:28:37 2008
@@ -41,4 +41,6 @@
   std::cout << "Successfully linked elements '" << source->get_name() <<
     "', '" << filter->get_name() << "' and '" << sink->get_name() <<
       "'." << std::endl;
+
+  return 0;
 }

Modified: gstreamermm/trunk/tests/test-pad.cc
==============================================================================
--- gstreamermm/trunk/tests/test-pad.cc	(original)
+++ gstreamermm/trunk/tests/test-pad.cc	Tue Jun 24 17:28:37 2008
@@ -35,14 +35,15 @@
       caps);
 
   if (templ)
-    std::cout << "Successfully created pad template '" << templ->get_name() <<
-      "'; direction = " <<  templ->get_direction() << "." << std::endl;
+    std::cout << "Successfully created pad template '" <<
+      templ->get_name_template() << "'; direction = " << 
+        templ->get_direction() << "." << std::endl;
 
-  Glib::RefPtr<Gst::Pad> pad1 = Gst::Pad::create("test", Gst::PAD_SRC);
+  Glib::RefPtr<Gst::Pad> pad1 = Gst::Pad::create("pad1", Gst::PAD_SINK);
 
   if (pad1)
-    std::cout << "Successfully created pad '" << pad1->get_name() << "'." <<
-      std::endl;
+    std::cout << "Successfully created pad '" << pad1->get_name() <<
+      "'; direction = " << pad1->get_direction() << "." << std::endl;
 
   return 0;
 }

Modified: gstreamermm/trunk/tests/test-pipeline-add-element.cc
==============================================================================
--- gstreamermm/trunk/tests/test-pipeline-add-element.cc	(original)
+++ gstreamermm/trunk/tests/test-pipeline-add-element.cc	Tue Jun 24 17:28:37 2008
@@ -36,4 +36,6 @@
   if (sourceCopy)
     std::cout << "Successfully added element '" << sourceCopy->get_name() <<
      "' to pipeline '" << pipeline->get_name() << "'." << std::endl;
+
+  return 0;
 }



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