aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-18 03:20:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-18 03:34:57 +0200
commitc4e02d3432e9fc409d72f7d7ad2e4941aacdc6e9 (patch)
tree91c4f92791421ff9747cbf3b9868750835b3c38e /libavformat/avidec.c
parent39f6733f0593064ae5148dd6484f1d7c74d7cae5 (diff)
downloadffmpeg-c4e02d3432e9fc409d72f7d7ad2e4941aacdc6e9.tar.gz
avidec: Dont switch to NI mode if there is no index.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 05602d8bc1..345d0921d9 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -236,7 +236,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
}
}
- avi->index_loaded=1;
+ avi->index_loaded=2;
return 0;
}
@@ -756,7 +756,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(!avi->index_loaded && pb->seekable)
avi_load_index(s);
- avi->index_loaded = 1;
+ avi->index_loaded |= 1;
avi->non_interleaved |= guess_ni_flag(s) | (s->flags & AVFMT_FLAG_SORT_DTS);
for(i=0; i<s->nb_streams; i++){
AVStream *st = s->streams[i];
@@ -1181,7 +1181,7 @@ resync:
}
ast->seek_pos= 0;
- if(!avi->non_interleaved && st->nb_index_entries>1){
+ if(!avi->non_interleaved && st->nb_index_entries>1 && avi->index_loaded>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){
@@ -1317,6 +1317,7 @@ static int avi_load_index(AVFormatContext *s)
if (tag == MKTAG('i', 'd', 'x', '1') &&
avi_read_idx1(s, size) >= 0) {
+ avi->index_loaded=2;
ret = 0;
break;
}
@@ -1351,7 +1352,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
if (!avi->index_loaded) {
/* we only load the index on demand */
avi_load_index(s);
- avi->index_loaded = 1;
+ avi->index_loaded |= 1;
}
assert(stream_index>= 0);