changeset 3785:fd49d42b918f libavformat

matroskadec: seek to the last position known in the index before resorting to full cluster parsing when seeking after the end of index
author aurel
date Wed, 27 Aug 2008 19:57:42 +0000
parents d370d80ad1df
children 33a94467ea2b
files matroskadec.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Wed Aug 27 00:33:22 2008 +0000
+++ b/matroskadec.c	Wed Aug 27 19:57:42 2008 +0000
@@ -1655,11 +1655,15 @@
     if (timestamp < 0)
         timestamp = 0;
 
+    if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
+        if (st->nb_index_entries)
+            url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
     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)