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@passwd.hu>
This commit is contained in:
Marton Balint 2020-01-04 19:03:24 +01:00
parent 4d7f8254ac
commit 4bf90e095b
28 changed files with 0 additions and 40 deletions

View 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;
}

View File

@ -60,7 +60,6 @@ static int amr_write_header(AVFormatContext *s)
} else {
return -1;
}
avio_flush(pb);
return 0;
}

View 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;

View 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;
}

View 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;
}

View File

@ -311,7 +311,6 @@ static int au_write_header(AVFormatContext *s)
} else {
avio_wb64(pb, 0); /* annotation field */
}
avio_flush(pb);
return 0;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View File

@ -834,7 +834,6 @@ static int gxf_write_header(AVFormatContext *s)
gxf->packet_count = 3;
avio_flush(pb);
return 0;
}

View File

@ -106,8 +106,6 @@ static int ico_write_header(AVFormatContext *s)
if (!ico->images)
return AVERROR(ENOMEM);
avio_flush(pb);
return 0;
}

View 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;
}

View 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;
}

View 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;
}

View 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) {

View 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);

View 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;
}

View 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);

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View File

@ -88,7 +88,6 @@ static int smjpeg_write_header(AVFormatContext *s)
}
avio_wl32(pb, SMJPEG_HEND);
avio_flush(pb);
return 0;
}

View 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;
}

View File

@ -337,7 +337,6 @@ static int swf_write_header(AVFormatContext *s)
put_swf_end_tag(s);
}
avio_flush(s->pb);
return 0;
}

View File

@ -361,8 +361,6 @@ static int wav_write_header(AVFormatContext *s)
wav->data = ff_start_tag(pb, "data");
}
avio_flush(pb);
return 0;
}

View 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;
}