aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-27 16:39:07 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-05 18:58:24 +0200
commit17e44e4d1fd2d6c18e2813f3acff2fe5eab7afcd (patch)
tree0d1bade4f65fe21941a0c3b99db9a3c7686d2cfe
parenta4722a4aa0b62d92fb0494217898e0306b988322 (diff)
downloadffmpeg-17e44e4d1fd2d6c18e2813f3acff2fe5eab7afcd.tar.gz
avfilter/vf_chromakey: 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_chromakey.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c
index 532d81ecf6..d08e127445 100644
--- a/libavfilter/vf_chromakey.c
+++ b/libavfilter/vf_chromakey.c
@@ -301,9 +301,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 chromakey_fmts[] = {
AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_YUVA422P,
AV_PIX_FMT_YUVA444P,
@@ -332,12 +330,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, "chromahold") ? hold_pixel_fmts : pixel_fmts;
-
- return ff_set_common_formats_from_list(avctx, pix_fmts);
-}
static av_cold int config_input(AVFilterLink *inlink)
{
@@ -401,7 +393,7 @@ const AVFilter ff_vf_chromakey = {
.priv_class = &chromakey_class,
FILTER_INPUTS(chromakey_inputs),
FILTER_OUTPUTS(chromakey_outputs),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_PIXFMTS_ARRAY(chromakey_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
.process_command = process_command,
};
@@ -441,7 +433,7 @@ const AVFilter ff_vf_chromahold = {
.priv_class = &chromahold_class,
FILTER_INPUTS(chromahold_inputs),
FILTER_OUTPUTS(chromahold_outputs),
- FILTER_QUERY_FUNC(query_formats),
+ FILTER_PIXFMTS_ARRAY(hold_pixel_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
.process_command = process_command,
};