diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-15 00:42:57 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2009-01-15 00:42:57 +0000 |
commit | e0e4be590ce1f8aac1d7b9f930049dfb67e0d15c (patch) | |
tree | 233bef5c7c509e73b3b7703077ad6ade799cbb1e /libavformat/matroskadec.c | |
parent | 89ac55ada9a7c77ef62e779edd90f45f3e32b837 (diff) | |
download | ffmpeg-e0e4be590ce1f8aac1d7b9f930049dfb67e0d15c.tar.gz |
matroskadec: ensure we only consider chapters which are properly ordered
Originally committed as revision 16612 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index e23d03b897..e239a557e9 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1076,6 +1076,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) EbmlList *index_list; MatroskaIndex *index; int index_scale = 1; + uint64_t max_start = 0; Ebml ebml = { 0 }; AVStream *st; int i, j; @@ -1365,10 +1366,13 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) chapters = chapters_list->elem; for (i=0; i<chapters_list->nb_elem; i++) - if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid) + if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid + && (max_start==0 || chapters[i].start > max_start)) { ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000}, chapters[i].start, chapters[i].end, chapters[i].title); + max_start = chapters[i].start; + } index_list = &matroska->index; index = index_list->elem; |