[gst-devel] How to correctly reuse elements?

wl2776 wl2776 at gmail.com
Tue Apr 20 15:20:44 CEST 2010


I am building an embedded player, capable to play audio and video from
separate files.

General algorithm is the following.

1. Create the videosink (directdrawsink) and set its window ID to the HWND
of the given window.
2. Create the playbin2 instance and set its "video-sink" property.
3. Set playbin2's uri and send it to the PLAYING state.
4. Listen on the message bus and decide if both audio and video streams are
present.
5. Catch the state-changed message from the playbin2 in the bus-sync-handler
and set playbin2 to the PAUSED state. This will draw the first video frame
and pauses the playback - a condition, my player must satisfy.
6. Also, in the same bus-sync-handler, check if both audio and video
present, and if not, send an application message, with the structure, saying
the player must additionally render some more media.

7. Catch that application message in the bus watch and call the function
dorender() which:
7.1. Destroys playbin2
7.2. Unparents the created videosink.
7.3. Creates new empty pipeline
7.4. Destroys old message bus
7.5. Creates new bus and connect bus watch and bus-sync-handler
7.6. Puts two uridecodebin2's in the pipeline
7.7. Creates an audio bin and puts it in the pipeline
7.8. Creates a video bin reusing the existing videosink and puts it in the
pipeline

The problem is - everything is created and linked, but soon after the
function dorender() exits, the videosink looses its link to its sink pad and
goes to the NULL state.
However, when the pipeline was creating, graphviz dumps showed that it was
linked and was in the READY and in the PAUSED states.

Why does it go to the NULL state?

-- 
View this message in context: http://n4.nabble.com/How-to-correctly-reuse-elements-tp2017352p2017352.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list