Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/libvvenc: use av_vlog to print external library log messages
@ 2025-04-17 16:41 James Almer
  2025-04-19  1:25 ` Nuo Mi
  0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2025-04-17 16:41 UTC (permalink / raw)
  To: ffmpeg-devel

And improve the vvencMsgLevel <-> AV_LOG_* mapping.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libvvenc.c | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/libavcodec/libvvenc.c b/libavcodec/libvvenc.c
index 29a49ba091..c71fd78f1e 100644
--- a/libavcodec/libvvenc.c
+++ b/libavcodec/libvvenc.c
@@ -63,14 +63,29 @@ typedef struct VVenCContext {
 static void vvenc_log_callback(void *ctx, int level,
                                const char *fmt, va_list args)
 {
-    vvenc_config params;
-    vvencEncoder *encoder = ctx;
-    if (encoder) {
-        vvenc_config_default(&params);
-        vvenc_get_config(encoder, &params);
-        if ((int)params.m_verbosity >= level)
-            vfprintf(level == 1 ? stderr : stdout, fmt, args);
+    AVCodecContext *avctx = ctx;
+
+    switch (level) {
+    case VVENC_ERROR:
+        level = AV_LOG_ERROR;
+        break;
+    case VVENC_WARNING:
+        level = AV_LOG_WARNING;
+        break;
+    case VVENC_INFO:
+        level = AV_LOG_INFO;
+        break;
+    case VVENC_NOTICE:
+    case VVENC_VERBOSE:
+        level = AV_LOG_VERBOSE;
+        break;
+    case VVENC_DETAILS:
+        level = AV_LOG_DEBUG;
+        break;
+    default:
+        return;
     }
+    av_vlog(avctx, level, fmt, args);
 }
 
 static void vvenc_set_verbository(vvenc_config *params)
@@ -82,7 +97,11 @@ static void vvenc_set_verbository(vvenc_config *params)
     else if (loglevel >= AV_LOG_VERBOSE)
         params->m_verbosity = VVENC_NOTICE;
     else if (loglevel >= AV_LOG_INFO)
+        params->m_verbosity = VVENC_INFO;
+    else if (loglevel >= AV_LOG_WARNING)
         params->m_verbosity = VVENC_WARNING;
+    else if (loglevel >= AV_LOG_ERROR)
+        params->m_verbosity = VVENC_ERROR;
 }
 
 static void vvenc_set_pic_format(AVCodecContext *avctx, vvenc_config *params)
@@ -300,7 +319,7 @@ static av_cold int vvenc_init(AVCodecContext *avctx)
         return AVERROR(ENOMEM);
     }
 
-    vvenc_set_msg_callback(&params, s->encoder, vvenc_log_callback);
+    vvenc_set_msg_callback(&params, avctx, vvenc_log_callback);
     ret = vvenc_encoder_open(s->encoder, &params);
     if (ret != 0) {
         av_log(avctx, AV_LOG_ERROR, "cannot open libvvenc encoder: %s\n",
-- 
2.49.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-19  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-17 16:41 [FFmpeg-devel] [PATCH] avcodec/libvvenc: use av_vlog to print external library log messages James Almer
2025-04-19  1:25 ` Nuo Mi

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git