lavfi/vf_elbg: switch to query_func2()

This commit is contained in:
Anton Khirnov 2024-10-04 10:09:29 +02:00
parent f59c1b8a0c
commit 2161abaecf
1 changed files with 8 additions and 6 deletions

View File

@ -85,9 +85,11 @@ static av_cold int init(AVFilterContext *ctx)
return 0; return 0;
} }
static int query_formats(AVFilterContext *ctx) static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{ {
ELBGFilterContext *const elbg = ctx->priv; const ELBGFilterContext *const elbg = ctx->priv;
int ret; int ret;
static const enum AVPixelFormat pix_fmts[] = { static const enum AVPixelFormat pix_fmts[] = {
@ -96,14 +98,14 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE AV_PIX_FMT_NONE
}; };
if (!elbg->pal8) { if (!elbg->pal8) {
return ff_set_common_formats_from_list(ctx, pix_fmts); return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, pix_fmts);
} else { } else {
static const enum AVPixelFormat pal8_fmt[] = { static const enum AVPixelFormat pal8_fmt[] = {
AV_PIX_FMT_PAL8, AV_PIX_FMT_PAL8,
AV_PIX_FMT_NONE AV_PIX_FMT_NONE
}; };
if ((ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->inputs[0]->outcfg.formats)) < 0 || if ((ret = ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_in[0]->formats)) < 0 ||
(ret = ff_formats_ref(ff_make_format_list(pal8_fmt), &ctx->outputs[0]->incfg.formats)) < 0) (ret = ff_formats_ref(ff_make_format_list(pal8_fmt), &cfg_out[0]->formats)) < 0)
return ret; return ret;
} }
return 0; return 0;
@ -264,5 +266,5 @@ const AVFilter ff_vf_elbg = {
.uninit = uninit, .uninit = uninit,
FILTER_INPUTS(elbg_inputs), FILTER_INPUTS(elbg_inputs),
FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_OUTPUTS(ff_video_default_filterpad),
FILTER_QUERY_FUNC(query_formats), FILTER_QUERY_FUNC2(query_formats),
}; };