Dynamically replacing uridecodebin

A. Bikadorov wegwerf at abwesend.de
Wed Oct 1 13:20:41 PDT 2014


Hi everybody,

I need some 'best practice' advice on how to replace an uridecodebin for the current
playing song with a new one for the next song to achieve gapless playback (as much as
possible).

The pipeline is simplified
[ [uridecodebin] -> [audiobin] ]
with a queue as first element in audiobin.

I know the uridecodebin can be replaced in the callback for the "drained" signal, and this
what I came up with so far:
- creating a new uridecodebin and setting the uri
- removing the old uridecodebin and adding the new one to the pipeline
- setting it to the "play" state
- the bins are linked together in the "pad-added" callback

But this raises some issues:
- The next song is played from the position where the old one ended, i.e. the clock is set
the clock of the pipeline. This is also stated in the docs [1].
- Seeking is not possible anymore after the bin was replaced. As a workaround all changes
have to be reverted
- I couldn't find a signal that is send when the transition to the next song is done to
notify the application

Hope, someone can tell me the general approach for this. Or link to code where this is
done, I assume it's not an odd use case.

Thanks!
Alex

[1]:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dynamic-pipelines.html


More information about the gstreamer-devel mailing list