Dynamic linking for custom bins
Sebastian Dröge
sebastian at centricular.com
Tue May 6 12:30:28 PDT 2014
On Do, 2014-05-01 at 15:29 -0700, waldemar wrote:
> Hello everyone!
> I've been playing and developing with gstreamer for a couple of months, no
> problems... until now, seems like I'm stuck with understanding how dynamic
> linking works.
>
> The app I'm developing works with a timeline, where media elements(video,
> image, audio) get in an out a scene following a script. The pipeline that
> works as the scene has the following structure:
> videomixer -> videoconvert -> capsfilter -> autovideosink
> audiomixer -> autoaudiosink
>
> The idea is to create custom bins for playing video segments at any time in
> the pipeline timeline. These bins have two ghost src pads, one for video and
> one for audio, that are linked to requested pads from the videomixer and
> audiomixer in order to play their content in the pipeline.
>
> filesrc -> queue -> decodebin -> videoconvert -> videoscale -> _video_pad
> -> audioconvert -> volume ->
> _audio_pad
>
> Custom bins are set to PAUSED as soon as their elements are created, and
> they play OK if they are linked to the mixers as soon as the pipeline starts
> playing.
>
> The problem comes with linking elements while the pipeline is already
> playing, for this I'm using g_timeout_add. If I try to link a custom bin
> while playing as soon as I request the new pads to the mixers the pipeline
> goes to READY, delaying/freezing the video, and after a couple of seconds it
> continues playing all the elements.
>
> I tried blocking the pads on the pad-added event on decodebin, wait for all
> the pads to be blocked to perform a gst_element_seek to unblock, flush and
> then connect to the mixers, but the delayed persists or sometimes the
> pipeline gets stuck in the READY state.
>
> so, Would you advice me how to ensure these custom bins are going to be
> ready to be linked(with their seek offset) to the main pipeline to play
> their content smoothly???
(In case you mean adder instead of audiomixer... for your use case you
really need to use the audiomixer element that is new in 1.3)
The problem you see is probably that you don't adjust the running time
of the newly added sources to start at the current running time of the
pipeline. If you don't do that, the running time of the new sources will
start at 0, while the mixers are at a running time > 0 already. This
will cause the first part of the new sources to be dropped (freezing the
pipeline until that is done) until they advanced their running time to
the one of the pipeline.
For adjusting the running time you could use gst_pad_set_offset() on the
srcpads of the new sources, and set the offset to the clock_time -
base_time of the pipeline at the moment you add the new sources (or was
it - (clock_time - base_time)?). You will need to use 1.3.1 or newer for
this to work properly though.
--
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140506/587aec4e/attachment.sig>
More information about the gstreamer-devel
mailing list