Playback speed and playbin - do they work together?

Alexandru Palade alexandru.palade at loopback.ro
Wed May 7 09:50:01 PDT 2014


Thank you, Tim, I'll give it a shot. I plan expanding this to have the
loop, but based on input to change dynamically the video and then go back
to the loop, so I'm kind of stuck with about-to finish, ain't I?

I'll have a look at frame stepping examples as you said, but if you have a
suggestion on where to start with playbin (or any other solution for
looping a single file -> looping another file on a specific input -> back
to looping the first file and all this with dynamic playback speed).

Thank you for your time.


On Wed, May 7, 2014 at 7:26 PM, Tim Müller <tim at centricular.com> wrote:

> On Wed, 2014-05-07 at 19:00 +0300, Alexandru Palade wrote:
>
> Hello Alexandru,
>
> > I'm trying to make a combination of playbin example[1], and playback
> > speed example[2]. I want a video to loop indefinitely (using
> > about-to-finish signal), but I would like to be able to control the
> > speed as well. Here[3]'s my experiment so far. It works, but I do have
> > quite a few problems:
> >
> > 1) when the video is finished and it goes at the beginning, the
> > playback speed reverts to the original one. Only after I send a
> > send_seek_event by pressing a key it goes back to what is supposed to
> > be.
> > 2) when the video is finished playing and it needs to start again,
> > sometimes, it gets stuck for a few seconds and only then starts
> > playing again. Again, calling send_seek_event unfreezes it.
> >
> >
> > The whole day I tried to:
> > a) send_seek_event in 'about-to-finish' callback, it appears to fix
> > #2, but not #1
> > b) listen on the bus for STREAM_START message and call send_seek_event
> > then, doesn't work because it can't query the position in at line 28.
> > c) listen on the bus for STATE_CHANGED message and try to call
> > send_seek_event on different combinations of old state and new state,
> > but I always ended up in crashing the program
> > d) listen on the bus of ASYNC_DONE message and combined it with
> > STREAM_START, still no luck.
> >
> >
> > I'm assuming now that somehow the state of the playbin is important
> > when to call that send_seek_event so that playbin can restore the
> > playback speed, but I'm out of ideas where to try it. I've read on
> > playbin's documentation page that it should have no problem in taking
> > gst_element_send_event.
>
> For looping the same file there's a better approach than using the
> about-to-finish signal:
>
>  - set playbin to PAUSED state
>  - wait for ASYNC_DONE message on bus
>  - send a seek for start=0, stop=-1 with flags FLUSH | SEGMENT
>  - set playbin to PLAYING state
>  - now you will get a SEGMENT_DONE message on
>    the bus when the demuxer/parser is finished
>    with the file (but there's still data buffered,
>    so playback hasn't finished yet)
>  - when you get SEGMENT_DONE, do a non-flushing
>    SEGMENT seek back to start=0,stop=-1
>  - wait for next SEGMENT_DONE message on the bus
>  - etc.
>
> You can determine the rate with the seek event.
>
> If you need to change the rate dynamically during playback, you might
> want to have a look at the 'frame stepping' API and examples, which let
> you do that as well.
>
>
> > Oh, and I'm in 1.x branch.
>
> Excellent.
>
> Cheers
>  -Tim
>
> --
> Tim Müller, Centricular Ltd - http://www.centricular.com
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140507/d2dabd48/attachment.html>


More information about the gstreamer-devel mailing list