# HG changeset patch # User aurel # Date 1226763291 0 # Node ID 11fbf47f3e1612b25d16166e0027fe94e7ce5fe0 # Parent bd11db44dfba9a7303ea6f5a019df3bcc5582927 matroskadec: fix index timestamps for some broken files fix issue697 diff -r bd11db44dfba -r 11fbf47f3e16 matroskadec.c --- a/matroskadec.c Sat Nov 15 14:44:48 2008 +0000 +++ b/matroskadec.c Sat Nov 15 15:34:51 2008 +0000 @@ -1074,6 +1074,7 @@ MatroskaTrack *tracks; EbmlList *index_list; MatroskaIndex *index; + int index_scale = 1; Ebml ebml = { 0 }; AVStream *st; int i, j; @@ -1369,6 +1370,11 @@ 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; inb_elem; i++) { EbmlList *pos_list = &index[i].pos; MatroskaIndexPos *pos = pos_list->elem; @@ -1378,7 +1384,8 @@ 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); } }