[FFmpeg-cvslog] avformat: remove avio_flush() calls from the end of write_header functions
Marton Balint
git at videolan.org
Tue Jan 7 23:21:06 EET 2020
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Jan 4 19:03:24 2020 +0100| [4bf90e095b361cb11371921bf6eb357831d857b2] | committer: Marton Balint
avformat: remove avio_flush() calls from the end of write_header functions
To make it consistent with other muxers.
The user can still control the generic flushing behaviour after write_header
(same way as after packets) using the -flush_packets option, the default
typically means to flush unless a non-streamed file output is used.
Therefore this change should have no adverse effect on streaming, even if it is
assumed that the first packet has a clean buffer, so small seekbacks within the
output buffer work even when the IO context is not seekable.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bf90e095b361cb11371921bf6eb357831d857b2
---
libavformat/aiffenc.c | 3 ---
libavformat/amr.c | 1 -
libavformat/asfenc.c | 2 --
libavformat/assenc.c | 1 -
libavformat/astenc.c | 2 --
libavformat/au.c | 1 -
libavformat/avienc.c | 2 --
libavformat/cafenc.c | 1 -
libavformat/ffmetaenc.c | 1 -
libavformat/framehash.c | 1 -
libavformat/gxfenc.c | 1 -
libavformat/icoenc.c | 2 --
libavformat/idroqenc.c | 1 -
libavformat/ilbc.c | 1 -
libavformat/jacosubenc.c | 1 -
libavformat/matroskaenc.c | 2 --
libavformat/microdvdenc.c | 1 -
libavformat/mmf.c | 2 --
libavformat/movenc.c | 1 -
libavformat/mpjpeg.c | 1 -
libavformat/nutenc.c | 2 --
libavformat/rmenc.c | 1 -
libavformat/rsoenc.c | 2 --
libavformat/smjpegenc.c | 1 -
libavformat/soxenc.c | 2 --
libavformat/swfenc.c | 1 -
libavformat/wavenc.c | 2 --
libavformat/webvttenc.c | 1 -
28 files changed, 40 deletions(-)
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index e25794d185..ec2c7db09a 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -199,9 +199,6 @@ static int aiff_write_header(AVFormatContext *s)
avpriv_set_pts_info(s->streams[aiff->audio_stream_idx], 64, 1,
s->streams[aiff->audio_stream_idx]->codecpar->sample_rate);
- /* Data is starting here */
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 42840a50a3..650b565b1b 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -60,7 +60,6 @@ static int amr_write_header(AVFormatContext *s)
} else {
return -1;
}
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 44e11fc763..d03cff91c0 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -801,8 +801,6 @@ static int asf_write_header(AVFormatContext *s)
return -1;
}
- avio_flush(s->pb);
-
asf->packet_nb_payloads = 0;
asf->packet_timestamp_start = -1;
asf->packet_timestamp_end = -1;
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index 12aadca171..68c3396e5a 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -77,7 +77,6 @@ static int write_header(AVFormatContext *s)
avio_printf(s->pb, "[Events]\r\nFormat: %s, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
ass->ssa_mode ? "Marked" : "Layer");
}
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/astenc.c b/libavformat/astenc.c
index 578e658891..d38a3aab38 100644
--- a/libavformat/astenc.c
+++ b/libavformat/astenc.c
@@ -101,8 +101,6 @@ static int ast_write_header(AVFormatContext *s)
avio_wb64(pb, 0);
avio_wb32(pb, 0);
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/au.c b/libavformat/au.c
index cb48e67feb..19a0f56963 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -311,7 +311,6 @@ static int au_write_header(AVFormatContext *s)
} else {
avio_wb64(pb, 0); /* annotation field */
}
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 940ea33510..23cc58ea76 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -580,8 +580,6 @@ static int avi_write_header(AVFormatContext *s)
avi->movi_list = ff_start_tag(pb, "LIST");
ffio_wfourcc(pb, "movi");
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 0f7c4ebbb3..8fe1dcef19 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -203,7 +203,6 @@ static int caf_write_header(AVFormatContext *s)
avio_wb64(pb, -1); //< mChunkSize
avio_wb32(pb, 0); //< mEditCount
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c
index a9adbb1d19..800fb1887c 100644
--- a/libavformat/ffmetaenc.c
+++ b/libavformat/ffmetaenc.c
@@ -54,7 +54,6 @@ static int write_header(AVFormatContext *s)
avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1);
avio_w8(s->pb, '1'); // version
avio_w8(s->pb, '\n');
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/framehash.c b/libavformat/framehash.c
index 3ae9092c61..8d90793d7c 100644
--- a/libavformat/framehash.c
+++ b/libavformat/framehash.c
@@ -45,7 +45,6 @@ int ff_framehash_write_header(AVFormatContext *s)
avio_printf(s->pb, "#sar %d: %d/%d\n", i, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
break;
}
- avio_flush(s->pb);
}
return 0;
}
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index ad9ddea887..c9fb0dcd91 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -834,7 +834,6 @@ static int gxf_write_header(AVFormatContext *s)
gxf->packet_count = 3;
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/icoenc.c b/libavformat/icoenc.c
index 975c3466bf..a7df8b72bc 100644
--- a/libavformat/icoenc.c
+++ b/libavformat/icoenc.c
@@ -106,8 +106,6 @@ static int ico_write_header(AVFormatContext *s)
if (!ico->images)
return AVERROR(ENOMEM);
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c
index 8122efef83..261f21939c 100644
--- a/libavformat/idroqenc.c
+++ b/libavformat/idroqenc.c
@@ -55,7 +55,6 @@ static int roq_write_header(struct AVFormatContext *s)
}
avio_write(s->pb, header, 8);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index ba11953b59..01c7112ad1 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -49,7 +49,6 @@ static int ilbc_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "Unsupported mode\n");
return AVERROR(EINVAL);
}
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/jacosubenc.c b/libavformat/jacosubenc.c
index 0954f5f058..77575c6b3c 100644
--- a/libavformat/jacosubenc.c
+++ b/libavformat/jacosubenc.c
@@ -25,7 +25,6 @@ static int jacosub_write_header(AVFormatContext *s)
if (par->extradata_size) {
avio_write(s->pb, par->extradata, par->extradata_size - 1);
- avio_flush(s->pb);
}
return 0;
}
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9dcd1946e8..4b6d14b435 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2000,8 +2000,6 @@ static int mkv_write_header(AVFormatContext *s)
mkv->cur_audio_pkt.size = 0;
mkv->cluster_pos = -1;
- avio_flush(pb);
-
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
// after 4k and on a keyframe
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c
index 80e6fa8674..1cd215d8de 100644
--- a/libavformat/microdvdenc.c
+++ b/libavformat/microdvdenc.c
@@ -37,7 +37,6 @@ static int microdvd_write_header(struct AVFormatContext *s)
avio_write(s->pb, "{DEFAULT}{}", 11);
avio_write(s->pb, par->extradata, par->extradata_size);
avio_w8(s->pb, '\n');
- avio_flush(s->pb);
}
avpriv_set_pts_info(s->streams[0], 64, framerate.num, framerate.den);
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 917113066a..4e087fc920 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -123,8 +123,6 @@ static int mmf_write_header(AVFormatContext *s)
avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codecpar->sample_rate);
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e422bdd071..e20eea7571 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6579,7 +6579,6 @@ static int mov_write_header(AVFormatContext *s)
!(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) {
if ((ret = mov_write_moov_tag(pb, mov, s)) < 0)
return ret;
- avio_flush(pb);
mov->moov_written = 1;
if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)
mov->reserved_header_pos = avio_tell(pb);
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 80f83c5871..e410e84801 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -34,7 +34,6 @@ static int mpjpeg_write_header(AVFormatContext *s)
{
MPJPEGContext *mpj = s->priv_data;
avio_printf(s->pb, "--%s\r\n", mpj->boundary_tag);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 46dce7722d..44773924dd 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -768,8 +768,6 @@ static int nut_write_header(AVFormatContext *s)
if (s->avoid_negative_ts < 0)
s->avoid_negative_ts = 1;
- avio_flush(bc);
-
return 0;
}
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 3bff4daf0a..e137dbc44f 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -360,7 +360,6 @@ static int rm_write_header(AVFormatContext *s)
if (rv10_write_header(s, 0, 0))
return AVERROR_INVALIDDATA;
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c
index e34e2c64e2..3159f0c427 100644
--- a/libavformat/rsoenc.c
+++ b/libavformat/rsoenc.c
@@ -60,8 +60,6 @@ static int rso_write_header(AVFormatContext *s)
avio_wb16(pb, par->sample_rate);
avio_wb16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 68a128647e..c3c1a6346c 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -88,7 +88,6 @@ static int smjpeg_write_header(AVFormatContext *s)
}
avio_wl32(pb, SMJPEG_HEND);
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
index 7b37bd4848..7259131b03 100644
--- a/libavformat/soxenc.c
+++ b/libavformat/soxenc.c
@@ -80,8 +80,6 @@ static int sox_write_header(AVFormatContext *s)
ffio_fill(pb, 0, comment_size - comment_len);
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index f53db0fb2b..84f924eda5 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -337,7 +337,6 @@ static int swf_write_header(AVFormatContext *s)
put_swf_end_tag(s);
}
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 2b28149056..c44d6d26e9 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -361,8 +361,6 @@ static int wav_write_header(AVFormatContext *s)
wav->data = ff_start_tag(pb, "data");
}
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 61b7f54622..cbd989dcb6 100644
--- a/libavformat/webvttenc.c
+++ b/libavformat/webvttenc.c
@@ -57,7 +57,6 @@ static int webvtt_write_header(AVFormatContext *ctx)
avpriv_set_pts_info(s, 64, 1, 1000);
avio_printf(pb, "WEBVTT\n");
- avio_flush(pb);
return 0;
}
More information about the ffmpeg-cvslog
mailing list