diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2008-11-15 15:34:51 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2008-11-15 15:34:51 +0000 |
commit | 8f569ed08faa39414ebd65c2e530a87dc9007d5b (patch) | |
tree | 1e3e5b659e6dbab7f92af337177f424e45808e2d /libavformat | |
parent | 6ff1f6153022821252de615858a6adf0b193eec0 (diff) | |
download | ffmpeg-8f569ed08faa39414ebd65c2e530a87dc9007d5b.tar.gz |
matroskadec: fix index timestamps for some broken files
fix issue697
Originally committed as revision 15829 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskadec.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index cedfb3d20d..5a79712f05 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1074,6 +1074,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) MatroskaTrack *tracks; EbmlList *index_list; MatroskaIndex *index; + int index_scale = 1; Ebml ebml = { 0 }; AVStream *st; int i, j; @@ -1369,6 +1370,11 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) index_list = &matroska->index; index = index_list->elem; + if (index_list->nb_elem + && index[0].time > 100000000000000/matroska->time_scale) { + av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n"); + index_scale = matroska->time_scale; + } for (i=0; i<index_list->nb_elem; i++) { EbmlList *pos_list = &index[i].pos; MatroskaIndexPos *pos = pos_list->elem; @@ -1378,7 +1384,8 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) if (track && track->stream) av_add_index_entry(track->stream, pos[j].pos + matroska->segment_start, - index[i].time, 0, 0, AVINDEX_KEYFRAME); + index[i].time/index_scale, 0, 0, + AVINDEX_KEYFRAME); } } |