changeset 21242:8d671a2c1b00

Check the log level before processing the message
author henry
date Sun, 26 Nov 2006 12:08:40 +0000
parents 6e3fb3e851ac
children 3ee64ff583a9
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Sun Nov 26 12:03:23 2006 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Sun Nov 26 12:08:40 2006 +0000
@@ -175,6 +175,15 @@
     int mp_level;
     char buf[256];
 
+    switch(level){
+    case AV_LOG_DEBUG:  mp_level= MSGL_V   ; break;
+    case AV_LOG_INFO :  mp_level= MSGL_INFO; break;
+    case AV_LOG_ERROR:  mp_level= MSGL_ERR ; break;
+    default          :  mp_level= MSGL_ERR ; break;
+    }
+
+    if (!mp_msg_test(type, mp_level)) return;
+
     if(ptr){
         if(!strcmp(avc->class_name, "AVCodecContext")){
             AVCodecContext * s= ptr;
@@ -199,13 +208,6 @@
         }
     }
 
-    switch(level){
-    case AV_LOG_DEBUG:  mp_level= MSGL_V   ; break;
-    case AV_LOG_INFO :  mp_level= MSGL_INFO; break;
-    case AV_LOG_ERROR:  mp_level= MSGL_ERR ; break;
-    default          :  mp_level= MSGL_ERR ; break;
-    }
-
     if(print_prefix && avc) {
         mp_msg(type, mp_level, "[%s @ %p]", avc->item_name(ptr), avc);
     }