[gst-devel] question on seek

Andoni Morales ylatuya at gmail.com
Wed Apr 8 12:27:41 CEST 2009


2009/4/8 Albert Costa <costa_albert at yahoo.fr>:
> Hi All,
> I have a simple question: I have an application where I want to display only
> a subset of a video. My pipeline can be resumed to 'filesrc ! decodebin !
> ffmegcolorspace ! queue ! directdrawsink'. To see only a part of the video,
> I use following :
> GstEvent* seek_event;
> seek_event = gst_event_new_seek (1.0, GST_FORMAT_TIME,
>                 (GstSeekFlags) (GST_SEEK_FLAG_SEGMENT |
> GST_SEEK_FLAG_FLUSH),
>                 GST_SEEK_TYPE_SET, start_time,
>                 GST_SEEK_TYPE_SET, stop_time);
>               gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
>               gst_element_get_state(m_pipeline, NULL, NULL,
> GST_CLOCK_TIME_NONE);
>               gst_element_send_event(m_pipeline, seek_event);
> where start/stop_time are values for the start and end positions in my file.
> Everything works fine, except for the fact that just before displaying the
> video at position start (and then playing up to stop position), I do see the
> first (0) frame of the video.
> Is there a way to avoid this and have the pipeline really starting from the
> position I want?

Maybe using this method is simpler:

gst_element_seek (m_pipeline, 1.0,
      	GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
      	GST_SEEK_TYPE_SET, start_time,
      	GST_SEEK_TYPE_SET, stop_time);

If you want accuracy in the seek, you should use the flag
GST_SEEK_FLAG_ACCURATE. The seek  is slower but much more accurate.

Andoni

> Regards,
> Al
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>




More information about the gstreamer-devel mailing list