MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / avformat_write_header

Function avformat_write_header

libavformat/mux.c:467–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467int avformat_write_header(AVFormatContext *s, AVDictionary **options)
468{
469 FormatContextInternal *const fci = ff_fc_internal(s);
470 int already_initialized = fci->initialized;
471 int streams_already_initialized = fci->streams_initialized;
472 int ret = 0;
473
474 if (!already_initialized)
475 if ((ret = avformat_init_output(s, options)) < 0)
476 return ret;
477
478 if (ffofmt(s->oformat)->write_header) {
479 if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
480 avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_HEADER);
481 ret = ffofmt(s->oformat)->write_header(s);
482 if (ret >= 0 && s->pb && s->pb->error < 0)
483 ret = s->pb->error;
484 if (ret < 0)
485 goto fail;
486 flush_if_needed(s);
487 }
488 if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
489 avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN);
490
491 if (!fci->streams_initialized) {
492 if ((ret = init_pts(s)) < 0)
493 goto fail;
494 }
495
496 return streams_already_initialized;
497
498fail:
499 deinit_muxer(s);
500 return ret;
501}
502
503#define AV_PKT_FLAG_UNCODED_FRAME 0x2000
504

Callers 15

mainFunction · 0.85
hls_startFunction · 0.85
hls_write_headerFunction · 0.85
webm_chunk_write_headerFunction · 0.85
open_slaveFunction · 0.85
write_muxed_fileFunction · 0.85
segment_startFunction · 0.85
seg_initFunction · 0.85
seg_write_headerFunction · 0.85
create_rtp_muxerFunction · 0.85
ff_rtp_chain_mux_openFunction · 0.85

Calls 6

avformat_init_outputFunction · 0.85
ffofmtFunction · 0.85
avio_write_markerFunction · 0.85
flush_if_neededFunction · 0.85
init_ptsFunction · 0.85
deinit_muxerFunction · 0.85

Tested by 3

fifo_basic_testFunction · 0.68
fifo_overflow_drop_testFunction · 0.68
init_fpsFunction · 0.68