gstreamer with playbin: how to pause 'now' or pause at exact time

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Oct 1 15:17:39 PDT 2013


On Wed, 2013-10-02 at 00:04 +0200, Alexandru Munteanu wrote:

Hi,

>  
> > What you can do is that you preroll the pipeline, and then do a
> > (flushing) seek in TIME format and specify a stop position with the
> > seek. Then it should stop exactly where you want it to stop.
> > 
> > There's also the gnonlin plugins and, even higher level,
> > gst-editing-services, which you might also find useful.
> 
>
> If I understand well, you are suggesting to seek backward (with flush)
> after changing the state to PAUSED. Sorry if I misunderstood, I'm not quite
> familiar with prerolling.
> The stop will surely be where I want it to stop but not when I want it.
> Wouldn't the user hear more than necessary ?

What I suggested is meant to solve the "stop at a pre-defined time" case
only. In that case, you tell the pipeline where to stop (you have to do
a seek before you start actually playing, to set the end position), and
it will stop there exactly.

The 'stop right now' case is different, and depends a bit on your exact
pipeline and the exact elements involved how well and how fast that
works. Since GStreamer does all data processing in streaming threads of
its own, and your application likely calls 'stop/pause now' from yet
another thread, the 'stop/pause' needs to be signalled across thread
boundaries. This is never going to be instant, but you can influence the
max. delay by way of configuring elements like audio sinks and by
picking sinks that implement the unlock vfunc.

Cheers
 -Tim



More information about the gstreamer-devel mailing list