GNOME Bugzilla – Bug 459539
Making totem backend runtime chooseable
Last modified: 2008-12-05 16:37:16 UTC
It would be nice if the totem backend (GStreamer or xine-lib) would be run-time chooseable - for example with a commandline argument. That would allow to make packaging the xine version for DVD playback much easier in Gentoo Linux, which is source based. Discussed this with Bastien at GUADEC, so someone just needs to do it at some afternoon - maybe me, but hopefully someone else *grin*. Bastien promised to lists the steps necessary for doing it, even :)
Bastien, ping?
I'd like to volunteer to take a look at this. I haven't worked with totem at all so if someone cares to provide an outline of what they think is necessary it would be greatly appreciated.
Bastien?
1. Create a bacon-video-widget.c 2. For all the functions in bacon-video-widget.h, create a function pointer in bacon-video-widget.c 3. Make it compile both backends as shared libraries 4. In the init() function in bacon-video-widget.c, call g_module_open() to open either shared libraries/backends, and assign the functions in the backend to the function pointers 5. Then for each function in bacon-video-widget.h, add a stub in bacon-video-widget.c that will simply call the backend function. You can hardcode which backend to use for now, whichever works best for you. We can think of a way to solve this problem later.
Thanks Bastien, I'll see what I can do.
Created attachment 98541 [details] Dynamic module loading backend Initial implementation (created for version 2.21.1) of the dynamic backend loader. I'm far from an automake guru however and so I haven't tested this yet. If someone would like to try it out please be my guest, otherwise I'll try to make the necessary changes to the automake files and give it a go. The assumption is that we could build bacon-video-widget-gst-0.10.c and bacon-video-widget-xine.c as dynamic libraries called "libtotem-backend-gst-0.10.so" and "libtotem-backend-xine.so" respectively (or whatever is preferred). When bacon_video_widget_init_backend is called, the appropriate module is loaded and the symbols are retrieved. Currently this is just hard-coded to the xine backend. Comments/suggestions welcome.
It's missing all the changes to the xine/gstreamer backends though, so it's not usable as is. Could you make the necessary changes and post a patch? Even if only one backend is built because you don't want to change the configure.in, that's not a problem. See src/Makefile.am for an example of how to build a plugin file (the nautilus properties page).
We already have hacks in the Fedora package to do that by switching the libbaconvideowidget shared library from xine-lib to GStreamer. See http://cvs.fedoraproject.org/viewvc/rpms/totem/devel/