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>
pull/331/head
Marton Balint 5 years ago
parent 4d7f8254ac
commit 4bf90e095b
  1. 3
      libavformat/aiffenc.c
  2. 1
      libavformat/amr.c
  3. 2
      libavformat/asfenc.c
  4. 1
      libavformat/assenc.c
  5. 2
      libavformat/astenc.c
  6. 1
      libavformat/au.c
  7. 2
      libavformat/avienc.c
  8. 1
      libavformat/cafenc.c
  9. 1
      libavformat/ffmetaenc.c
  10. 1
      libavformat/framehash.c
  11. 1
      libavformat/gxfenc.c
  12. 2
      libavformat/icoenc.c
  13. 1
      libavformat/idroqenc.c
  14. 1
      libavformat/ilbc.c
  15. 1
      libavformat/jacosubenc.c
  16. 2
      libavformat/matroskaenc.c
  17. 1
      libavformat/microdvdenc.c
  18. 2
      libavformat/mmf.c
  19. 1
      libavformat/movenc.c
  20. 1
      libavformat/mpjpeg.c
  21. 2
      libavformat/nutenc.c
  22. 1
      libavformat/rmenc.c
  23. 2
      libavformat/rsoenc.c
  24. 1
      libavformat/smjpegenc.c
  25. 2
      libavformat/soxenc.c
  26. 1
      libavformat/swfenc.c
  27. 2
      libavformat/wavenc.c
  28. 1
      libavformat/webvttenc.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;
}

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

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

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

@ -101,8 +101,6 @@ static int ast_write_header(AVFormatContext *s)
avio_wb64(pb, 0);
avio_wb32(pb, 0);
avio_flush(pb);
return 0;
}

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

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

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

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

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

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

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

@ -55,7 +55,6 @@ static int roq_write_header(struct AVFormatContext *s)
}
avio_write(s->pb, header, 8);
avio_flush(s->pb);
return 0;
}

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

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

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

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

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

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

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

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

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

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

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

@ -80,8 +80,6 @@ static int sox_write_header(AVFormatContext *s)
ffio_fill(pb, 0, comment_size - comment_len);
avio_flush(pb);
return 0;
}

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

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

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

Loading…
Cancel
Save