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.
pull/2/head
Joakim Plate 15 years ago committed by Michael Niedermayer
parent fe0ac337bd
commit e42a3dd123
  1. 8
      libavformat/avidec.c
  2. 1
      tests/ref/fate/aasc
  3. 1
      tests/ref/fate/cvid
  4. 1
      tests/ref/fate/fraps-v5
  5. 1
      tests/ref/fate/truemotion1-24
  6. 1
      tests/ref/fate/vp5
  7. 1
      tests/ref/fate/zmbv-8bit

@ -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 */

@ -21,3 +21,4 @@
0, 72000, 168000, 0x646fa087
0, 75600, 168000, 0x404450a2
0, 79200, 168000, 0x5214c456
0, 82800, 168000, 0xe573025c

@ -76,3 +76,4 @@
0, 562500, 112400, 0xe4394f1f
0, 570000, 112400, 0x8ca8649f
0, 577500, 112400, 0x804d44eb
0, 585000, 112400, 0x3864488b

@ -56,3 +56,4 @@
0, 165000, 145152, 0x80448031
0, 168000, 145152, 0xe3b1fbf7
0, 171000, 145152, 0xa00395a4
0, 174000, 145152, 0xdf3b4fce

@ -30,6 +30,7 @@
1, 82898, 10832, 0x3c746fbe
0, 84000, 69120, 0x5876d758
1, 88424, 10832, 0x05f3b08a
0, 90000, 69120, 0x45e7dd5c
1, 93951, 10832, 0xa6560483
1, 99478, 10832, 0xd98a8e19
1, 105004, 10832, 0xf98a0b2e

@ -244,3 +244,4 @@
0, 912161, 233472, 0x6f530ac6
0, 915915, 233472, 0x94f7466c
0, 919669, 233472, 0xa8c1d365
0, 923423, 233472, 0xedcff050

@ -273,3 +273,4 @@
0, 349284, 192000, 0xd08e49d1
0, 350568, 192000, 0xd08e49d1
0, 351852, 192000, 0xd08e49d1
0, 353136, 192000, 0x1f34135f

Loading…
Cancel
Save