Mercurial > libavutil.hg
comparison log.c @ 1020:d5c1288962a1 libavutil
Cosmetic (rename detect_repeats to is_atty which matches the truth)
author | michael |
---|---|
date | Fri, 24 Sep 2010 16:18:10 +0000 |
parents | 4a16166d580e |
children | 46cc61796018 |
comparison
equal
deleted
inserted
replaced
1019:4a16166d580e | 1020:d5c1288962a1 |
---|---|
84 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) | 84 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) |
85 { | 85 { |
86 static int print_prefix=1; | 86 static int print_prefix=1; |
87 static int count; | 87 static int count; |
88 static char line[1024], prev[1024]; | 88 static char line[1024], prev[1024]; |
89 static int detect_repeats; | 89 static int is_atty; |
90 AVClass* avc= ptr ? *(AVClass**)ptr : NULL; | 90 AVClass* avc= ptr ? *(AVClass**)ptr : NULL; |
91 if(level>av_log_level) | 91 if(level>av_log_level) |
92 return; | 92 return; |
93 line[0]=0; | 93 line[0]=0; |
94 #undef fprintf | 94 #undef fprintf |
105 vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); | 105 vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); |
106 | 106 |
107 print_prefix= line[strlen(line)-1] == '\n'; | 107 print_prefix= line[strlen(line)-1] == '\n'; |
108 | 108 |
109 #if HAVE_ISATTY | 109 #if HAVE_ISATTY |
110 if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1; | 110 if(!is_atty) is_atty= isatty(2) ? 1 : -1; |
111 #endif | 111 #endif |
112 | 112 |
113 if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ | 113 if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ |
114 count++; | 114 count++; |
115 if(detect_repeats==1) | 115 if(is_atty==1) |
116 fprintf(stderr, " Last message repeated %d times\r", count); | 116 fprintf(stderr, " Last message repeated %d times\r", count); |
117 return; | 117 return; |
118 } | 118 } |
119 if(count>0){ | 119 if(count>0){ |
120 fprintf(stderr, " Last message repeated %d times\n", count); | 120 fprintf(stderr, " Last message repeated %d times\n", count); |