Commit 53f8f0a7 authored by Joakim Plate's avatar Joakim Plate Committed by Michael Niedermayer

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/5585Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent e42a3dd1
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment