1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/avidec: Fix incorrect detection of badly interleaved avi

The method guess_ni_flag needs to divide timestamps in the index
by sample_size if it is set in order to compare different streams correctly.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Nigel Touati-Evans 2013-07-04 16:51:32 +01:00 committed by Michael Niedermayer
parent 6516a25f04
commit ef8cc06d6e
2 changed files with 4 additions and 3 deletions

View File

@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 18 #define LIBAVCODEC_VERSION_MINOR 18
#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \

View File

@ -1397,15 +1397,16 @@ static int guess_ni_flag(AVFormatContext *s){
for (i=0; i<s->nb_streams; i++) { for (i=0; i<s->nb_streams; i++) {
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
AVIStream *ast = st->priv_data;
int n= st->nb_index_entries; int n= st->nb_index_entries;
while (idx[i]<n && st->index_entries[idx[i]].pos < pos) while (idx[i]<n && st->index_entries[idx[i]].pos < pos)
idx[i]++; idx[i]++;
if (idx[i] < n) { if (idx[i] < n) {
min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp, st->time_base, AV_TIME_BASE_Q)); min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q));
min_pos = FFMIN(min_pos, st->index_entries[idx[i]].pos); min_pos = FFMIN(min_pos, st->index_entries[idx[i]].pos);
} }
if (idx[i]) if (idx[i])
max_dts = FFMAX(max_dts, av_rescale_q(st->index_entries[idx[i]-1].timestamp, st->time_base, AV_TIME_BASE_Q)); max_dts = FFMAX(max_dts, av_rescale_q(st->index_entries[idx[i]-1].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q));
} }
if(max_dts - min_dts > 2*AV_TIME_BASE) { if(max_dts - min_dts > 2*AV_TIME_BASE) {
av_free(idx); av_free(idx);