[FFmpeg-devel] [PATCH] libavcodec/libx265.c: support for the x265 loglevel configured with ffmpeg loglevel option

lance.lmwang at gmail.com lance.lmwang at gmail.com
Mon Oct 15 08:08:10 EEST 2018


From: Limin Wang <lance.lmwang at gmail.com>

---
 libavcodec/libx265.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 27c90b3..3a08767 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -108,6 +108,24 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
         return AVERROR(EINVAL);
     }
 
+    switch (av_log_get_level()) {
+        case AV_LOG_ERROR:
+            ctx->params->logLevel = X265_LOG_ERROR;
+            break;
+        case AV_LOG_INFO:
+            ctx->params->logLevel = X265_LOG_INFO;
+            break;
+        case AV_LOG_DEBUG:
+            ctx->params->logLevel = X265_LOG_DEBUG;
+            break;
+        case AV_LOG_WARNING:
+            ctx->params->logLevel = X265_LOG_WARNING;
+            break;
+        case AV_LOG_TRACE:
+            ctx->params->logLevel = X265_LOG_FULL;
+            break;
+    }
+
     ctx->params->frameNumThreads = avctx->thread_count;
     ctx->params->fpsNum          = avctx->time_base.den;
     ctx->params->fpsDenom        = avctx->time_base.num * avctx->ticks_per_frame;
-- 
2.6.4



More information about the ffmpeg-devel mailing list