Seeking a pipeline with live streams
Sebastian Dröge
sebastian at centricular.com
Tue Oct 29 09:48:40 CET 2013
On Mo, 2013-10-28 at 14:31 +0200, Andrei Melnikov wrote:
> > On Sa, 2013-10-26 at 23:49 -0200, Adrian Pardini wrote:
> > > On 25 October 2013 06:44, Andrei Melnikov <andy.melnikov at gmail.com>
> wrote:
> > > > I load the pipeline using gst_parse_launch(), set it to PLAYING and
> seek by
> > > > passing the pipeline bin to gst_element_seek_simple(). The code works
> fine
> > > > with simple pipelines playing a file, but the pipeline above refuses
> to
> > > > seek. It sort of seeks, but with glitches and
> gst_element_seek_simple()
> > > > returns FALSE.
> > >
> > > Hi Andrei, after a while trying to achieve the same I've resorted to
> > > have a main pipeline for the live sources and a second one for the
> > > file content linking both with a pair of interaudio and intervideo
> > > sink and src's.
> >
> > basically you want to seek on the file
> > based pipeline while letting the live pipeline continue running, right?
>
> Correct.
>
> > So you should only send a seek to the file based part of the pipeline.
>
> > You would need to adapt
> > the segment event coming from the file based pipeline into videomixer to
> > make sure that the buffers after the seek would have a running time that
> > is just a continuation of the previous buffers.
>
> How do I do that? gst_event_new_new_segment() and gst_pad_push_event()?
> There is not much documentation.
>
> Do I need to get current running time and arrange a seek at some point in
> the future?
>
> What if I want to disable the recorded stream or to switch to another file?
>
> > By using the inter elements you make the file based pipeline a live
> > stream too, which solves all these problems for you. It is not the
> > optimal solution though and has some downsides, but if it works fine for
> > you just keep it ;)
>
> Unlike Adrian I don't have any existing code so I'd like to go the right
> way (tm).
Check gstreamer/docs/design/part-synchronization.txt, that has all the
synchronization mechanisms explained.
(I'm going to answer this for 1.0 now, things are different in 0.10)
For the simple case where you just seek on the non-live part of the
pipeline you could either
1) add a pad probe on the srcpad before the videomixer sinkpad and
intercept the SEGMENT event and adjust segment.base or
2) set the "offset" property on the pad
This should be set to the running time of that stream before the seek,
basically to the time to which the first buffer after the seek should be
synchronized to (which is approximately the same as the running time of
the live stream at that time).
Similar for adding a new non-live stream.
--
Sebastian Dröge <sebastian at centricular.com>
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/20131029/790fc178/attachment.pgp>
More information about the gstreamer-devel
mailing list