X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Flog.c;h=cf4d990b6cf1dff659793696be335b8271e3657c;hb=c9e0f7a080c1eb29e89ea2ba163d6b790ce1ff20;hp=32e1ba74c4d98fd2c3f7f2e0cfa4e57b8c834977;hpb=233dbee3bc98f4da23cd677a79553be9f14bbce8;p=ffmpeg diff --git a/libavutil/log.c b/libavutil/log.c index 32e1ba74c4d..cf4d990b6cf 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, @@ -341,6 +345,11 @@ void av_log_set_flags(int arg) flags = arg; } +int av_log_get_flags(void) +{ + return flags; +} + void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) { av_log_callback = callback;