diff mbox series

[FFmpeg-devel] avutil/log: Move log_level_offset_offset code from av_log() to v_log()

Message ID 20200121145058.5730-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel] avutil/log: Move log_level_offset_offset code from av_log() to v_log() | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 21, 2020, 2:50 p.m. UTC
Suggested-by: Anton
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavutil/log.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Jan. 22, 2020, 5:35 p.m. UTC | #1
On Tue, Jan 21, 2020 at 03:50:58PM +0100, Michael Niedermayer wrote:
> Suggested-by: Anton
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavutil/log.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavutil/log.c b/libavutil/log.c
index e8a0db7716..c3e65f0470 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -362,19 +362,19 @@  static void (*av_log_callback)(void*, int, const char*, va_list) =
 
 void av_log(void* avcl, int level, const char *fmt, ...)
 {
-    AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
     va_list vl;
     va_start(vl, fmt);
-    if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
-        avc->log_level_offset_offset && level >= AV_LOG_FATAL)
-        level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
     av_vlog(avcl, level, fmt, vl);
     va_end(vl);
 }
 
 void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
 {
+    AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
     void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
+    if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
+        avc->log_level_offset_offset && level >= AV_LOG_FATAL)
+        level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
     if (log_callback)
         log_callback(avcl, level, fmt, vl);
 }