Mercurial > libavutil.hg
comparison log.c @ 1019:4a16166d580e libavutil
2nd try to fix av_log() repeated detection
author | michael |
---|---|
date | Fri, 24 Sep 2010 15:37:01 +0000 |
parents | fd2dd26fab8a |
children | d5c1288962a1 |
comparison
equal
deleted
inserted
replaced
1018:61cb1c0a6eb6 | 1019:4a16166d580e |
---|---|
31 | 31 |
32 #if LIBAVUTIL_VERSION_MAJOR > 50 | 32 #if LIBAVUTIL_VERSION_MAJOR > 50 |
33 static | 33 static |
34 #endif | 34 #endif |
35 int av_log_level = AV_LOG_INFO; | 35 int av_log_level = AV_LOG_INFO; |
36 static int flags; | |
36 | 37 |
37 #if defined(_WIN32) && !defined(__MINGW32CE__) | 38 #if defined(_WIN32) && !defined(__MINGW32CE__) |
38 #include <windows.h> | 39 #include <windows.h> |
39 static const uint8_t color[] = {12,12,12,14,7,7,7}; | 40 static const uint8_t color[] = {12,12,12,14,7,7,7}; |
40 static int16_t background, attr_orig; | 41 static int16_t background, attr_orig; |
107 | 108 |
108 #if HAVE_ISATTY | 109 #if HAVE_ISATTY |
109 if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1; | 110 if(!detect_repeats) detect_repeats= isatty(2) ? 1 : -1; |
110 #endif | 111 #endif |
111 | 112 |
112 if(print_prefix && detect_repeats==1 && !strcmp(line, prev)){ | 113 if(print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ |
113 count++; | 114 count++; |
115 if(detect_repeats==1) | |
114 fprintf(stderr, " Last message repeated %d times\r", count); | 116 fprintf(stderr, " Last message repeated %d times\r", count); |
115 return; | 117 return; |
116 } | 118 } |
117 if(count>0){ | 119 if(count>0){ |
118 fprintf(stderr, " Last message repeated %d times\n", count); | 120 fprintf(stderr, " Last message repeated %d times\n", count); |
148 void av_log_set_level(int level) | 150 void av_log_set_level(int level) |
149 { | 151 { |
150 av_log_level = level; | 152 av_log_level = level; |
151 } | 153 } |
152 | 154 |
155 void av_log_set_flags(int arg) | |
156 { | |
157 flags= arg; | |
158 } | |
159 | |
153 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) | 160 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) |
154 { | 161 { |
155 av_log_callback = callback; | 162 av_log_callback = callback; |
156 } | 163 } |