mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
doc/examples/transcode: query encoder for supported configs
avcodec_get_supported_config() is called with dec_ctx (the decoder context) to query supported pixel formats and sample formats, but the intent is to configure the encoder. The decoder supported format list may differ from the encoder, leading to format negotiation failures or incorrect output. Pass enc_ctx instead so the actual encoder capabilities are queried. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
@@ -177,7 +177,7 @@ static int open_output_file(const char *filename)
|
||||
enc_ctx->width = dec_ctx->width;
|
||||
enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
|
||||
|
||||
ret = avcodec_get_supported_config(dec_ctx, NULL,
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
AV_CODEC_CONFIG_PIX_FORMAT, 0,
|
||||
(const void**)&pix_fmts, NULL);
|
||||
|
||||
@@ -195,7 +195,7 @@ static int open_output_file(const char *filename)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = avcodec_get_supported_config(dec_ctx, NULL,
|
||||
ret = avcodec_get_supported_config(enc_ctx, NULL,
|
||||
AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
|
||||
(const void**)&sample_fmts, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user