GNOME Bugzilla – Bug 519584
gst_element_implements_interface() segfaults with 'filesrc' element
Last modified: 2008-03-04 23:29:34 UTC
I've been working on wrapping the GstImplementsInterface API (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstImplementsInterface.html) for gstreamermm and kept getting segfaults when using the gst_implements_interface_check() method to see if a 'filesrc' element implements the URIHandler interface. I thought I might have done something wrong, but I wrote the attached short program (which uses gst_element_implements_interface() in the same fashion) and it too segfaults.
Created attachment 106286 [details] gst_element_implements_interace() test
It's not really the way gst_element_implements_interface() is meant to be used: it's only supposed to be used on elements which implement the GstImplementsInterface interface (yes, this is all horribly ugly). Should not crash of course, fixed in CVS now: 2008-02-29 Tim-Philipp Müller <tim at centricular dot net> * gst/gstinterface.c: (gst_element_implements_interface): Don't crash if the element supports the interface queried, but does not implement GstImplementsInterface. Fixes #519584. * tests/check/Makefile.am: * tests/check/gst/.cvsignore: * tests/check/gst/gstinterface.c: Add unit test for the above.
I know this may not be appropriate to be asking in a bug report, but do all elements not implement the GstImplementsInterface?
At least these elements have it: alsamixer, alsasrc, dfbvideosink, glimagesink, ossmixer, osssrc, sdlvideosink, v4l2src, v4lsrc, videobalance, volume, ximagesink, xvimagesink As you can see, there's a lot of stuff dealing with hardware. AFAIK the intent of this interface is to let an element instance not implement another interface based on hardware device capabilities for example.
Thanks. One final question: Is it possible to use the gst_implements_interface_cast() method to cast from a GstElement to an interface, for example URIHandler, if the GstElement does not implement the GstImplementsInterface? Thanks.
By testing I've found that gst_implements_interface_cast() works with elements not implementing GstImplementsInterface. Thanks.