diff mbox series

[FFmpeg-devel,09/22] lavfi/*_vaapi: switch to query_func2()

Message ID 20240925093919.22929-9-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/22] lavfi/asrc_afdelaysrc: convert to query_func2() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Sept. 25, 2024, 9:39 a.m. UTC
Also, drop redundant calls that also happen implicitly in generic code.
---
 libavfilter/vaapi_vpp.c            | 17 ++++++-----------
 libavfilter/vaapi_vpp.h            |  4 +++-
 libavfilter/vf_deinterlace_vaapi.c |  2 +-
 libavfilter/vf_drawbox_vaapi.c     |  2 +-
 libavfilter/vf_misc_vaapi.c        |  4 ++--
 libavfilter/vf_pad_vaapi.c         |  2 +-
 libavfilter/vf_procamp_vaapi.c     |  2 +-
 libavfilter/vf_scale_vaapi.c       |  2 +-
 libavfilter/vf_tonemap_vaapi.c     |  2 +-
 libavfilter/vf_transpose_vaapi.c   |  2 +-
 10 files changed, 18 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index 0179977af4..9be076fadb 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -26,22 +26,17 @@ 
 #include "formats.h"
 #include "vaapi_vpp.h"
 
-int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
+int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx,
+                               AVFilterFormatsConfig **cfg_in,
+                               AVFilterFormatsConfig **cfg_out)
 {
-    enum AVPixelFormat pix_fmts[] = {
+    static const enum AVPixelFormat pix_fmts[] = {
         AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
     };
     int err;
 
-    if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-                              &avctx->inputs[0]->outcfg.formats)) < 0)
-        return err;
-    if ((err = ff_formats_ref(ff_make_format_list(pix_fmts),
-                              &avctx->outputs[0]->incfg.formats)) < 0)
-        return err;
-
-    if ((err = ff_set_common_all_color_spaces(avctx)) < 0 ||
-        (err = ff_set_common_all_color_ranges(avctx)) < 0)
+    err = ff_set_common_formats_from_list2(avctx, cfg_in, cfg_out, pix_fmts);
+    if (err < 0)
         return err;
 
     return 0;
diff --git a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h
index 6764ab0c39..0919fbbce3 100644
--- a/libavfilter/vaapi_vpp.h
+++ b/libavfilter/vaapi_vpp.h
@@ -67,7 +67,9 @@  void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx);
 
 void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx);
 
-int ff_vaapi_vpp_query_formats(AVFilterContext *avctx);
+int ff_vaapi_vpp_query_formats(const AVFilterContext *avctx,
+                               AVFilterFormatsConfig **cfg_in,
+                               AVFilterFormatsConfig **cfg_out);
 
 void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx);
 
diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c
index 0478d6daef..35e68d6e17 100644
--- a/libavfilter/vf_deinterlace_vaapi.c
+++ b/libavfilter/vf_deinterlace_vaapi.c
@@ -425,7 +425,7 @@  const AVFilter ff_vf_deinterlace_vaapi = {
     .uninit         = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(deint_vaapi_inputs),
     FILTER_OUTPUTS(deint_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class     = &deint_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_drawbox_vaapi.c b/libavfilter/vf_drawbox_vaapi.c
index 5b4f23066f..aa18f2fd39 100644
--- a/libavfilter/vf_drawbox_vaapi.c
+++ b/libavfilter/vf_drawbox_vaapi.c
@@ -364,6 +364,6 @@  const AVFilter ff_vf_drawbox_vaapi = {
     .uninit         = &drawbox_vaapi_uninit,
     FILTER_INPUTS(drawbox_vaapi_inputs),
     FILTER_OUTPUTS(drawbox_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_misc_vaapi.c b/libavfilter/vf_misc_vaapi.c
index 3717a21930..981fcc878d 100644
--- a/libavfilter/vf_misc_vaapi.c
+++ b/libavfilter/vf_misc_vaapi.c
@@ -249,7 +249,7 @@  const AVFilter ff_vf_denoise_vaapi = {
     .uninit        = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(misc_vaapi_inputs),
     FILTER_OUTPUTS(misc_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class    = &denoise_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
@@ -262,7 +262,7 @@  const AVFilter ff_vf_sharpness_vaapi = {
     .uninit        = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(misc_vaapi_inputs),
     FILTER_OUTPUTS(misc_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class    = &sharpness_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_pad_vaapi.c b/libavfilter/vf_pad_vaapi.c
index f45e503141..478b89d117 100644
--- a/libavfilter/vf_pad_vaapi.c
+++ b/libavfilter/vf_pad_vaapi.c
@@ -278,6 +278,6 @@  const AVFilter ff_vf_pad_vaapi = {
     .uninit         = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(pad_vaapi_inputs),
     FILTER_OUTPUTS(pad_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_procamp_vaapi.c b/libavfilter/vf_procamp_vaapi.c
index be3cdae8bb..a9e589f1b6 100644
--- a/libavfilter/vf_procamp_vaapi.c
+++ b/libavfilter/vf_procamp_vaapi.c
@@ -247,7 +247,7 @@  const AVFilter ff_vf_procamp_vaapi = {
     .uninit        = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(procamp_vaapi_inputs),
     FILTER_OUTPUTS(procamp_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class    = &procamp_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 41f119bb55..65db05c23d 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -299,7 +299,7 @@  const AVFilter ff_vf_scale_vaapi = {
     .uninit        = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(scale_vaapi_inputs),
     FILTER_OUTPUTS(scale_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class    = &scale_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
index b1cc03709a..62e251224c 100644
--- a/libavfilter/vf_tonemap_vaapi.c
+++ b/libavfilter/vf_tonemap_vaapi.c
@@ -567,7 +567,7 @@  const AVFilter ff_vf_tonemap_vaapi = {
     .uninit         = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(tonemap_vaapi_inputs),
     FILTER_OUTPUTS(tonemap_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class     = &tonemap_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };
diff --git a/libavfilter/vf_transpose_vaapi.c b/libavfilter/vf_transpose_vaapi.c
index 4976958be1..d49c44b9d1 100644
--- a/libavfilter/vf_transpose_vaapi.c
+++ b/libavfilter/vf_transpose_vaapi.c
@@ -280,7 +280,7 @@  const AVFilter ff_vf_transpose_vaapi = {
     .uninit         = &ff_vaapi_vpp_ctx_uninit,
     FILTER_INPUTS(transpose_vaapi_inputs),
     FILTER_OUTPUTS(transpose_vaapi_outputs),
-    FILTER_QUERY_FUNC(&ff_vaapi_vpp_query_formats),
+    FILTER_QUERY_FUNC2(&ff_vaapi_vpp_query_formats),
     .priv_class     = &transpose_vaapi_class,
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };