diff matroskadec.c @ 3774:fa5cc40e0164 libavformat

matroskadec: full seeking support in index-less files when trying to seek past the last index entry, just parse more clusters to add them to the index, until an index entry match the desired position
author aurel
date Mon, 25 Aug 2008 00:15:49 +0000
parents 2533332ca752
children f4eb5cc927f9
line wrap: on
line diff
--- a/matroskadec.c	Mon Aug 25 00:09:08 2008 +0000
+++ b/matroskadec.c	Mon Aug 25 00:15:49 2008 +0000
@@ -1657,12 +1657,16 @@
     if (timestamp < 0)
         timestamp = 0;
 
-    index = av_index_search_timestamp(st, timestamp, flags);
+    while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
+        matroska_clear_queue(matroska);
+        if (matroska_parse_cluster(matroska) < 0)
+            break;
+    }
+
+    matroska_clear_queue(matroska);
     if (index < 0)
         return 0;
 
-    matroska_clear_queue(matroska);
-
     url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
     matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
     matroska->skip_to_stream = st;