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

Anton Khirnov anton at khirnov.net
Sat Oct 12 20:02:20 EEST 2024


---
 libavfilter/vf_hwupload.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

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,
 };
-- 
2.43.0



More information about the ffmpeg-devel mailing list