-static int write_header_internal(AVFormatContext *s)
-{
- if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
- avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_HEADER);
- if (s->oformat->write_header) {
- int ret = s->oformat->write_header(s);
- if (ret >= 0 && s->pb && s->pb->error < 0)
- ret = s->pb->error;
- s->internal->write_header_ret = ret;
- if (ret < 0)
- return ret;
- flush_if_needed(s);
- }
- s->internal->header_written = 1;
- if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
- avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN);
- return 0;
-}
-