[FFmpeg-devel] [PATCH 076/218] avfilter/vf_chromakey: Use formats list instead of query function
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Sep 30 16:40:17 EEST 2021
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 at outlook.com>
---
libavfilter/vf_chromakey.c | 14 +++-----------
1 file 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,
};
--
2.30.2
More information about the ffmpeg-devel
mailing list