diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-05-25 18:28:26 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-05-25 18:28:26 +0000 |
commit | 8c68f25b209d149d7333052f016b60e91d78a2f4 (patch) | |
tree | 071f720e63cd9246671c0e59b8cc8c0306ef202f | |
parent | 80704c47c4e42fe2d397f6c119ce17bb02ac9a15 (diff) | |
download | ffmpeg-8c68f25b209d149d7333052f016b60e91d78a2f4.tar.gz |
Workaround broken AVI files from DC-XZ6.
Fixes issue897.
Originally committed as revision 18942 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/avidec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 671a27b999..10f9417d2d 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -955,19 +955,30 @@ static int guess_ni_flag(AVFormatContext *s){ int i; int64_t last_start=0; int64_t first_end= INT64_MAX; + int64_t oldpos= url_ftell(s->pb); for(i=0; i<s->nb_streams; i++){ AVStream *st = s->streams[i]; int n= st->nb_index_entries; + unsigned int size; if(n <= 0) continue; + if(n >= 2){ + int64_t pos= st->index_entries[0].pos; + url_fseek(s->pb, pos + 4, SEEK_SET); + size= get_le32(s->pb); + if(pos + size > st->index_entries[1].pos) + last_start= INT64_MAX; + } + if(st->index_entries[0].pos > last_start) last_start= st->index_entries[0].pos; if(st->index_entries[n-1].pos < first_end) first_end= st->index_entries[n-1].pos; } + url_fseek(s->pb, oldpos, SEEK_SET); return last_start > first_end; } |