changeset 3914:f7a20cf5438f libavformat

matroskadec: after seeking, skip up to the desired timestamp instead of the desired stream
author aurel
date Tue, 09 Sep 2008 12:01:51 +0000
parents 253050919116
children 7643d7c3fcf6
files matroskadec.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Tue Sep 09 11:54:35 2008 +0000
+++ b/matroskadec.c	Tue Sep 09 12:01:51 2008 +0000
@@ -210,7 +210,7 @@
 
     /* What to skip before effectively reading a packet. */
     int skip_to_keyframe;
-    AVStream *skip_to_stream;
+    uint64_t skip_to_timecode;
 } MatroskaDemuxContext;
 
 typedef struct {
@@ -1467,7 +1467,7 @@
     }
 
     if (matroska->skip_to_keyframe) {
-        if (!is_keyframe || st != matroska->skip_to_stream)
+        if (!is_keyframe || timecode < matroska->skip_to_timecode)
             return res;
         matroska->skip_to_keyframe = 0;
     }
@@ -1706,7 +1706,7 @@
 
     url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
     matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
-    matroska->skip_to_stream = st;
+    matroska->skip_to_timecode = st->index_entries[index].timestamp;
     matroska->done = 0;
     av_update_cur_dts(s, st, st->index_entries[index].timestamp);
     return 0;