This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 7d905abec6ab565ac3afbaa7840ed278a330eab2 Author: James Almer <[email protected]> AuthorDate: Mon Feb 10 23:20:07 2025 -0300 Commit: James Almer <[email protected]> CommitDate: Thu Aug 13 11:04:44 2026 -0300 fftools/ffmpeg_enc: store a few more AVCodecContext fields in Encoder Preparation work for the following commits. Signed-off-by: James Almer <[email protected]> --- fftools/ffmpeg.h | 5 +++++ fftools/ffmpeg_enc.c | 6 ++++++ fftools/ffmpeg_mux_init.c | 14 +++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index a45d004fdf..11682b34bb 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -607,6 +607,11 @@ typedef struct Encoder { AVCodecContext *enc_ctx; + uint32_t codec_tag; + int flags; + int flags2; + int global_quality; + // number of frames/samples sent to the encoder uint64_t frames_encoded; uint64_t samples_encoded; diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 1fe43ae314..dfc7d5e9d8 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -209,6 +209,12 @@ static int enc_reopen(void *opaque, const AVFrame *frame) if (ist) dec = ist->decoder; + if (ost->enc->codec_tag) + enc_ctx->codec_tag = e->codec_tag; + enc_ctx->flags |= e->flags; + enc_ctx->flags2 |= e->flags2; + enc_ctx->global_quality = e->global_quality; + // the timebase is chosen by filtering code if (ost->type == AVMEDIA_TYPE_AUDIO || ost->type == AVMEDIA_TYPE_VIDEO) { enc_ctx->time_base = frame->time_base; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 393ed9b668..702a39c8d7 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1435,13 +1435,13 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, ost->st->codecpar->codec_tag = tag; ms->par_in->codec_tag = tag; if (ost->enc) - ost->enc->enc_ctx->codec_tag = tag; + ost->enc->codec_tag = tag; } opt_match_per_stream_dbl(ost, &o->qscale, oc, st, &qscale); if (ost->enc && qscale >= 0) { - ost->enc->enc_ctx->flags |= AV_CODEC_FLAG_QSCALE; - ost->enc->enc_ctx->global_quality = FF_QP2LAMBDA * qscale; + ost->enc->flags |= AV_CODEC_FLAG_QSCALE; + ost->enc->global_quality = FF_QP2LAMBDA * qscale; } if (ms->sch_idx >= 0) { @@ -1464,9 +1464,9 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, oc, st, &ost->fix_sub_duration_heartbeat); if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->enc) - ost->enc->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; + ost->enc->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; if (oc->oformat->flags & AVFMT_FIXED_FRAMESIZE && ost->enc) - ost->enc->enc_ctx->flags2 |= AV_CODEC_FLAG2_FIXED_FRAME_SIZE; + ost->enc->flags2 |= AV_CODEC_FLAG2_FIXED_FRAME_SIZE; opt_match_per_stream_int(ost, &o->copy_initial_nonkeyframes, oc, st, &ms->copy_initial_nonkeyframes); @@ -2064,7 +2064,7 @@ static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, nb_av_enc += IS_AV_ENC(ost, type); nb_audio_fs += (ost->enc && type == AVMEDIA_TYPE_AUDIO && (!(ost->enc->enc_ctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) || - (ost->enc->enc_ctx->flags2 & AV_CODEC_FLAG2_FIXED_FRAME_SIZE))); + (ost->enc->flags2 & AV_CODEC_FLAG2_FIXED_FRAME_SIZE))); limit_frames |= ms->max_frames < INT64_MAX; limit_frames_av_enc |= (ms->max_frames < INT64_MAX) && IS_AV_ENC(ost, type); @@ -2596,7 +2596,7 @@ static int of_parse_group_token(Muxer *mux, const char *token, char *ptr) OutputStream *ost = mux->of.streams[idx]; if (ost->enc && (type == AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT || type == AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION)) - ost->enc->enc_ctx->flags2 |= AV_CODEC_FLAG2_FIXED_FRAME_SIZE; + ost->enc->flags2 |= AV_CODEC_FLAG2_FIXED_FRAME_SIZE; } while (e = av_dict_get(dict, "stg", e, 0)) { char *endptr; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
