47 #if HAVE_SETCONSOLETEXTATTRIBUTE
70 static int16_t background, attr_orig;
72 #define set_color(x) SetConsoleTextAttribute(con, background | color[x])
73 #define set_256color set_color
74 #define reset_color() SetConsoleTextAttribute(con, attr_orig)
98 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", (color[x] >> 4) & 15, color[x] & 15)
99 #define set_256color(x) fprintf(stderr, "\033[48;5;%dm\033[38;5;%dm", (color[x] >> 16) & 0xff, (color[x] >> 8) & 0xff)
100 #define reset_color() fprintf(stderr, "\033[0m")
107 #if HAVE_SETCONSOLETEXTATTRIBUTE
108 CONSOLE_SCREEN_BUFFER_INFO con_info;
109 con = GetStdHandle(STD_ERROR_HANDLE);
111 !getenv(
"AV_LOG_FORCE_NOCOLOR");
113 GetConsoleScreenBufferInfo(con, &con_info);
114 attr_orig = con_info.wAttributes;
115 background = attr_orig & 0xF0;
118 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
119 (getenv(
"TERM") && isatty(2) ||
120 getenv(
"AV_LOG_FORCE_COLOR"));
121 if (getenv(
"AV_LOG_FORCE_256COLOR"))
124 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
125 !getenv(
"AV_LOG_FORCE_NOCOLOR");
141 return (*(
AVClass **) ptr)->class_name;
146 return (*(
AVClass **) ptr)->category;
151 if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
161 || avc->
version < (51 << 16 | 59 << 8)
171 char part[3][
LINE_SZ],
int part_size,
int *print_prefix,
int type[2])
174 part[0][0] = part[1][0] = part[2][0] = 0;
176 if (*print_prefix && avc) {
180 if (parent && *parent) {
181 snprintf(part[0], part_size,
"[%s @ %p] ",
182 (*parent)->item_name(parent), parent);
186 snprintf(part[1], part_size,
"[%s @ %p] ",
193 if(*part[0] || *part[1] || *part[2])
194 *print_prefix = strlen(part[2]) && part[2][strlen(part[2]) - 1] ==
'\n';
198 char *
line,
int line_size,
int *print_prefix)
201 format_line(ptr, level, fmt, vl, part,
sizeof(part[0]), print_prefix, NULL);
202 snprintf(line, line_size,
"%s%s%s", part[0], part[1], part[2]);
207 static int print_prefix = 1;
217 format_line(ptr, level, fmt, vl, part,
sizeof(part[0]), &print_prefix, type);
218 snprintf(line,
sizeof(line),
"%s%s%s", part[0], part[1], part[2]);
222 is_atty = isatty(2) ? 1 : -1;
228 fprintf(stderr,
" Last message repeated %d times\r", count);
232 fprintf(stderr,
" Last message repeated %d times\n", count);
252 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
286 va_list argument_list)
290 "version to the newest one from Git. If the problem still "
291 "occurs, it means that your file has a feature which has not "
292 "been implemented.\n");
295 "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
296 "and contact the ffmpeg-devel mailing list.\n");
301 va_list argument_list;
303 va_start(argument_list, msg);
305 va_end(argument_list);
310 va_list argument_list;
312 va_start(argument_list, msg);
314 va_end(argument_list);