diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-04-09 16:30:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-09 16:30:16 +0200 |
commit | 7ac2f7e413051aa6ff735a8b9c47ca06dc4607d9 (patch) | |
tree | 2aeedcf1c4efc0a5cba354e4c13cad5aa0c79ba7 /libavutil/log.c | |
parent | dddacf780f1e0f8fa535b13654615607eabba85f (diff) | |
download | ffmpeg-7ac2f7e413051aa6ff735a8b9c47ca06dc4607d9.tar.gz |
avutil/log: factor "level != AV_LOG_INFO/8" checks out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/log.c')
-rw-r--r-- | libavutil/log.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavutil/log.c b/libavutil/log.c index 32e1ba74c4..8b8f54b968 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -140,20 +140,24 @@ static void check_color_terminal(void) static void colored_fputs(int level, int tint, const char *str) { + int local_use_color; if (!*str) return; if (use_color < 0) check_color_terminal(); + if (level == AV_LOG_INFO/8) local_use_color = 0; + else local_use_color = use_color; + #if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE - if (use_color && level != AV_LOG_INFO/8) + if (local_use_color) SetConsoleTextAttribute(con, background | color[level]); fputs(str, stderr); - if (use_color && level != AV_LOG_INFO/8) + if (local_use_color) SetConsoleTextAttribute(con, attr_orig); #else - if (use_color == 1 && level != AV_LOG_INFO/8) { + if (local_use_color == 1) { fprintf(stderr, "\033[%d;3%dm%s\033[0m", (color[level] >> 4) & 15, @@ -165,7 +169,7 @@ static void colored_fputs(int level, int tint, const char *str) (color[level] >> 16) & 0xff, tint, str); - } else if (use_color == 256 && level != AV_LOG_INFO/8) { + } else if (local_use_color == 256) { fprintf(stderr, "\033[48;5;%dm\033[38;5;%dm%s\033[0m", (color[level] >> 16) & 0xff, |