mirror of https://git.ffmpeg.org/ffmpeg.git
lavfi/vf_alphamerge: switch to query_func2()
Simplify the implementation by using the fact that ff_set_common_*() will ignore those links on which the formats have already been set.
This commit is contained in:
parent
a2881814b8
commit
7ab1ddbaf3
|
@ -96,7 +96,9 @@ 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)
|
||||||
{
|
{
|
||||||
static const enum AVPixelFormat main_fmts[] = {
|
static const enum AVPixelFormat main_fmts[] = {
|
||||||
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
|
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
|
||||||
|
@ -105,15 +107,18 @@ static int query_formats(AVFilterContext *ctx)
|
||||||
AV_PIX_FMT_NONE
|
AV_PIX_FMT_NONE
|
||||||
};
|
};
|
||||||
static const enum AVPixelFormat alpha_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
|
static const enum AVPixelFormat alpha_fmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
|
||||||
AVFilterFormats *main_formats = ff_make_format_list(main_fmts);
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((ret = ff_formats_ref(main_formats, &ctx->inputs[0]->outcfg.formats)) < 0 ||
|
ret = ff_formats_ref(ff_make_format_list(alpha_fmts),
|
||||||
(ret = ff_formats_ref(main_formats, &ctx->outputs[0]->incfg.formats)) < 0)
|
&cfg_in[1]->formats);
|
||||||
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return ff_formats_ref(ff_make_format_list(alpha_fmts),
|
ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, main_fmts);
|
||||||
&ctx->inputs[1]->outcfg.formats);
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_input_main(AVFilterLink *inlink)
|
static int config_input_main(AVFilterLink *inlink)
|
||||||
|
@ -203,7 +208,7 @@ const AVFilter ff_vf_alphamerge = {
|
||||||
.init = init,
|
.init = init,
|
||||||
FILTER_INPUTS(alphamerge_inputs),
|
FILTER_INPUTS(alphamerge_inputs),
|
||||||
FILTER_OUTPUTS(alphamerge_outputs),
|
FILTER_OUTPUTS(alphamerge_outputs),
|
||||||
FILTER_QUERY_FUNC(query_formats),
|
FILTER_QUERY_FUNC2(query_formats),
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
.activate = activate,
|
.activate = activate,
|
||||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
|
||||||
|
|
Loading…
Reference in New Issue