diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-03 17:44:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-08-03 19:02:33 +0200 |
commit | 46eaaad8dd12eb6c962bc0f1d528afff933dc872 (patch) | |
tree | 66e513d4017d3f0c7b9d1f334fea1527b5538cd6 /libavformat | |
parent | 652c772981f18c8d1523b572a4c57606801c60e7 (diff) | |
download | ffmpeg-46eaaad8dd12eb6c962bc0f1d528afff933dc872.tar.gz |
Detect NI-avi at playtime like mplayer.
Fixes Ticket333
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 2814b89d22..5dac749fc5 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -73,6 +73,7 @@ typedef struct { int odml_depth; int use_odml; #define MAX_ODML_DEPTH 1000 + int64_t dts_max; } AVIContext; @@ -1168,6 +1169,16 @@ resync: } ast->seek_pos= 0; + if(!avi->non_interleaved && st->nb_index_entries>1){ + int64_t dts= av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q); + + if(avi->dts_max - dts > 2*AV_TIME_BASE){ + avi->non_interleaved= 1; + av_log(s, AV_LOG_INFO, "Switching to NI mode, due to poor interleaving\n"); + }else if(avi->dts_max < dts) + avi->dts_max = dts; + } + return size; } @@ -1407,6 +1418,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp /* do the seek */ avio_seek(s->pb, pos_min, SEEK_SET); avi->stream_index= -1; + avi->dts_max= INT_MIN; return 0; } |