OSDN Git Service

In mov demuxer, fix seeking to the beginning when file has edit lists.
authorJohn Stebbins <stebbins@jetheaddev.com>
Fri, 2 Jul 2010 08:24:37 +0000 (08:24 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Fri, 2 Jul 2010 08:24:37 +0000 (08:24 +0000)
Patch by John Stebbins, stebbins at jetheaddev dot com
Fixes issue #2046

Originally committed as revision 23966 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/mov.c

index b6feb68..dfed5dc 100644 (file)
@@ -2496,6 +2496,8 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp,
 
     sample = av_index_search_timestamp(st, timestamp, flags);
     dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
+    if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
+        sample = 0;
     if (sample < 0) /* not sure what to do */
         return -1;
     sc->current_sample = sample;