[FFmpeg-devel] [PATCH v5 2/3] lavc/libdavs2.c: fix decoder info level setting

hwrenx hwrenx at 126.com
Mon Jul 22 10:13:54 EEST 2019


Signed-off-by: hwrenx <hwrenx at 126.com>
---
 libavcodec/libdavs2.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 218f3ec..6d66209 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -37,14 +37,29 @@ typedef struct DAVS2Context {
 
 }DAVS2Context;
 
+static int davs2_log_get_level(int log_level)
+{
+    if (log_level <= AV_LOG_ERROR)
+        return DAVS2_LOG_ERROR;
+
+    if (log_level <= AV_LOG_WARNING)
+        return DAVS2_LOG_WARNING;
+
+    if (log_level <= AV_LOG_INFO)
+        return DAVS2_LOG_INFO;
+
+    return DAVS2_LOG_DEBUG;
+}
+
 static av_cold int davs2_init(AVCodecContext *avctx)
 {
     DAVS2Context *cad = avctx->priv_data;
     int cpu_flags = av_get_cpu_flags();
+    int log_level = av_log_get_level();
 
     /* init the decoder */
     cad->param.threads      = avctx->thread_count;
-    cad->param.info_level   = 0;
+    cad->param.info_level   = davs2_log_get_level(log_level);
     cad->param.disable_avx  = !(cpu_flags & AV_CPU_FLAG_AVX &&
                                 cpu_flags & AV_CPU_FLAG_AVX2);
     cad->decoder            = davs2_decoder_open(&cad->param);
-- 
2.7.4



More information about the ffmpeg-devel mailing list