comparison log.c @ 903:b0cedb31562f libavutil

Reenable ANSI colors, use method from VLC as suggested by ramiro. Please tell us asap if this breaks for your platform & terminal.
author michael
date Fri, 23 Apr 2010 07:33:02 +0000
parents 143b937b0b03
children 01dd0deb8e8d
comparison
equal deleted inserted replaced
902:143b937b0b03 903:b0cedb31562f
31 #if LIBAVUTIL_VERSION_MAJOR > 50 31 #if LIBAVUTIL_VERSION_MAJOR > 50
32 static 32 static
33 #endif 33 #endif
34 int av_log_level = AV_LOG_INFO; 34 int av_log_level = AV_LOG_INFO;
35 35
36 #if !HAVE_ISATTY 36 #if (!HAVE_ISATTY) || defined(WIN32)
37 #define isatty(s) 0 37 #define isatty(s) 0
38 #endif 38 #endif
39 39
40 #undef fprintf 40 #undef fprintf
41 static void colored_fputs(int color, const char *str){ 41 static void colored_fputs(int color, const char *str){
42 if(isatty(2)){ 42 if(isatty(2)){
43 // fprintf(stderr, "\033[%dm\033[3%dm", color>>4, color&15); 43 fprintf(stderr, "\033[%dm\033[3%dm", color>>4, color&15);
44 } 44 }
45 fputs(str, stderr); 45 fputs(str, stderr);
46 if(isatty(2)){ 46 if(isatty(2)){
47 // fprintf(stderr, "\033[0m"); 47 fprintf(stderr, "\033[0m");
48 } 48 }
49 } 49 }
50 50
51 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) 51 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
52 { 52 {