53 #if HAVE_SETCONSOLETEXTATTRIBUTE
76 static int16_t background, attr_orig;
110 #if HAVE_SETCONSOLETEXTATTRIBUTE
111 CONSOLE_SCREEN_BUFFER_INFO con_info;
112 con = GetStdHandle(STD_ERROR_HANDLE);
114 !getenv(
"AV_LOG_FORCE_NOCOLOR");
116 GetConsoleScreenBufferInfo(con, &con_info);
117 attr_orig = con_info.wAttributes;
118 background = attr_orig & 0xF0;
121 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
122 (getenv(
"TERM") && isatty(2) ||
123 getenv(
"AV_LOG_FORCE_COLOR"));
124 if (getenv(
"AV_LOG_FORCE_256COLOR"))
127 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
128 !getenv(
"AV_LOG_FORCE_NOCOLOR");
132 #if HAVE_SETCONSOLETEXTATTRIBUTE
134 SetConsoleTextAttribute(con, background |
color[level]);
137 SetConsoleTextAttribute(con, attr_orig);
141 "\033[%d;3%dm%s\033[0m",
142 (
color[level] >> 4) & 15,
147 "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
148 (
color[level] >> 16) & 0xff,
149 (
color[level] >> 8) & 0xff,
159 return (*(
AVClass **) ptr)->class_name;
164 return (*(
AVClass **) ptr)->category;
169 if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
179 || avc->
version < (51 << 16 | 59 << 8)
197 if (*print_prefix && avc) {
201 if (parent && *parent) {
203 (*parent)->item_name(parent), parent);
214 if(*part[0].str || *part[1].str || *part[2].str) {
215 char lastc = part[2].len && part[2].len <= part[2].size ? part[2].str[part[2].len - 1] : 0;
216 *print_prefix = lastc ==
'\n' || lastc ==
'\r';
221 char *
line,
int line_size,
int *print_prefix)
224 format_line(ptr, level, fmt, vl, part, print_prefix, NULL);
225 snprintf(line, line_size,
"%s%s%s", part[0].str, part[1].str, part[2].str);
231 static int print_prefix = 1;
245 format_line(ptr, level, fmt, vl, part, &print_prefix, type);
246 snprintf(line,
sizeof(line),
"%s%s%s", part[0].str, part[1].str, part[2].str);
250 is_atty = isatty(2) ? 1 : -1;
254 *line && line[strlen(line) - 1] !=
'\r'){
257 fprintf(stderr,
" Last message repeated %d times\r", count);
261 fprintf(stderr,
" Last message repeated %d times\n", count);
286 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
297 log_callback(avcl, level, fmt, vl);
321 va_list argument_list)
325 "version to the newest one from Git. If the problem still "
326 "occurs, it means that your file has a feature which has not "
327 "been implemented.\n");
330 "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
331 "and contact the ffmpeg-devel mailing list.\n");
336 va_list argument_list;
338 va_start(argument_list, msg);
340 va_end(argument_list);
345 va_list argument_list;
347 va_start(argument_list, msg);
349 va_end(argument_list);