# HG changeset patch
# User aurel
# Date 1220961711 0
# Node ID f7a20cf5438f39963f891b96565d10cade33ae40
# Parent  2530509191165ed34e287cf2feedd5b6670919b0
matroskadec: after seeking, skip up to the desired timestamp instead of
the desired stream

diff -r 253050919116 -r f7a20cf5438f matroskadec.c
--- 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;