diff mbox series

[FFmpeg-devel,03/10] avfilter/dnn: add log context to ff_get_dnn_module

Message ID tencent_8AE1B7106BB60265692A7D2AAC963B95C00A@qq.com
State Accepted
Commit 016f2f61c3b66311ac03e3898772d194321300f2
Headers show
Series [FFmpeg-devel,01/10] avfilter/dnn: define each backend as a DNNModule | expand

Checks

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

Commit Message

Zhao Zhili April 30, 2023, 3:38 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Print backend type when failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavfilter/dnn/dnn_interface.c | 6 ++++--
 libavfilter/dnn_filter_common.c | 2 +-
 libavfilter/dnn_interface.h     | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/dnn/dnn_interface.c b/libavfilter/dnn/dnn_interface.c
index a60dcb091b..e843826aa6 100644
--- a/libavfilter/dnn/dnn_interface.c
+++ b/libavfilter/dnn/dnn_interface.c
@@ -29,7 +29,7 @@ 
 extern const DNNModule ff_dnn_backend_openvino;
 extern const DNNModule ff_dnn_backend_tf;
 
-const DNNModule *ff_get_dnn_module(DNNBackendType backend_type)
+const DNNModule *ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx)
 {
     switch(backend_type){
     #if (CONFIG_LIBTENSORFLOW == 1)
@@ -41,7 +41,9 @@  const DNNModule *ff_get_dnn_module(DNNBackendType backend_type)
         return &ff_dnn_backend_openvino;
     #endif
     default:
-        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not supported or enabled.\n");
+        av_log(log_ctx, AV_LOG_ERROR,
+                "Module backend_type %d is not supported or enabled.\n",
+                backend_type);
         return NULL;
     }
 }
diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c
index 7b34fd0c0a..d175c91914 100644
--- a/libavfilter/dnn_filter_common.c
+++ b/libavfilter/dnn_filter_common.c
@@ -68,7 +68,7 @@  int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *fil
         return AVERROR(EINVAL);
     }
 
-    ctx->dnn_module = ff_get_dnn_module(ctx->backend_type);
+    ctx->dnn_module = ff_get_dnn_module(ctx->backend_type, filter_ctx);
     if (!ctx->dnn_module) {
         av_log(filter_ctx, AV_LOG_ERROR, "could not create DNN module for requested backend\n");
         return AVERROR(ENOMEM);
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h
index b2bfdd38e7..20c6a0a896 100644
--- a/libavfilter/dnn_interface.h
+++ b/libavfilter/dnn_interface.h
@@ -123,6 +123,6 @@  typedef struct DNNModule{
 } DNNModule;
 
 // Initializes DNNModule depending on chosen backend.
-const DNNModule *ff_get_dnn_module(DNNBackendType backend_type);
+const DNNModule *ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx);
 
 #endif