diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-27 16:44:14 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-05 18:58:24 +0200 |
commit | a26efeb121a8db26ca31727204b23ef77f2f898b (patch) | |
tree | abe861d093932ade4692a83ce0ca1af36dbe14f1 | |
parent | 253dc9bbc0f708275e49f85adbd1e95037894f2b (diff) |
avfilter/vf_hsvkey: Use formats list instead of query function
In this case it also allows to avoid a runtime check to which filter
an AVFilterContext belongs to.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavfilter/vf_hsvkey.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libavfilter/vf_hsvkey.c b/libavfilter/vf_hsvkey.c index 30dcbfc029..7f2f191baf 100644 --- a/libavfilter/vf_hsvkey.c +++ b/libavfilter/vf_hsvkey.c @@ -244,9 +244,7 @@ static av_cold int config_output(AVFilterLink *outlink) return 0; } -static av_cold int query_formats(AVFilterContext *avctx) -{ - static const enum AVPixelFormat pixel_fmts[] = { +static const enum AVPixelFormat key_pixel_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, @@ -275,12 +273,6 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - const enum AVPixelFormat *pix_fmts; - - pix_fmts = !strcmp(avctx->filter->name, "hsvhold") ? hold_pixel_fmts : pixel_fmts; - - return ff_set_common_formats_from_list(avctx, pix_fmts); -} static av_cold int config_input(AVFilterLink *inlink) { @@ -333,7 +325,7 @@ const AVFilter ff_vf_hsvkey = { .priv_class = &hsvkey_class, FILTER_INPUTS(hsvkey_inputs), FILTER_OUTPUTS(hsvkey_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_PIXFMTS_ARRAY(key_pixel_fmts), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; @@ -374,7 +366,7 @@ const AVFilter ff_vf_hsvhold = { .priv_class = &hsvhold_class, FILTER_INPUTS(hsvhold_inputs), FILTER_OUTPUTS(hsvhold_outputs), - FILTER_QUERY_FUNC(query_formats), + FILTER_PIXFMTS_ARRAY(hold_pixel_fmts), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; |