[gst-devel] Implementation notes (0.10 version)

Ryan Norton wxprojects at comcast.net
Wed Feb 8 00:42:06 CET 2006


It's that time again - I've updated for 0.10 and have some notes here that 
will hopefully aid future implementors....

1) "desired-size-changed" from GstXOverlay is gone and is essentailly 
replaced by "notify::stream-info" in playbin (only 0.8-->0.10 change I'm 
mentioning, mostly because the docs are hard to find for this...) also in 
terms of type for the video pad my check that seems to work the best for 
both 0.8 and 0.10 is

        if (!strncasecmp(val->value_name, "video", 5) ||
            !strncmp(val->value_name, "GST_STREAM_TYPE_VIDEO", 21))

2) Unfortunately there are some implementation issues with async callbacks 
and GstBus (i.e. gst_bus_add_watch) in that often the async handler won't 
get called when it should and gets bottled up the queue, so calling the 
async callback in the sync callback "fixes" this ok, however it requires 
careful thread safety... (also do not return ASYNC at all from the sync 
handler as it can lock up the application quite easily)
3) As for GstXOverlay, even though it recommends you use sync handler for 
setting the XWindow id of it that often doesn't get called - the best thing 
to do that works in my testing is just to set it both in the sync handler 
and right after you get the xoverlay from the videosink
4) If you want to have syncronous state changes you are going to run into 
problems - and there are basically three ways:
    4a)gst_element_get_state with a timeout
    4b)gst_bus_poll
    4c)custom
In my testing gst_bus_poll unfortunately shows "critical warnings" in normal 
operation (i.e. timeout expired) and in such I found the best way was to 
have a somewhat simple custom implementation

        if(gst_bus_have_pending(bus) == FALSE)
        {
            if(llTimeWaited >= llTimeout)
                return true; //Reached timeout... assume success
            llTimeWaited += 10*GST_MSECOND;
            wxMilliSleep(10); //Sleep for 10 milliseconds
            continue;
        }

        message = gst_bus_pop(bus);

Which seems to work better then the other two possibilities

Good work on the 0.10 API guys!

Ryan 





More information about the gstreamer-devel mailing list