diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-09-09 21:35:23 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-09-15 18:25:07 +0200 |
commit | 3b4bb19e63b41a0a542ba3ef254443b2e76a6a3e (patch) | |
tree | 8a4168cce911a68fa1f807881a9a9cd240f663ca /libavformat | |
parent | 0c270239c2acec8cf2f3924e2b956e15a41e8d1c (diff) | |
download | ffmpeg-3b4bb19e63b41a0a542ba3ef254443b2e76a6a3e.tar.gz |
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.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/asfenc.c | 1 | ||||
-rw-r--r-- | libavformat/assenc.c | 2 | ||||
-rw-r--r-- | libavformat/avienc.c | 1 | ||||
-rw-r--r-- | libavformat/crcenc.c | 2 | ||||
-rw-r--r-- | libavformat/ffmenc.c | 3 | ||||
-rw-r--r-- | libavformat/ffmetaenc.c | 2 | ||||
-rw-r--r-- | libavformat/filmstripenc.c | 2 | ||||
-rw-r--r-- | libavformat/gif.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 2 | ||||
-rw-r--r-- | libavformat/movenc.c | 2 | ||||
-rw-r--r-- | libavformat/mxfenc.c | 2 | ||||
-rw-r--r-- | libavformat/nutenc.c | 2 | ||||
-rw-r--r-- | libavformat/rmenc.c | 2 | ||||
-rw-r--r-- | libavformat/rsoenc.c | 2 | ||||
-rw-r--r-- | libavformat/smjpegenc.c | 1 | ||||
-rw-r--r-- | libavformat/swfenc.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 4 |
17 files changed, 10 insertions, 24 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index bcb741e04d..5c820becb2 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -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; } diff --git a/libavformat/assenc.c b/libavformat/assenc.c index 1ae8680597..5bf2e20134 100644 --- a/libavformat/assenc.c +++ b/libavformat/assenc.c @@ -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; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 40fd7adda8..86698794df 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -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; diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c index 4a13f1cd5d..3b30cc9199 100644 --- a/libavformat/crcenc.c +++ b/libavformat/crcenc.c @@ -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; } diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index 806930948b..c020672bf1 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -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; } diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index f75efea876..19fe6c960f 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -80,8 +80,6 @@ static int write_trailer(AVFormatContext *s) write_tags(s->pb, ch->metadata); } - avio_flush(s->pb); - return 0; } diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c index 91706fb993..d000c4f9f5 100644 --- a/libavformat/filmstripenc.c +++ b/libavformat/filmstripenc.c @@ -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; } diff --git a/libavformat/gif.c b/libavformat/gif.c index bfe63f3617..f11b267033 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -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; } diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 2400a6b914..9d9c223dbb 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -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; } diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 441da5c3c2..90c5806f50 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3237,8 +3237,6 @@ static int mov_write_trailer(AVFormatContext *s) } - avio_flush(pb); - av_freep(&mov->tracks); return res; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index f25e08bb38..3d32be354a 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1804,8 +1804,6 @@ static int mxf_write_footer(AVFormatContext *s) } } - avio_flush(pb); - ff_audio_interleave_close(s); av_freep(&mxf->index_entries); diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 9675af176e..df0301b5e7 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -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); diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 63202b1221..ed1ba7c75b 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -455,7 +455,7 @@ static int rm_write_trailer(AVFormatContext *s) avio_wb32(pb, 0); avio_wb32(pb, 0); } - avio_flush(pb); + return 0; } diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 4d560cbca0..cc76f9afd2 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -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; } diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c index 86b6afaa16..59ede7a266 100644 --- a/libavformat/smjpegenc.c +++ b/libavformat/smjpegenc.c @@ -130,7 +130,6 @@ static int smjpeg_write_trailer(AVFormatContext *s) } avio_wl32(pb, SMJPEG_DONE); - avio_flush(pb); return 0; } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 19166503e8..9de8b679d7 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -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); diff --git a/libavformat/utils.c b/libavformat/utils.c index b555ad0ff7..b5b49c93c4 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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); |