Stream swithcing dynamically

Sebastian Dröge sebastian at centricular.com
Mon Jun 6 07:30:24 UTC 2016


On So, 2016-06-05 at 20:18 -0700, DeepakRohan wrote:
> Hi,
> 
>        I have written an test application, where I for a gstreamer-1.0
> pipeline.
> The scenario is when I am playing a file which has 3 audio streams. Now
> while the playback is going on, I would like to switch to a different audio stream.
>       Say if I was playing audio#0, then I would want to switch to audio#2.
>       So is there any way for me to do so without using input selector
> between decoder
> and the audiosink. Instead I should be able to remove the audio#0's parser
> and decoder
> and then able to include the audio#2's parser and decoder without altering
> the playback state.
> That is suppose I do a stream switch say at 10 second then the playback for
> audio#2 after the switching must start from 10 seconds (not from the beginning).
> 
> If the above is possible, then how can I do the above mentioned logic and
> also to make sure that only audio#0;s elements are removed not the whole pipeline
> and audio#2's elements are successfully added and the playback resumes from
> correct position.

You can't do this with gst-launch but have to write actual code for
implementing this behaviour, and in there you would make sure that what
you describe above happens.

You would basically do the switching at the earliest pipeline part
where you have the multiple streams, e.g. at the demuxer. And then make
sure together with pad probes that all pipelines changes are happening
in the correct order.


Alternatively you could also use an input-selector (on the encoded
data) after the demuxer, and only have a pad probe at its source pad to
ensure that downstream is changed to different parser/decoder if the
caps between the different streams are actually changing. Or if they
are never going to change in an incompatible way you would get away
with just an input-selector.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160606/48e14051/attachment.sig>


More information about the gstreamer-devel mailing list