[gst-devel] Seeking for mp4/3gp files

Deeptendu Bikash dbikash at gmail.com
Thu Oct 19 12:06:44 CEST 2006


Hi Michael,

After using your idea, the result has become even more unpredictable than
before for even the MPEG-2 movie.

My code now is:

gint64 cur;
GstFormat fmt;

gst_element_set_state(pipeline, GST_STATE_PAUSED);
gst_element_query_position(pipeline, &fmt, &cur);

cur = cur + GST_SECOND;    /*****Note this line****/
event = gst_event_new_seek(1.0, GST_FORMAT_TIME,
 GstSeekFlags(GST_SEEK_FLAG_FLUSH | GST_SEK_FLAG_ACCURATE),
                                            GST_SEEK_TYPE_SET,
cur, GST_SEEK_TYPE_NONE, 0);
gst_element_send_event(pipeline, event);
gst_element_set_state(pipeline, GST_STATE_PLAYING);

I want to seek forward by 1 second, but irrespective of what I add to cur,
(I tried GST_SECOND, GST_MSECOND, 1, 1000, 1000000, 1000000000), I cannot
get the desired behaviour. The advancement is about 10 mins for the first
time I try, and the next time I reach the end of the movie (which is over 2
hours long).

Am I doing anything wrong?

On 10/19/06, Michael Smith <msmith at fluendo.com> wrote:
>
> ...
> GST_SEEK_TYPE_CUR does not seek from the current position. You want to
> use GST_SEEK_TYPE_SET, and you almost certainly want to use
> GST_SEEK_TYPE_NONE for the second (end) time.
>
> I wouldn't be at all suprised if many plugins implement
> GST_SEEK_TYPE_CUR incorrectly; there aren't many things that use it.
>
> You probably want to issue a position query (to get the current
> position), then seek to a specific location by adding/subtracting from
> that.
>
> Mike
>
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20061019/14cfb2e1/attachment.htm>


More information about the gstreamer-devel mailing list