46 #if HAVE_SETCONSOLETEXTATTRIBUTE
48 static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
49 static int16_t background, attr_orig;
51 #define set_color(x) SetConsoleTextAttribute(con, background | color[x])
52 #define reset_color() SetConsoleTextAttribute(con, attr_orig)
54 static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
55 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
56 #define reset_color() fprintf(stderr, "\033[0m")
63 #if HAVE_SETCONSOLETEXTATTRIBUTE
64 CONSOLE_SCREEN_BUFFER_INFO con_info;
65 con = GetStdHandle(STD_ERROR_HANDLE);
66 use_color = (con != INVALID_HANDLE_VALUE) && !getenv(
"NO_COLOR") &&
67 !getenv(
"AV_LOG_FORCE_NOCOLOR");
69 GetConsoleScreenBufferInfo(con, &con_info);
70 attr_orig = con_info.wAttributes;
71 background = attr_orig & 0xF0;
74 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
75 (getenv(
"TERM") && isatty(2) ||
76 getenv(
"AV_LOG_FORCE_COLOR"));
78 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
79 !getenv(
"AV_LOG_FORCE_NOCOLOR");
94 return (*(
AVClass **) ptr)->class_name;
99 static int print_prefix = 1;
101 static char prev[1024];
108 if (print_prefix && avc) {
112 if (parent && *parent) {
113 snprintf(line,
sizeof(line),
"[%s @ %p] ",
114 (*parent)->item_name(parent), parent);
117 snprintf(line + strlen(line),
sizeof(line) - strlen(line),
"[%s @ %p] ",
121 vsnprintf(line + strlen(line),
sizeof(line) - strlen(line), fmt, vl);
123 print_prefix = strlen(line) && line[strlen(line) - 1] ==
'\n';
127 is_atty = isatty(2) ? 1 : -1;
131 !strncmp(line, prev,
sizeof line)) {
134 fprintf(stderr,
" Last message repeated %d times\r", count);
138 fprintf(stderr,
" Last message repeated %d times\n", count);
153 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
186 va_list argument_list)
190 "version to the newest one from Git. If the problem still "
191 "occurs, it means that your file has a feature which has not "
192 "been implemented.\n");
195 "of this file to ftp://upload.libav.org/incoming/ "
196 "and contact the libav-devel mailing list.\n");
201 va_list argument_list;
203 va_start(argument_list, msg);
205 va_end(argument_list);
210 va_list argument_list;
212 va_start(argument_list, msg);
214 va_end(argument_list);