diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-09-14 00:17:58 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-09-14 00:17:58 +0000 |
commit | c157fe63567450ac46f5110a5d2660f038551796 (patch) | |
tree | 15fbcddabc135b1dafc7e04d19e67b7ff69d4e4d | |
parent | 6639af56ea2c1fd7275c0fa711c94c30c53548cd (diff) | |
download | ffmpeg-c157fe63567450ac46f5110a5d2660f038551796.tar.gz |
Limit av_log repeat detection to terminals so as to avoid filling files with
lots of mess.
Originally committed as revision 25117 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavutil/log.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavutil/log.c b/libavutil/log.c index 2e225b3b50..2e95068db3 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -85,6 +85,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) static int print_prefix=1; static int count; static char line[1024], prev[1024]; + static int detect_repeats; AVClass* avc= ptr ? *(AVClass**)ptr : NULL; if(level>av_log_level) return; @@ -103,7 +104,12 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); print_prefix= line[strlen(line)-1] == '\n'; - if(print_prefix && !strcmp(line, prev)){ + +#if HAVE_ISATTY + if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1; +#endif + + if(print_prefix && detect_repeats==1 && !strcmp(line, prev)){ count++; fprintf(stderr, " Last message repeated %d times\r", count); return; |