53 #if HAVE_SETCONSOLETEXTATTRIBUTE
76 static int16_t background, attr_orig;
78 #define set_color(x) SetConsoleTextAttribute(con, background | color[x])
79 #define set_256color set_color
80 #define reset_color() SetConsoleTextAttribute(con, attr_orig)
104 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", (color[x] >> 4) & 15, color[x] & 15)
105 #define set_256color(x) fprintf(stderr, "\033[48;5;%dm\033[38;5;%dm", (color[x] >> 16) & 0xff, (color[x] >> 8) & 0xff)
106 #define reset_color() fprintf(stderr, "\033[0m")
116 #if HAVE_SETCONSOLETEXTATTRIBUTE
117 CONSOLE_SCREEN_BUFFER_INFO con_info;
118 con = GetStdHandle(STD_ERROR_HANDLE);
120 !getenv(
"AV_LOG_FORCE_NOCOLOR");
122 GetConsoleScreenBufferInfo(con, &con_info);
123 attr_orig = con_info.wAttributes;
124 background = attr_orig & 0xF0;
127 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
128 (getenv(
"TERM") && isatty(2) ||
129 getenv(
"AV_LOG_FORCE_COLOR"));
130 if (getenv(
"AV_LOG_FORCE_256COLOR"))
133 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
134 !getenv(
"AV_LOG_FORCE_NOCOLOR");
150 return (*(
AVClass **) ptr)->class_name;
155 return (*(
AVClass **) ptr)->category;
160 if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
170 || avc->
version < (51 << 16 | 59 << 8)
180 AVBPrint part[3],
int *print_prefix,
int type[2])
188 if (*print_prefix && avc) {
192 if (parent && *parent) {
194 (*parent)->item_name(parent), parent);
205 if(*part[0].str || *part[1].str || *part[2].str) {
206 char lastc = part[2].len && part[2].len <= part[2].size ? part[2].str[part[2].len - 1] : 0;
207 *print_prefix = lastc ==
'\n' || lastc ==
'\r';
212 char *
line,
int line_size,
int *print_prefix)
215 format_line(ptr, level, fmt, vl, part, print_prefix, NULL);
216 snprintf(line, line_size,
"%s%s%s", part[0].str, part[1].str, part[2].str);
222 static int print_prefix = 1;
236 format_line(ptr, level, fmt, vl, part, &print_prefix, type);
237 snprintf(line,
sizeof(line),
"%s%s%s", part[0].str, part[1].str, part[2].str);
241 is_atty = isatty(2) ? 1 : -1;
245 *line && line[strlen(line) - 1] !=
'\r'){
248 fprintf(stderr,
" Last message repeated %d times\r", count);
252 fprintf(stderr,
" Last message repeated %d times\n", count);
277 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
288 log_callback(avcl, level, fmt, vl);
312 va_list argument_list)
316 "version to the newest one from Git. If the problem still "
317 "occurs, it means that your file has a feature which has not "
318 "been implemented.\n");
321 "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
322 "and contact the ffmpeg-devel mailing list.\n");
327 va_list argument_list;
329 va_start(argument_list, msg);
331 va_end(argument_list);
336 va_list argument_list;
338 va_start(argument_list, msg);
340 va_end(argument_list);