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

Function of_stream_init

fftools/ffmpeg_mux.c:611–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611int of_stream_init(OutputFile *of, OutputStream *ost,
612 const AVCodecContext *enc_ctx)
613{
614 Muxer *mux = mux_from_of(of);
615 MuxStream *ms = ms_from_ost(ost);
616 int ret;
617
618 if (enc_ctx) {
619 // use upstream time base unless it has been overridden previously
620 if (ost->st->time_base.num <= 0 || ost->st->time_base.den <= 0)
621 ost->st->time_base = av_add_q(enc_ctx->time_base, (AVRational){0, 1});
622
623 ost->st->avg_frame_rate = enc_ctx->framerate;
624 ost->st->sample_aspect_ratio = enc_ctx->sample_aspect_ratio;
625
626 ret = avcodec_parameters_from_context(ms->par_in, enc_ctx);
627 if (ret < 0) {
628 av_log(ost, AV_LOG_FATAL,
629 "Error initializing the output stream codec parameters.\n");
630 return ret;
631 }
632 }
633
634 /* initialize bitstream filters for the output stream
635 * needs to be done here, because the codec id for streamcopy is not
636 * known until now */
637 ret = bsf_init(ms);
638 if (ret < 0)
639 return ret;
640
641 if (ms->stream_duration) {
642 ost->st->duration = av_rescale_q(ms->stream_duration, ms->stream_duration_tb,
643 ost->st->time_base);
644 }
645
646 if (ms->sch_idx >= 0)
647 return sch_mux_stream_ready(mux->sch, of->index, ms->sch_idx);
648
649 return 0;
650}
651
652static int check_written(OutputFile *of)
653{

Callers 2

enc_openFunction · 0.85
of_openFunction · 0.85

Calls 8

mux_from_ofFunction · 0.85
ms_from_ostFunction · 0.85
av_add_qFunction · 0.85
av_logFunction · 0.85
bsf_initFunction · 0.85
av_rescale_qFunction · 0.85
sch_mux_stream_readyFunction · 0.85

Tested by

no test coverage detected