X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Flog.c;h=80129769f656a9d1a4ad102bfe1f819755c7f82b;hb=ecb918e5f0a4395468862b5fbd11a51de9be3d4f;hp=e4a9fec552b3b44ceaddf4c0e73f7309580abed8;hpb=539df61193f2452ddeb74999f0ae301d7a7318cc;p=ffmpeg diff --git a/libavutil/log.c b/libavutil/log.c index e4a9fec552b..80129769f65 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -26,18 +26,22 @@ #include "config.h" -#if HAVE_ISATTY +#if HAVE_UNISTD_H #include #endif +#if HAVE_IO_H +#include +#endif #include #include "avstring.h" #include "avutil.h" +#include "common.h" #include "log.h" static int av_log_level = AV_LOG_INFO; static int flags; -#if defined(_WIN32) && !defined(__MINGW32CE__) +#if HAVE_SETCONSOLETEXTATTRIBUTE #include static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 }; static int16_t background, attr_orig; @@ -51,11 +55,10 @@ static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 }; #endif static int use_color = -1; -#undef fprintf static void colored_fputs(int level, const char *str) { if (use_color < 0) { -#if defined(_WIN32) && !defined(__MINGW32CE__) +#if HAVE_SETCONSOLETEXTATTRIBUTE CONSOLE_SCREEN_BUFFER_INFO con_info; con = GetStdHandle(STD_ERROR_HANDLE); use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") && @@ -100,7 +103,6 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) if (level > av_log_level) return; line[0] = 0; -#undef fprintf if (print_prefix && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +