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



Author: jaalburqu
Date: Wed Sep 17 01:14:40 2008
New Revision: 1701
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1701&view=rev

Log:
2008-09-16  Josà Alburquerque  <jaalburqu svn gnome org>

	* gstreamer/src/caps.ccg:
	* gstreamer/src/caps.hg: Added template specialization Glib::Value<
	Glib::RefPtr<Gst::Caps> > so that Glib::ObjectBase::set_property()
	doesn't fail when setting the "caps" property of certain GStreamer
	elements such as `multifilesrc' (from gst-plugins-good); also added
	Gst::Caps::get_type() without which the specialization could not
	compile.
	* tests/Makefile.am:
	* tests/test-property-caps.cc: Added "caps" property setting test for
	compile verification.

	Should fix bug #552305.

Added:
   gstreamermm/trunk/tests/test-property-caps.cc
Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/caps.ccg
   gstreamermm/trunk/gstreamer/src/caps.hg
   gstreamermm/trunk/tests/Makefile.am

Modified: gstreamermm/trunk/gstreamer/src/caps.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/caps.ccg	Wed Sep 17 01:14:40 2008
@@ -25,6 +25,11 @@
 namespace Gst
 {
 
+GType Caps::get_type()
+{
+  return gst_caps_get_type();
+}
+
 Glib::RefPtr<Caps> Caps::create_any()
 {
   return Glib::wrap(gst_caps_new_any());
@@ -113,3 +118,13 @@
 }
 
 } //namespace Gst
+
+namespace Glib
+{
+
+void Value< Glib::RefPtr<Gst::Caps> >::set(const Glib::RefPtr<Gst::Caps>& caps)
+{
+  Value_Boxed<Gst::Caps>::set(*(caps.operator->()));
+}
+
+}

Modified: gstreamermm/trunk/gstreamer/src/caps.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/caps.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/caps.hg	Wed Sep 17 01:14:40 2008
@@ -63,7 +63,11 @@
   _IGNORE(gst_caps_ref, gst_caps_unref)
 
 public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  static GType get_type() G_GNUC_CONST;
+#endif
 
+public:
   /** Creates a new Gst::Caps that indicates that it is compatible with any
    * media format.
    *
@@ -88,7 +92,6 @@
 
   _WRAP_METHOD(static Glib::RefPtr<Caps> create_from_string(const Glib::ustring& string), gst_caps_from_string)
 
-
   _WRAP_METHOD(Glib::RefPtr<Caps> copy() const, gst_caps_copy)
   _WRAP_METHOD(Glib::RefPtr<Caps> copy_nth(guint nth) const, gst_caps_copy_nth)
   _WRAP_METHOD(void append(const Glib::RefPtr<Caps>& caps), gst_caps_append)
@@ -138,10 +141,7 @@
   template <class DataType>
   void set_simple(const Glib::ustring& name, const DataType& data);
 
-  _IGNORE(gst_caps_set_simple)
-
-  //This does not seem useful: _WRAP_METHOD(void set_simple_valist(char* field, const va_list& varargs), gst_caps_set_simple_valist)
-  _IGNORE(gst_caps_set_simple_valist)
+  _IGNORE(gst_caps_set_simple, gst_caps_set_simple_valist)
 
   _WRAP_METHOD(bool is_any() const, gst_caps_is_any)
   _WRAP_METHOD(bool empty() const, gst_caps_is_empty)
@@ -199,3 +199,17 @@
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
 } //namespace Gst
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+namespace Glib
+{
+
+template <>
+class Value< Glib::RefPtr<Gst::Caps> > : public Value_Boxed<Gst::Caps>
+{
+public:
+  void set(const Glib::RefPtr<Gst::Caps>& caps);
+};
+
+}
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */

Modified: gstreamermm/trunk/tests/Makefile.am
==============================================================================
--- gstreamermm/trunk/tests/Makefile.am	(original)
+++ gstreamermm/trunk/tests/Makefile.am	Wed Sep 17 01:14:40 2008
@@ -10,7 +10,7 @@
 		  test-structure test-caps-structures test-interface \
 		  test-create-bus test-taglist test-tagsetter \
 		  test-init-check test-init test-init-check-noargs \
-		  test-init-noargs test-iterator
+		  test-init-noargs test-iterator test-property-caps
 
 #TODO: Add test-pad to tests when bug #539108 is fixed.
 
@@ -76,3 +76,6 @@
 
 test_iterator_SOURCES=test-iterator.cc
 test_iterator_LDFLAGS= GSTREAMERMM_LIBS@
+
+test_property_caps_SOURCES=test-property-caps.cc
+test_property_caps_LDFLAGS= GSTREAMERMM_LIBS@

Added: gstreamermm/trunk/tests/test-property-caps.cc
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/tests/test-property-caps.cc	Wed Sep 17 01:14:40 2008
@@ -0,0 +1,27 @@
+#include <gstreamermm.h>
+#include <iostream>
+
+int
+main(int argc, char* argv[])
+{
+  Gst::init(argc, argv);
+
+  Glib::RefPtr<Gst::Element> source = 
+          Gst::ElementFactory::create_element("multifilesrc", "source");
+
+  if (!source)
+  {
+    std::cout << "Could not create `multifilesrc' element.  Exiting." <<
+      std::endl;
+
+    return -1;
+  }
+
+  Glib::RefPtr<Gst::Caps> caps =
+          Gst::Caps::create_from_string("image/jpeg,framerate=2/1");
+ 
+  // Verify that setting "caps" property compiles:
+  source->set_property("caps", caps);
+
+  return 0;
+}



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