Browse Source

lavf: flush the output AVIOContext in av_write_trailer().

This is consistent with stdio and is what we want to do in all cases.

Fixes a bug in the voc muxer which didn't flush in write_trailer()
previously. This is the cause of the change in the test results.
tags/n1.0
Anton Khirnov 13 years ago
parent
commit
3b4bb19e63
19 changed files with 16 additions and 30 deletions
  1. +0
    -1
      libavformat/asfenc.c
  2. +0
    -2
      libavformat/assenc.c
  3. +0
    -1
      libavformat/avienc.c
  4. +1
    -1
      libavformat/crcenc.c
  5. +0
    -3
      libavformat/ffmenc.c
  6. +0
    -2
      libavformat/ffmetaenc.c
  7. +1
    -1
      libavformat/filmstripenc.c
  8. +1
    -1
      libavformat/gif.c
  9. +1
    -1
      libavformat/matroskaenc.c
  10. +0
    -2
      libavformat/movenc.c
  11. +0
    -2
      libavformat/mxfenc.c
  12. +1
    -1
      libavformat/nutenc.c
  13. +1
    -1
      libavformat/rmenc.c
  14. +0
    -2
      libavformat/rsoenc.c
  15. +0
    -1
      libavformat/smjpegenc.c
  16. +0
    -2
      libavformat/swfenc.c
  17. +4
    -0
      libavformat/utils.c
  18. +3
    -3
      tests/ref/lavf/voc
  19. +3
    -3
      tests/ref/lavf/voc_s16

+ 0
- 1
libavformat/asfenc.c View File

@@ -872,7 +872,6 @@ static int asf_write_trailer(AVFormatContext *s)
asf_write_header1(s, file_size, data_size - asf->data_offset);
}

avio_flush(s->pb);
av_free(asf->index_ptr);
return 0;
}


+ 0
- 2
libavformat/assenc.c View File

@@ -72,8 +72,6 @@ static int write_trailer(AVFormatContext *s)
avio_write(s->pb, avctx->extradata + ass->extra_index,
avctx->extradata_size - ass->extra_index);

avio_flush(s->pb);

return 0;
}



+ 0
- 1
libavformat/avienc.c View File

@@ -626,7 +626,6 @@ static int avi_write_trailer(AVFormatContext *s)
avi_write_counters(s, avi->riff_id);
}
}
avio_flush(pb);

for (i=0; i<s->nb_streams; i++) {
AVIStream *avist= s->streams[i]->priv_data;


+ 1
- 1
libavformat/crcenc.c View File

@@ -50,7 +50,7 @@ static int crc_write_trailer(struct AVFormatContext *s)

snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
avio_write(s->pb, buf, strlen(buf));
avio_flush(s->pb);
return 0;
}



+ 0
- 3
libavformat/ffmenc.c View File

@@ -226,15 +226,12 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)

static int ffm_write_trailer(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
FFMContext *ffm = s->priv_data;

/* flush packets */
if (ffm->packet_ptr > ffm->packet)
flush_packet(s);

avio_flush(pb);

return 0;
}



+ 0
- 2
libavformat/ffmetaenc.c View File

@@ -80,8 +80,6 @@ static int write_trailer(AVFormatContext *s)
write_tags(s->pb, ch->metadata);
}

avio_flush(s->pb);

return 0;
}



+ 1
- 1
libavformat/filmstripenc.c View File

@@ -67,7 +67,7 @@ static int write_trailer(AVFormatContext *s)
avio_wb16(pb, 1/av_q2d(st->codec->time_base));
for (i = 0; i < 16; i++)
avio_w8(pb, 0x00); // reserved
avio_flush(pb);
return 0;
}



+ 1
- 1
libavformat/gif.c View File

@@ -347,7 +347,7 @@ static int gif_write_trailer(AVFormatContext *s)
AVIOContext *pb = s->pb;

avio_w8(pb, 0x3b);
avio_flush(s->pb);
return 0;
}



+ 1
- 1
libavformat/matroskaenc.c View File

