summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-08-25 00:15:49 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-08-25 00:15:49 +0000
commit0f646a2233fed90fe9c2c403805b889eb840f3df (patch)
tree93e8a41a316ad90a7ee785bdb3398c83fecd4539 /libavformat/matroskadec.c
parentffc2b3412c8e18edf8f57e0469099b9817f1ab54 (diff)
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 Originally committed as revision 14959 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9ab8126aea..68d3aa38c1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1657,11 +1657,15 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
if (timestamp < 0)
timestamp = 0;
- index = av_index_search_timestamp(st, timestamp, flags);
- if (index < 0)
- return 0;
+ 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;
url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);