]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libopenh264enc.c
Merge commit '6064f697a321174232a3fad351afb21150c3e9e5'
[ffmpeg] / libavcodec / libopenh264enc.c
index 1977e403dbe8aeb9fe95de882c53d0e0f786b30c..33b7f6c7a87cce2ed0dd4e2aec6821e99f1b18c1 100644 (file)
@@ -66,20 +66,12 @@ static int ffmpeg_to_libopenh264_log_level  (
     int ffmpeg_log_level
     )
 {
-    int equiv_libopenh264_log_level;
-    if  ( ffmpeg_log_level > AV_LOG_DEBUG )
-        equiv_libopenh264_log_level = WELS_LOG_DETAIL;   // > AV_LOG_DEBUG; this is EXTREMELY detailed
-    else if  ( ffmpeg_log_level >= AV_LOG_DEBUG )
-        equiv_libopenh264_log_level = WELS_LOG_DEBUG;    // AV_LOG_DEBUG
-    else if  ( ffmpeg_log_level >= AV_LOG_INFO )
-        equiv_libopenh264_log_level = WELS_LOG_INFO;     // AV_LOG_INFO, AV_LOG_VERBOSE
-    else if  ( ffmpeg_log_level >= AV_LOG_WARNING )
-        equiv_libopenh264_log_level = WELS_LOG_WARNING;  // AV_LOG_WARNING
-    else if  ( ffmpeg_log_level >= AV_LOG_ERROR )
-        equiv_libopenh264_log_level = WELS_LOG_ERROR;    // AV_LOG_ERROR
-    else
-        equiv_libopenh264_log_level = WELS_LOG_QUIET;    // AV_LOG_QUIET, AV_LOG_PANIC, AV_LOG_FATAL
-    return equiv_libopenh264_log_level;
+    if      (ffmpeg_log_level >  AV_LOG_DEBUG)   return WELS_LOG_DETAIL;
+    else if (ffmpeg_log_level >= AV_LOG_DEBUG)   return WELS_LOG_DEBUG;
+    else if (ffmpeg_log_level >= AV_LOG_INFO)    return WELS_LOG_INFO;
+    else if (ffmpeg_log_level >= AV_LOG_WARNING) return WELS_LOG_WARNING;
+    else if (ffmpeg_log_level >= AV_LOG_ERROR)   return WELS_LOG_ERROR;
+    else                                         return WELS_LOG_QUIET;
 }
 
 // Convert libopenh264 log level to equivalent ffmpeg log level.
@@ -87,20 +79,12 @@ static int libopenh264_to_ffmpeg_log_level  (
     int libopenh264_log_level
     )
 {
-    int equiv_ffmpeg_log_level;
-    if  ( libopenh264_log_level >= WELS_LOG_DETAIL )
-        equiv_ffmpeg_log_level = AV_LOG_DEBUG + 1;           // WELS_LOG_DETAIL
-    else if  ( libopenh264_log_level >= WELS_LOG_DEBUG )
-        equiv_ffmpeg_log_level = AV_LOG_DEBUG;               // WELS_LOG_DEBUG
-    else if  ( libopenh264_log_level >= WELS_LOG_INFO )
-        equiv_ffmpeg_log_level = AV_LOG_INFO;                // WELS_LOG_INFO
-    else if  ( libopenh264_log_level >= WELS_LOG_WARNING )
-        equiv_ffmpeg_log_level = AV_LOG_WARNING;             // WELS_LOG_WARNING
-    else if  ( libopenh264_log_level >= WELS_LOG_ERROR )
-        equiv_ffmpeg_log_level = AV_LOG_ERROR;               // WELS_LOG_ERROR
-    else
-        equiv_ffmpeg_log_level = AV_LOG_QUIET;               // WELS_LOG_QUIET
-    return equiv_ffmpeg_log_level;
+    if      (libopenh264_log_level >= WELS_LOG_DETAIL)  return AV_LOG_TRACE;
+    else if (libopenh264_log_level >= WELS_LOG_DEBUG)   return AV_LOG_DEBUG;
+    else if (libopenh264_log_level >= WELS_LOG_INFO)    return AV_LOG_INFO;
+    else if (libopenh264_log_level >= WELS_LOG_WARNING) return AV_LOG_WARNING;
+    else if (libopenh264_log_level >= WELS_LOG_ERROR)   return AV_LOG_ERROR;
+    else                                                return AV_LOG_QUIET;
 }
 
 // This function will be provided to the libopenh264 library.  The function will be called
@@ -121,8 +105,8 @@ static void libopenh264_trace_callback  (
     // the message (and this function will not be called) if the requested libopenh264
     // log level "level" is greater than the current libopenh264 log level.
     int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level);
-    if  ( equiv_ffmpeg_log_level <= av_log_get_level() )
-        av_log((AVCodecContext *) ctx, equiv_ffmpeg_log_level, "%s\n", msg);
+    if (equiv_ffmpeg_log_level <= av_log_get_level())
+        av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg);
 }
 
 static av_cold int svc_encode_close(AVCodecContext *avctx)