[gst-devel] Seeking

Tim-Philipp Müller t.i.m at zen.co.uk
Mon Apr 5 20:01:41 CEST 2010


On Mon, 2010-04-05 at 10:22 -0400, Wesley J. Miller wrote:

Hi,

> This pipeline is actually coded in C.  So, after I set the pipeline to
> PAUSED, I’d like to be able to seek to one particular frame that is at
> a specified  offset in time relative to the start of the saved mjpeg
> stream.   
>
> (...)
>   gst_element_set_state( pipeline, GST_STATE_PAUSED );
>
> // perform a seek here

Are you waiting for the pipeline to preroll / finish the sate change
after doing _set_state(PAUSED)?

Upward state changes to PAUSED/PLAYING are usually asynchronous (you
might want to check the return value of _set_state() if you're not doing
that yet), meaning that when _set_state() returns the pipeline is not in
PAUSED/PLAYING state yet, meaning that you can't seek on it yet.

You can wait for the pipeline to preroll with something like:

  GstMessage *msg;

  msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline),
      GST_CLOCK_TIME_NONE,
      GST_MESSAGE_ERROR | GST_MESSAGE_ASYNC_DONE);

  if (msg == GST_MESSAGE_ERROR) {
    .. handle error ..
  }
  gst_message_unref (msg);

  gst_element_seek_simple (pipeline, GST_FORMAT_TIME,
      GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
      5 * GST_SECOND);

  (N.B.: after this the pipeline will need to preroll again)

Some info on frame stepping can be found here (it's not entirely clear
what documentation you have found or not, or what information you're
looking for exactly):

http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-framestep.txt
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/tests/examples/stepping

Hope this helps.

Cheers
 -Tim







More information about the gstreamer-devel mailing list