@@ -1265,7 +1265,7 @@ static int mkv_write_trailer(AVFormatContext *s)
av_freep(&mkv->cues->entries);
av_freep(&mkv->cues);
av_destruct_packet(&mkv->cur_audio_pkt);
avio_flush(pb);
return 0;
}



+ 0
- 2
libavformat/movenc.c View File

@@ -3237,8 +3237,6 @@ static int mov_write_trailer(AVFormatContext *s)

}

avio_flush(pb);

av_freep(&mov->tracks);

return res;


+ 0
- 2
libavformat/mxfenc.c View File

@@ -1804,8 +1804,6 @@ static int mxf_write_footer(AVFormatContext *s)
}
}

avio_flush(pb);

ff_audio_interleave_close(s);

av_freep(&mxf->index_entries);


+ 1
- 1
libavformat/nutenc.c View File

@@ -851,7 +851,7 @@ static int nut_write_trailer(AVFormatContext *s){

while(nut->header_count<3)
write_headers(s, bc);
avio_flush(bc);
ff_nut_free_sp(nut);
av_freep(&nut->stream);
av_freep(&nut->chapter);


+ 1
- 1
libavformat/rmenc.c View File

@@ -455,7 +455,7 @@ static int rm_write_trailer(AVFormatContext *s)
avio_wb32(pb, 0);
avio_wb32(pb, 0);
}
avio_flush(pb);
return 0;
}



+ 0
- 2
libavformat/rsoenc.c View File

@@ -95,8 +95,6 @@ static int rso_write_trailer(AVFormatContext *s)
avio_wb16(pb, coded_file_size);
avio_seek(pb, file_size, SEEK_SET);

avio_flush(pb);

return 0;
}



+ 0
- 1
libavformat/smjpegenc.c View File

@@ -130,7 +130,6 @@ static int smjpeg_write_trailer(AVFormatContext *s)
}

avio_wl32(pb, SMJPEG_DONE);
avio_flush(pb);

return 0;
}


+ 0
- 2
libavformat/swfenc.c View File

@@ -485,8 +485,6 @@ static int swf_write_trailer(AVFormatContext *s)
put_swf_tag(s, TAG_END);
put_swf_end_tag(s);

avio_flush(s->pb);

/* patch file size and number of frames if not streamed */
if (s->pb->seekable && video_enc) {
file_size = avio_tell(pb);


+ 4
- 0
libavformat/utils.c View File

@@ -3270,6 +3270,10 @@ int av_write_trailer(AVFormatContext *s)

if (s->oformat->write_trailer)
ret = s->oformat->write_trailer(s);

if (!(s->oformat->flags & AVFMT_NOFILE))
avio_flush(s->pb);

fail:
for (i = 0; i < s->nb_streams; i++) {
av_freep(&s->streams[i]->priv_data);


+ 3
- 3
tests/ref/lavf/voc View File

@@ -1,3 +1,3 @@
b0bc287ce4e3eef7c1012610dd7ff6d0 *./tests/data/lavf/lavf.voc
32768 ./tests/data/lavf/lavf.voc
./tests/data/lavf/lavf.voc CRC=0xa2d77c12
5c4ee01048e7a8a138a97e80cf7a1924 *./tests/data/lavf/lavf.voc
45261 ./tests/data/lavf/lavf.voc
./tests/data/lavf/lavf.voc CRC=0x74b2b546

+ 3
- 3
tests/ref/lavf/voc_s16 View File

@@ -1,3 +1,3 @@
b20728bf036d2e23508869acbad4e576 *./tests/data/lavf/lavf.s16.voc
163840 ./tests/data/lavf/lavf.s16.voc
./tests/data/lavf/lavf.s16.voc CRC=0xfa9b6c39
8ed10b311e49b4d4b18679b126492159 *./tests/data/lavf/lavf.s16.voc
180437 ./tests/data/lavf/lavf.s16.voc
./tests/data/lavf/lavf.s16.voc CRC=0x7bd585ff

Loading…
Cancel
Save