diff options
author | Niklas Haas <git@haasn.dev> | 2024-04-05 20:47:48 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2024-09-08 13:59:29 +0200 |
commit | 33d5a4ec4eaf3d206eb229faf7276e0d0e543b34 (patch) | |
tree | 37fa310d38f63fb3cfa63831d13d6bd589174a93 /fftools/ffmpeg_mux_init.c | |
parent | f3e265c6905a173f0ad88fa12950ed8706f6f5d8 (diff) | |
download | ffmpeg-33d5a4ec4eaf3d206eb229faf7276e0d0e543b34.tar.gz |
fftools/ffmpeg_filter: switch to avcodec_get_supported_config()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'fftools/ffmpeg_mux_init.c')
-rw-r--r-- | fftools/ffmpeg_mux_init.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 79bdca013f..a2cb0ba294 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -952,6 +952,39 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, snprintf(name, sizeof(name), "#%d:%d", mux->of.index, ost->index); + if (ost->type == AVMEDIA_TYPE_VIDEO) { + if (!keep_pix_fmt) { + ret = avcodec_get_supported_config(enc_ctx, NULL, + AV_CODEC_CONFIG_PIX_FORMAT, 0, + (const void **) &opts.formats, NULL); + if (ret < 0) + return ret; + } + if (!ost->force_fps) { + ret = avcodec_get_supported_config(enc_ctx, NULL, + AV_CODEC_CONFIG_FRAME_RATE, 0, + (const void **) &opts.frame_rates, NULL); + if (ret < 0) + return ret; + } + } else { + ret = avcodec_get_supported_config(enc_ctx, NULL, + AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, + (const void **) &opts.formats, NULL); + if (ret < 0) + return ret; + ret = avcodec_get_supported_config(enc_ctx, NULL, + AV_CODEC_CONFIG_SAMPLE_RATE, 0, + (const void **) &opts.sample_rates, NULL); + if (ret < 0) + return ret; + ret = avcodec_get_supported_config(enc_ctx, NULL, + AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0, + (const void **) &opts.ch_layouts, NULL); + if (ret < 0) + return ret; + } + // MJPEG encoder exports a full list of supported pixel formats, // but the full-range ones are experimental-only. // Restrict the auto-conversion list unless -strict experimental @@ -964,7 +997,7 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, AV_PIX_FMT_NONE }; if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) - opts.pix_fmts = mjpeg_formats; + opts.formats = mjpeg_formats; } if (threads_manual) { |