[FFmpeg-devel] [PATCH 14/16] lavfi/vf_stack_{vaapi, qsv}: replace query_formats with a pixfmt list

Anton Khirnov anton at khirnov.net
Tue Oct 1 13:54:19 EEST 2024


---
 libavfilter/stack_internal.c |  2 +-
 libavfilter/vf_stack_qsv.c   | 17 ++++++-----------
 libavfilter/vf_stack_vaapi.c | 13 ++++---------
 3 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/libavfilter/stack_internal.c b/libavfilter/stack_internal.c
index b473fa982d..fcec119bac 100644
--- a/libavfilter/stack_internal.c
+++ b/libavfilter/stack_internal.c
@@ -350,7 +350,7 @@ static const AVFilterPad stack_outputs[] = {
         .init           = api##_stack_init,                             \
         .uninit         = api##_stack_uninit,                           \
         .activate       = stack_activate,                               \
-        FILTER_QUERY_FUNC(api##_stack_query_formats),                   \
+        FILTER_PIXFMTS_ARRAY(api ## _stack_pix_fmts),                   \
         FILTER_OUTPUTS(stack_outputs),                                  \
         .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,                 \
         .flags          = AVFILTER_FLAG_DYNAMIC_INPUTS | filter_flags,  \
diff --git a/libavfilter/vf_stack_qsv.c b/libavfilter/vf_stack_qsv.c
index 9c4ca4abd2..82fb3c09a3 100644
--- a/libavfilter/vf_stack_qsv.c
+++ b/libavfilter/vf_stack_qsv.c
@@ -223,17 +223,12 @@ static av_cold void qsv_stack_uninit(AVFilterContext *ctx)
     av_freep(&sctx->qsv_param.ext_buf);
 }
 
-static int qsv_stack_query_formats(AVFilterContext *ctx)
-{
-    static const enum AVPixelFormat pixel_formats[] = {
-        AV_PIX_FMT_NV12,
-        AV_PIX_FMT_P010,
-        AV_PIX_FMT_QSV,
-        AV_PIX_FMT_NONE,
-    };
-
-    return ff_set_common_formats_from_list(ctx, pixel_formats);
-}
+static const enum AVPixelFormat qsv_stack_pix_fmts[] = {
+    AV_PIX_FMT_NV12,
+    AV_PIX_FMT_P010,
+    AV_PIX_FMT_QSV,
+    AV_PIX_FMT_NONE,
+};
 
 #include "stack_internal.c"
 
diff --git a/libavfilter/vf_stack_vaapi.c b/libavfilter/vf_stack_vaapi.c
index 602a7825a3..9ab4d8ab5b 100644
--- a/libavfilter/vf_stack_vaapi.c
+++ b/libavfilter/vf_stack_vaapi.c
@@ -220,15 +220,10 @@ static av_cold void vaapi_stack_uninit(AVFilterContext *avctx)
     av_freep(&sctx->rects);
 }
 
-static int vaapi_stack_query_formats(AVFilterContext *avctx)
-{
-    static const enum AVPixelFormat pixel_formats[] = {
-        AV_PIX_FMT_VAAPI,
-        AV_PIX_FMT_NONE,
-    };
-
-    return ff_set_common_formats_from_list(avctx, pixel_formats);
-}
+static const enum AVPixelFormat vaapi_stack_pix_fmts[] = {
+    AV_PIX_FMT_VAAPI,
+    AV_PIX_FMT_NONE,
+};
 
 #include "stack_internal.c"
 
-- 
2.43.0



More information about the ffmpeg-devel mailing list