diff options
author | Joakim Plate <elupus@ecce.se> | 2011-09-11 18:21:07 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-11 18:21:07 +0200 |
commit | 53f8f0a70e224a40cf2276669a808fb4ac824c05 (patch) | |
tree | 83ec607c92ae1b19a8fb50a4b698594b1b41f464 /libavformat | |
parent | e42a3dd123c47efd7921f93d4a1f6f53c196ad4a (diff) | |
download | ffmpeg-53f8f0a70e224a40cf2276669a808fb4ac824c05.tar.gz |
Fix for some non interleaved avi files that gets played twice or won't end
This changes so we assume EOF when we can't find the next
streams index entry for non interleaved file.
http://trac.xbmc.org/ticket/5585
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avidec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index db0ed3c890..2c7232913f 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1038,7 +1038,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) } } if(!best_st) - return -1; + return AVERROR_EOF; best_ast = best_st->priv_data; best_ts = av_rescale_q(best_ts, (AVRational){FFMAX(1, best_ast->sample_size), AV_TIME_BASE}, best_st->time_base); @@ -1054,7 +1054,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; - avio_seek(s->pb, pos + 8, SEEK_SET); + if(avio_seek(s->pb, pos + 8, SEEK_SET) < 0) + return AVERROR_EOF; // av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); assert(best_ast->remaining <= best_ast->packet_size); @@ -1064,6 +1065,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) best_ast->packet_size= best_ast->remaining= best_st->index_entries[i].size; } + else + return AVERROR_EOF; } resync: |