aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorJoakim Plate <elupus@ecce.se>2010-06-28 01:28:27 -0400
committerMichael Niedermayer <michaelni@gmx.at>2011-09-11 17:44:20 +0200
commite42a3dd123c47efd7921f93d4a1f6f53c196ad4a (patch)
treebe3ca5083a659222356a5685e1fb17e4db581c7a /libavformat/avidec.c
parentfe0ac337bd6b4783162bc55eb62f82181d498d5e (diff)
downloadffmpeg-e42a3dd123c47efd7921f93d4a1f6f53c196ad4a.tar.gz
Allow reading of growing avi files (ie currently being written)
This uses the RIFF header stored size to figure out the expected AVI file size, instead of the actual file. To work fully it requires handling failed avio_seek() instead of assuming they always succeed. Some fate file has been cut off and contains half a frame at the end which previously was not output during demuxing. This frame is now output to encoder, thus fate diff update.
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index f119a1ab45..db0ed3c890 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -157,7 +157,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIStream *ast;
int i;
int64_t last_pos= -1;
- int64_t filesize= avio_size(s->pb);
+ int64_t filesize= avi->fsize;
av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
longs_pre_entry,index_type, entries_in_use, chunk_id, base);
@@ -372,7 +372,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(avi, AV_LOG_DEBUG, "use odml:%d\n", avi->use_odml);
avi->fsize = avio_size(pb);
- if(avi->fsize<=0)
+ if(avi->fsize<=0 || avi->fsize < avi->riff_end)
avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
/* first list tag */
@@ -398,7 +398,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
avi->movi_list = avio_tell(pb) - 4;
if(size) avi->movi_end = avi->movi_list + size + (size & 1);
- else avi->movi_end = avio_size(pb);
+ else avi->movi_end = avi->fsize;
av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
goto end_of_header;
}
@@ -731,7 +731,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
"I will ignore it and try to continue anyway.\n");
if (s->error_recognition >= FF_ER_EXPLODE) goto fail;
avi->movi_list = avio_tell(pb) - 4;
- avi->movi_end = avio_size(pb);
+ avi->movi_end = avi->fsize;
goto end_of_header;
}
/* skip tag */