GNOME Bugzilla – Bug 321816
[API] xoverlay API to post prepare-xwindow-id message
Last modified: 2005-11-21 20:41:50 UTC
I'd like to add an gst_x_overlay_prepare_xwindow_id() function to xoverlay that post an element message called 'prepare-xwindow-id' on the bus. That function should be called by elements implementing the GstXOverlay interface just before they start creating their own X Window. This message can be intercepted by the application via a synchroneous bus message handler and gives the application the chance to set the xwindow ID "just in time". A signal would do as well, but a bus message is more convenient because that way the application doesn't need to find out the instance implementing the interface before connecting to it. So xoverlay elements would basically do: if (foo->our_window == NULL) gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (foo)); if (foo->our_window == NULL) ... create own xwindow ... else ... use set xwindow id ... The reason this is necessary is that when an application is using gconfvideosink or autovideosink it has no control over the state of these sink bins once they are passed to playbin. They might be set to state NULL and back to READY/PLAYING at any time, creating a new videosink instances, which in turn requires the application again to set the xwindow ID. It can only do that reliable if it's informed when it needs to do that, and this seems to be the best way to me. Of course this can be hacked around in the sink bins somehow or in playbin, but it still seems desirable to have this message or signal. Cheers -Tim
Erm, just to clarify, the above code assumes of course that foo->our_window is also created in the GstXOverlay::set_xwindow_id () implementation
Hi Tim, I think this looks good, but I don't really know anything. We should get Julien to comment on this one. I think this counts as an addition, not a change, so we can do this during the week. Unblocking on 319388.
The reason I made it block on bug #319388 is that if we go for a message here we should probably convert the two other xoverlay signals 'desired-size-change' and 'have-xwindow-id' to bus messages as well (not sure if those are used anywhere anyway). The reason I want bus messages for this is so that the application doesn't need to keep track of videosink instances, which it would need to do for g_signal_connect(). Keeping track of instances being created is a bit tedious when you have things in bins and possibly multiple bin layers. Not that it can't be done, but I don't see any reason for these things to stay signals either.
So while we are at it let's comment about XOverlay in general. After discussing about that with Wim with both agreed that desired size should completely get out of the XOverlay interface, it should only contain : - set_xwindow_id - expose - have_xwindow_id I agree with you that having to search in a bin for elements supporting the interface is a bit painfull. So if you think that having a synched message posted to the bus for the application to have a change to set its window id is the best way i m all for it. So let's add : void (* prepare_xwindow_id) (GstXOverlay *overlay) and make have_xwindow_id a message to the bus as well. Will you do that or should i ?
Sounds good to me. I'll do it in a few minutes, if you don't mind.
Fixed in CVS: 2005-11-21 Tim-Philipp Müller <tim at centricular dot net> * gst-libs/gst/interfaces/xoverlay.c: (gst_x_overlay_base_init), (gst_x_overlay_got_xwindow_id), (gst_x_overlay_prepare_xwindow_id): * gst-libs/gst/interfaces/xoverlay.h: Remove everything having to do with the desired size; add gst_x_overlay_prepare_xwindow_id() function; remove the 'have-xwindow-id' signal and make gst_x_overlay_got_xwindow_id() post a message on the bus instead (#321816). * sys/ximage/ximagesink.c: (gst_ximagesink_xoverlay_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_setcaps), (gst_xvimagesink_xoverlay_init): Remove desired size stuff (#321816).