Why are all my seek events ignored?

Nikos Chantziaras realnc at gmail.com
Sun Feb 15 19:42:12 PST 2015


On 13/02/15 23:17, Nikos Chantziaras wrote:
> I'm trying to send a seek event to a pipeline to make the video play at
> half speed with:
>
>    QGst::SeekEventPtr seekEv = QGst::SeekEvent::create(
>      0.5,
>      QGst::FormatTime,
>      QGst::SeekFlagSegment,
>      QGst::SeekTypeSet, 0,
>      QGst::SeekTypeEnd, 0);
>
>    pipeline->sendEvent(seekEv);
>    pipeline->setState(QGst::StatePlaying);
>
> But it gets ignored. The video plays at 100% speed. In fact, my bus
> message handler doesn't even receive a single QGst::MessageSegmentDone
> message.

OK, figured it out. For anyone who comes across the same problem, it is 
crucial to:

   a. Set the SeekFlagFlush flag on the event
   b. Put the pipeline into the paused state before sending the event
   c. Wait for the state change to complete before sending the event

Although not crucial, using SeekTypeNone for the stop type and 
GST_CLOCK_TIME_NONE for the stop time seems to be a good idea.

So:

   QGst::SeekEventPtr seekEv = QGst::SeekEvent::create(
       0.5,
       QGst::FormatTime,
       QGst::SeekFlagFlush,
       QGst::SeekTypeSet, 0,
       QGst::SeekTypeNone, GST_CLOCK_TIME_NONE);

   pipeline->setState(QGst::StatePaused);
   pipeline->getState(0, 0, GST_CLOCK_TIME_NONE); // wait for pause state
   pipeline->sendEvent(seekEv);
   pipeline->setState(QGst::StatePlaying);

This worked correctly.


More information about the gstreamer-devel mailing list