GNOME Bugzilla – Bug 552305
set_property on a "caps" property fails
Last modified: 2011-01-16 23:37:51 UTC
Please describe the problem: If a Gst::Element has a "caps" property that expects a GstCaps argument it is impossible to set it using the c++ interface. Steps to reproduce: 1. create a element that expects a "caps" property line multifilesrc or capsfilter 2. Create a Gst::Caps object. 3. use the set_element("caps", caps) to set the caps property. Actual results: The program does not compile with a template instantiation error: /usr/include/glibmm-2.4/glibmm/value.h: In static member function ‘static GType Glib::Value<Glib::RefPtr<T_CppObject> >::value_type() [with T = Gst::Caps]’: /usr/include/glibmm-2.4/glibmm/objectbase.h:219: instantiated from ‘void Glib::ObjectBase::set_property(const Glib::ustring&, const PropertyType&) [with PropertyType = Glib::RefPtr<Gst::Caps>]’ teste.cpp:44: instantiated from here /usr/include/glibmm-2.4/glibmm/value.h:233: error: ‘get_base_type’ is not a member of ‘Gst::Caps’ /usr/include/glibmm-2.4/glibmm/value.h: In member function ‘void Glib::Value<Glib::RefPtr<T_CppObject> >::set(const Glib::RefPtr<T_CppObject>&) [with T = Gst::Caps]’: /usr/include/glibmm-2.4/glibmm/objectbase.h:221: instantiated from ‘void Glib::ObjectBase::set_property(const Glib::ustring&, const PropertyType&) [with PropertyType = Glib::RefPtr<Gst::Caps>]’ teste.cpp:44: instantiated from here /usr/include/glibmm-2.4/glibmm/value.h:235: error: no matching function for call to ‘Glib::Value<Glib::RefPtr<Gst::Caps> >::set_object(Gst::Caps*)’ /usr/include/glibmm-2.4/glibmm/value.h:129: note: candidates are: void Glib::ValueBase_Object::set_object(Glib::ObjectBase*) Expected results: The program should compile. Does this happen every time? yes. Other information: If I try to set the the g_object directly using caps->gobj() the program compiles but the operation fails at runtime stating that "GLib-GObject-WARNING **: unable to set property `caps' of type `GstCaps' from value of type `glibmm__CustomPointer_P8_GstCaps'" using the C interface g_object_set(element->gobj(), "caps", caps->gobj()); does seem to work, my test program do give me a warning(*) but the caps is correctly applied. *) "GLib-GObject-WARNING **: IA__g_object_set_valist: object class `GstMultiFileSrc' has no property named `@\xc38'"
Would you be able to test the change just commited in svn? I think it should fix this bug.
Thanks for reporting. The following changes fix this: 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.