# HG changeset patch # User michael # Date 1284423478 0 # Node ID fd2dd26fab8a5b13cf897fb38c9b6358c4cd9fd2 # Parent 4c26dcb90bc6e13fa7e49ad114b141e1b579e0d3 Limit av_log repeat detection to terminals so as to avoid filling files with lots of mess. diff -r 4c26dcb90bc6 -r fd2dd26fab8a log.c --- a/log.c Sun Sep 12 22:00:45 2010 +0000 +++ b/log.c Tue Sep 14 00:17:58 2010 +0000 @@ -85,6 +85,7 @@ 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 @@ 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;