]> git.sesse.net Git - ffmpeg/commitdiff
avformat: remove avio_flush() calls from the end of write_header functions
authorMarton Balint <cus@passwd.hu>
Sat, 4 Jan 2020 18:03:24 +0000 (19:03 +0100)
committerMarton Balint <cus@passwd.hu>
Tue, 7 Jan 2020 20:51:45 +0000 (21:51 +0100)
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@passwd.hu>
28 files changed:
libavformat/aiffenc.c
libavformat/amr.c
libavformat/asfenc.c
libavformat/assenc.c
libavformat/astenc.c
libavformat/au.c
libavformat/avienc.c
libavformat/cafenc.c
libavformat/ffmetaenc.c
libavformat/framehash.c
libavformat/gxfenc.c
libavformat/icoenc.c
libavformat/idroqenc.c
libavformat/ilbc.c
libavformat/jacosubenc.c
libavformat/matroskaenc.c
libavformat/microdvdenc.c
libavformat/mmf.c
libavformat/movenc.c
libavformat/mpjpeg.c
libavformat/nutenc.c
libavformat/rmenc.c
libavformat/rsoenc.c
libavformat/smjpegenc.c
libavformat/soxenc.c
libavformat/swfenc.c
libavformat/wavenc.c
libavformat/webvttenc.c

index e25794d185551c3b07d498cf3ffa6c2c4558cdf1..ec2c7db09abb03aacd3c47fbbb61e35e061a80d5 100644 (file)
@@ -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;
 }
 
index 42840a50a300ff23d6ddfa56a1410770f0fdbd59..650b565b1b9afe7b64a95c7ce7cbc7c5b44c2388 100644 (file)
@@ -60,7 +60,6 @@ static int amr_write_header(AVFormatContext *s)
     } else {
         return -1;
     }
-    avio_flush(pb);
     return 0;
 }
 
index 44e11fc763515db25b37fa8fd93a31a584497ee8..d03cff91c0b4867209f5f33d2ee9648224be2687 100644 (file)
@@ -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;
index 12aadca1712257feb5b73bd585f5732793eaec46..68c3396e5add25159e921654c0c03e678caba1cd 100644 (file)
@@ -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;
 }
index 578e658891e3aff195ac9936924f77e4dd15b544..d38a3aab38b6e0f8f52ea0b790141942a5405d50 100644 (file)
@@ -101,8 +101,6 @@ static int ast_write_header(AVFormatContext *s)
     avio_wb64(pb, 0);
     avio_wb32(pb, 0);
 
-    avio_flush(pb);
-
     return 0;
 }
 
index cb48e67feb4f2e615562c71e0ace9f1d24995420..19a0f569636cfb8cbb1df8b143a49f2e99e5d7f7 100644 (file)
@@ -311,7 +311,6 @@ static int au_write_header(AVFormatContext *s)
     } else {
         avio_wb64(pb, 0); /* annotation field */
     }
-    avio_flush(pb);
 
     return 0;
 }
index 940ea33510245efb6fc80c5162787c1afeb5625f..23cc58ea76ccc9ce4c78048f7072d8f7a4b6578c 100644 (file)
@@ -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;
 }
 
index 0f7c4ebbb32c458946428147b84ab15d461cef3e..8fe1dcef19c1ac3024bee18fcac726e0ae205da7 100644 (file)
@@ -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;
 }
 
index a9adbb1d19c899afc7c939a1997750990ced394c..800fb1887c6f981eeca29bf3b27220faf88b4d85 100644 (file)
@@ -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;
 }
 
index 3ae9092c61de54f6a67085644461a4ffa8a46493..8d90793d7c7af942f2eb961f590a55b4d7f52580 100644 (file)
@@ -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;
 }
index ad9ddea8877b7ccdee493a153093d224d51b9869..c9fb0dcd91bd07f5364d46273af30a1c89f1dc8a 100644 (file)
@@ -834,7 +834,6 @@ static int gxf_write_header(AVFormatContext *s)
 
     gxf->packet_count = 3;
 
-    avio_flush(pb);
     return 0;
 }
 
