[gst-devel] Seeking for mp4/3gp files
ensonic at hora-obscura.de
Fri Oct 20 10:21:17 CEST 2006
On 12:06:44 pm 19/10/2006 "Deeptendu Bikash" <dbikash at gmail.com> wrote:
> 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;
you shold initialise fmt and check afterwards
fmt = GST_FORMAT_TIME;
gst_element_query_position(pipeline, &fmt, &cur);
if (fmt != GST_FORMAT_TIME)
GST_WARNING (" fmt (%s) != GST_FORMAT_TIME", gst_format_get_name(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),
> cur, GST_SEEK_TYPE_NONE, 0);
instead of 0 use GST_CLOCK_TIME_NONE and try without GST_SEK_FLAG_ACCURATE.
Also GstSeekFlags(GST_SEEK_FLAG_FLUSH | GST_SEK_FLAG_ACCURATE) looks like
c++ cast thing.
event = gst_event_new_seek(1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
> 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 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
More information about the gstreamer-devel