GNOME Bugzilla – Bug 539059
Gst::get_option_group does not cause Gst::wrap_init to be called
Last modified: 2011-01-16 23:37:43 UTC
Please describe the problem: It is my understanding that using the Gst option group together with glib's option parser will automatically cause all necessary initialization in Gst. This is what the documentation of the get_option_group method says and it is also necessary as there is no init() method that does not take argc/argv arguments. However, from looking at gstreamermm/gstreamer/gstreamermm/init.cc, Gst::wrap_init is never called if the get_option_group approach is used. Steps to reproduce: Glib::OptionGroup m_GstOptiongroup = Gst::get_option_group(); m_OptionContext.add_group(m_GstOptiongroup); Gtk::Main *kit = new Gtk::Main (argc, argv, m_OptionContext); Actual results: Error messages like this when utilizing gstreamermm: (lt-mediaplayer:4327): glibmm-WARNING **: failed to wrap type of 'GstPlayBin' (lt-mediaplayer:4327): glibmm-WARNING **: failed to wrap type of 'GstXImageSink' One of the elements for media player could not be created. Expected results: gstreamermm should be initialized properly and function as if Gst::init() had been called. Does this happen every time? Yes. Other information: Please note that Gst::init_check() does not call the same wrap_init functions as Gst::init() does. If that is incorrect, I suppose the correct initialization code should be refactored. This could be exported similar to Gtk::init_gtkmm_internals() which can be useful sometimes. I don't have a good idea how to fix the problem. If the wrap_init functions can be called at any time, the call might be added to get_option_group. If not, the call may have to be delayed until after option parsing, but to do this automatically, the option group object has to be derived it seems (annoyingly). But please note that I do not know the binding code very well and I do not know the proper initialization sequences, so these ideas are just stabs in the dark.
Created attachment 113017 [details] Example program exhibiting the problem. Use this instead of main.cc in examples/media_player_gtkmm/, then build and run to reproduce the problem.
The only solution to this I see at the moment would be to provide no argument Gst::init() and Gst::init_check() methods (by overriding) and make it clear in the docs that some form of Gst::init* should be used to initialize gstreamermm.
Closing as fixed. I hope the following changes are enough: 2008-06-30 José Alburquerque <jaalburqu@svn.gnome.org> * gstreamer/gstreamermm/init.cc: * gstreamer/gstreamermm/init.h: Added Gst::init() and Gst::init_check() with no arguments to fix bug #539059. * tests/Makefile.am: * tests/test-init-check-noargs.cc: * tests/test-init-check.cc: * tests/test-init-noargs.cc: * tests/test-init.cc: Added init tests to test Gst::init() and Gst::init_check() methods (arguments and no argument versions). * gstreamerbase/gstreamerbasemm/init.h: Made it clear in the GstBase::init() function docs that Gst::init() functions already initialize gstreamerbasemm (no need to call GstBase::init() directly).