index 975c3466bf2e2976605647f2326ec4edca46fe46..a7df8b72bc6ea237cdf86e6ba1927991e6f9cf0b 100644 (file)
@@ -106,8 +106,6 @@ static int ico_write_header(AVFormatContext *s)
     if (!ico->images)
         return AVERROR(ENOMEM);
 
-    avio_flush(pb);
-
     return 0;
 }
 
index 8122efef835d334f3315e277fe33da577d5e0368..261f21939cc65ffffc6da66ba2917b42a54051b1 100644 (file)
@@ -55,7 +55,6 @@ static int roq_write_header(struct AVFormatContext *s)
     }
 
     avio_write(s->pb, header, 8);
-    avio_flush(s->pb);
 
     return 0;
 }
index ba11953b59c9369a1befffde88fb08e7ca9ee1b8..01c7112ad176dfefa759e4cc65d32e4b2d9c5722 100644 (file)
@@ -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;
 }
 
index 0954f5f0585632f2404357553133b9d7c285a7f4..77575c6b3c0a94146e9efe924081984cb6d81171 100644 (file)
@@ -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;
 }
index 9dcd1946e88f86f693c062da22d3b8ed91616e7a..4b6d14b435fb33ea603fb7a2dac02669c9c45e46 100644 (file)
@@ -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) {
index 80e6fa8674e6a0b9849ceb40eff80f1478860bbd..1cd215d8def792158eeeb408998b0fd7e84d8c92 100644 (file)
@@ -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);
index 917113066aa6659359b582b2db836e23bb962eea..4e087fc9203eb85851ecebe5aec0b163100a4aac 100644 (file)
@@ -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;
 }
 
index e422bdd071a8a6fbb002db912388d76bb448b047..e20eea757142e9861c8027daec61b1b882f633b5 100644 (file)
@@ -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);
index 80f83c58719d604936b5f3b702a2e037f1149fca..e410e848017dabc81087839833f89c823455f9d7 100644 (file)
@@ -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;
 }
 
index 46dce7722dd968a2fa21e5ad58d4955d5b5933e6..44773924dd7e02227969fe015bcc54b401848123 100644 (file)
@@ -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;
 }
 
index 3bff4daf0a72c08c89b2b15cecb603af3f7b12a4..e137dbc44fe9ba7eba87630816fe928e6ab4f4de 100644 (file)
@@ -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;
 }
 
index e34e2c64e20ca476a5d5f54f5326b81d3b066a90..3159f0c42774edd6769a1a0fae675da7929f5b40 100644 (file)
@@ -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;
 }
 
index 68a128647e374b868491a3d646f4aa3f7ef7ff1b..c3c1a6346c5d3f828f2dcf075bb9cfb3d804c37a 100644 (file)
@@ -88,7 +88,6 @@ static int smjpeg_write_header(AVFormatContext *s)
     }
 
     avio_wl32(pb, SMJPEG_HEND);
-    avio_flush(pb);
 
     return 0;
 }
index 7b37bd48484919fb094878f1a84f4baf7019da60..7259131b036dd2bc42480fbb3cf0035806d05382 100644 (file)
@@ -80,8 +80,6 @@ static int sox_write_header(AVFormatContext *s)
 
     ffio_fill(pb, 0, comment_size - comment_len);
 
-    avio_flush(pb);
-
     return 0;
 }
 
index f53db0fb2b3ff41d93151fbb6afc70a74933b920..84f924eda52685027cd919fc169f8314395f17a4 100644 (file)
@@ -337,7 +337,6 @@ static int swf_write_header(AVFormatContext *s)
         put_swf_end_tag(s);
     }
 
-    avio_flush(s->pb);
     return 0;
 }
 
index 2b281490565cfe4800699614f284de657a0c7c2a..c44d6d26e9d591b3ee3d08cd85d93c90f362e197 100644 (file)
@@ -361,8 +361,6 @@ static int wav_write_header(AVFormatContext *s)
         wav->data = ff_start_tag(pb, "data");
     }
 
-    avio_flush(pb);
-
     return 0;
 }
 
index 61b7f5462299412f21340f5a341c12fa050b20fd..cbd989dcb6c3367d1e10ec68802c17f8af2b39bd 100644 (file)
@@ -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;
 }