What’s the correct approach for initialising GTK apps that use GStreamer?
The code that I’ve inherited has a
main() method that does
Gst.init(ref args) before a
GLib.Settings.init() and then creating the
Gtk.Application and calling its
run() method. Some users complained about crashes when playing GStreamer videos and it only seems to be solved by calling
XInitThreads (from C code, because I’m doing it conditionally with
#ifdef GDK_WINDOWING_X11) before the
That all felt a bit ugly and wrong, like I was working around a problem with the wrong (but seemingly functioning) solution.
I’ve now seen this post, which says that
Gtk.init is the wrong way to go about things and that
OptionContext should be used instead (which the app is also using with
Gst.init_get_option_group()). Does that apply to GStreamer and XInitThreads as well? What’s the correct way of initialising the app so that GStreamer doesn’t crash and everything is initialised in the right order?