fftools/ffmpeg_filter: pass sws/swr opts through OutputFilterOptions

Do not read them from OutputStream directly.

Will allow decoupling filtering from encoding in future commits.
This commit is contained in:
Anton Khirnov
2024-04-02 13:58:59 +02:00
parent 23c23077fc
commit b8e6802023
4 changed files with 31 additions and 17 deletions

View File

@@ -1356,12 +1356,6 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
if (oc->oformat->flags & AVFMT_GLOBALHEADER && ost->enc_ctx)
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
av_dict_copy(&ost->sws_dict, o->g->sws_dict, 0);
av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0);
if (ost->enc_ctx && av_get_exact_bits_per_sample(ost->enc_ctx->codec_id) == 24)
av_dict_set(&ost->swr_opts, "output_sample_bits", "24", 0);
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i,
ms->copy_initial_nonkeyframes, oc, st);
@@ -1392,10 +1386,13 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
.vsync_method = vsync_method,
.sample_rate = ost->enc_ctx->sample_rate,
.ch_layout = ost->enc_ctx->ch_layout,
.sws_opts = o->g->sws_dict,
.swr_opts = o->g->swr_opts,
.output_tb = enc_tb,
.ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
0 : mux->of.start_time,
.flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt,
.flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt |
OFILTER_FLAG_AUDIO_24BIT * !!(av_get_exact_bits_per_sample(ost->enc_ctx->codec_id) == 24),
};
snprintf(name, sizeof(name), "#%d:%d", mux->of.index, ost->index);