[FFmpeg-devel] [PATCH] Don't let error messages overwrite progress information

Jean Delvare khali
Mon Oct 25 11:11:18 CEST 2010


Don't let error messages overwrite progress information.

I am (unfortunately) often dealing with damaged input files, and I
want to be able to check, after encoding, how visible/audible the
errors are. In order to do this, I need to know at which time offset
to look, which is only possible if the progress information isn't
overwritten by the error messages.

For this reason, I suggest adding a new line before printing the
first line of every warning/error message.
---
 libavutil/log.c |    4 ++++
 1 file changed, 4 insertions(+)

--- ffmpeg.orig/libavutil/log.c	2010-10-06 14:08:48.000000000 +0200
+++ ffmpeg/libavutil/log.c	2010-10-16 21:38:10.000000000 +0200
@@ -87,6 +87,7 @@ void av_log_default_callback(void* ptr,
     static int count;
     static char line[1024], prev[1024];
     static int is_atty;
+    static int prev_level=AV_LOG_INFO;
     AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
     if(level>av_log_level)
         return;
@@ -120,8 +121,11 @@ void av_log_default_callback(void* ptr,
         fprintf(stderr, "    Last message repeated %d times\n", count);
         count=0;
     }
+    if(is_atty==1 && level<=AV_LOG_WARNING && !(prev_level<=AV_LOG_WARNING))
+        fputs("\n", stderr);
     colored_fputs(av_clip(level>>3, 0, 6), line);
     strcpy(prev, line);
+    prev_level= level;
 }
 
 static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;


-- 
Jean Delvare



More information about the ffmpeg-devel mailing list