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



Author: jaalburqu
Date: Mon Jun 23 19:30:24 2008
New Revision: 1582
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1582&view=rev

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

	* gstreamer/gstreamermm/init.cc: Added comment about Gst::wrap_init()
	in Gst::init_check();
	* gstreamer/src/bin.ccg: Removed extra referencing code in
	Gst::Bin::add() because warning by running tests/gst-test-bin (which
	is not issued with extra ref. code) is caused by GStreamer putting
	private code in gst_bin_new() instead of putting it in a class _init()
	function. Filed bug #539805 about this.
	* gstreamer/src/padtemplate.ccg:
	* gstreamer/src/padtemplate.hg: Used custom constructor with
	_CONSTRUCT for Gst::PadTemplate because gst_pad_template_new() has
	different construction parameters than those of the call to
	g_object_new().  It also has extra code that should probably be in a
	class _init() method. Filed bug #539772 about this.
	* tests/test-pad.cc: Began writing general pad test.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm/init.cc
   gstreamermm/trunk/gstreamer/src/bin.ccg
   gstreamermm/trunk/gstreamer/src/padtemplate.ccg
   gstreamermm/trunk/gstreamer/src/padtemplate.hg
   gstreamermm/trunk/tests/test-pad.cc

Modified: gstreamermm/trunk/gstreamer/gstreamermm/init.cc
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/init.cc	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/init.cc	Mon Jun 23 19:30:24 2008
@@ -74,6 +74,7 @@
 
   if(!s_init)
   {
+    //For Glib::wrap(), for Glib::Object-derived classes.
     Gst::wrap_init();
 
     //For Gst::wrap(), for Gst::MiniObject-derived classes.

Modified: gstreamermm/trunk/gstreamer/src/bin.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/bin.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/bin.ccg	Mon Jun 23 19:30:24 2008
@@ -37,14 +37,7 @@
   // If addition successful, return RefPtr<..> to this bin, otherwise return
   // NULL RefPtr<...>
   if(result)
-  {
-    // When adding an element to a bin, an extra ref is needed because bin
-    // takes ownership of element and wants to unref the element itself when
-    // the bin is destroyed.
-    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	Mon Jun 23 19:30:24 2008
@@ -25,3 +25,12 @@
 
 _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	Mon Jun 23 19:30:24 2008
@@ -64,21 +64,31 @@
   _CLASS_GOBJECT(PadTemplate, GstPadTemplate, GST_PAD_TEMPLATE, Object, GstObject)
 
 protected:
-  _WRAP_CTOR(PadTemplate(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps), gst_pad_template_new)
+  /** 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);
 
 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_template The name template.
+   * @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.
    */
-  _WRAP_CREATE(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr<Caps>& caps)
+  _WRAP_CREATE(const Glib::ustring& name, 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-pad.cc
==============================================================================
--- gstreamermm/trunk/tests/test-pad.cc	(original)
+++ gstreamermm/trunk/tests/test-pad.cc	Mon Jun 23 19:30:24 2008
@@ -26,15 +26,23 @@
 {
   Gst::init(argc, argv);
 
-  Glib::RefPtr<Gst::Pad> pad;
+  Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw-yuv");
+  caps->set_simple("width", 500);
+  caps->set_simple("framerate", Gst::Fraction(25, 1));
 
-  pad = Gst::Pad::create("test", Gst::PAD_SRC);
+  Glib::RefPtr<Gst::PadTemplate> templ =
+    Gst::PadTemplate::create("source-template", Gst::PAD_SRC, Gst::PAD_ALWAYS,
+      caps);
 
-  if (pad)
-  {
-    std::cout << "Successfully created pad '" << pad->get_name() << "'." <<
+  if (templ)
+    std::cout << "Successfully created pad template '" << templ->get_name() <<
+      "'; direction = " <<  templ->get_direction() << "." << std::endl;
+
+  Glib::RefPtr<Gst::Pad> pad1 = Gst::Pad::create("test", Gst::PAD_SRC);
+
+  if (pad1)
+    std::cout << "Successfully created pad '" << pad1->get_name() << "'." <<
       std::endl;
-  }
 
   return 0;
 }



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