diff mbox series

[FFmpeg-devel,05/24] lavfi/vf_hwupload: switch to query_func2()

Message ID 20241012170239.9170-5-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/24] lavfi/vf_frei0r: switch to query_func2() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Anton Khirnov Oct. 12, 2024, 5:02 p.m. UTC
---
 libavfilter/vf_hwupload.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index 70ee262c09..97d50d7877 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -66,9 +66,11 @@  static int hwupload_init(AVFilterContext *avctx)
     return 0;
 }
 
-static int hwupload_query_formats(AVFilterContext *avctx)
+static int hwupload_query_formats(const AVFilterContext *avctx,
+                                  AVFilterFormatsConfig **cfg_in,
+                                  AVFilterFormatsConfig **cfg_out)
 {
-    HWUploadContext *ctx = avctx->priv;
+    const HWUploadContext *ctx = avctx->priv;
     AVHWFramesConstraints *constraints = NULL;
     const enum AVPixelFormat *input_pix_fmts, *output_pix_fmts;
     AVFilterFormats *input_formats = NULL;
@@ -96,16 +98,15 @@  static int hwupload_query_formats(AVFilterContext *avctx)
         }
     }
 
-    if ((err = ff_formats_ref(input_formats, &avctx->inputs[0]->outcfg.formats)) < 0 ||
+    if ((err = ff_formats_ref(input_formats, &cfg_in[0]->formats)) < 0 ||
         (err = ff_formats_ref(ff_make_format_list(output_pix_fmts),
-                              &avctx->outputs[0]->incfg.formats)) < 0)
+                              &cfg_out[0]->formats)) < 0)
         goto fail;
 
     av_hwframe_constraints_free(&constraints);
     return 0;
 
 fail:
-    av_buffer_unref(&ctx->hwdevice_ref);
     av_hwframe_constraints_free(&constraints);
     return err;
 }
@@ -265,7 +266,7 @@  const AVFilter ff_vf_hwupload = {
     .priv_class    = &hwupload_class,
     FILTER_INPUTS(hwupload_inputs),
     FILTER_OUTPUTS(hwupload_outputs),
-    FILTER_QUERY_FUNC(hwupload_query_formats),
+    FILTER_QUERY_FUNC2(hwupload_query_formats),
     .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
     .flags          = AVFILTER_FLAG_HWDEVICE,
 };