53 #if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
82 static int16_t background, attr_orig;
118 #if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
119 CONSOLE_SCREEN_BUFFER_INFO con_info;
120 con = GetStdHandle(STD_ERROR_HANDLE);
122 !getenv(
"AV_LOG_FORCE_NOCOLOR");
124 GetConsoleScreenBufferInfo(con, &con_info);
125 attr_orig = con_info.wAttributes;
126 background = attr_orig & 0xF0;
129 char *term = getenv(
"TERM");
130 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
131 (getenv(
"TERM") && isatty(2) || getenv(
"AV_LOG_FORCE_COLOR"));
132 if ( getenv(
"AV_LOG_FORCE_256COLOR")
133 || (term && strstr(term,
"256color")))
136 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
137 !getenv(
"AV_LOG_FORCE_NOCOLOR");
153 #if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
155 SetConsoleTextAttribute(con, background |
color[level]);
158 SetConsoleTextAttribute(con, attr_orig);
160 if (local_use_color == 1) {
162 "\033[%d;3%dm%s\033[0m",
163 (
color[level] >> 4) & 15,
168 "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
169 (
color[level] >> 16) & 0xff,
172 }
else if (local_use_color == 256) {
174 "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
175 (
color[level] >> 16) & 0xff,
176 (
color[level] >> 8) & 0xff,
186 return (*(
AVClass **) ptr)->class_name;
191 return (*(
AVClass **) ptr)->category;
196 if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
206 || avc->
version < (51 << 16 | 59 << 8)
249 if (*print_prefix && avc) {
253 if (parent && *parent) {
255 (*parent)->item_name(parent), parent);
269 if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) {
270 char lastc = part[3].len && part[3].len <= part[3].size ? part[3].str[part[3].len - 1] : 0;
271 *print_prefix = lastc ==
'\n' || lastc ==
'\r';
276 char *
line,
int line_size,
int *print_prefix)
279 format_line(ptr, level, fmt, vl, part, print_prefix, NULL);
280 snprintf(line, line_size,
"%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
286 static int print_prefix = 1;
296 tint = level & 0xff00;
306 format_line(ptr, level, fmt, vl, part, &print_prefix, type);
307 snprintf(line,
sizeof(line),
"%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
311 is_atty = isatty(2) ? 1 : -1;
315 *line && line[strlen(line) - 1] !=
'\r'){
318 fprintf(stderr,
" Last message repeated %d times\r", count);
322 fprintf(stderr,
" Last message repeated %d times\n", count);
331 colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, part[2].str);
333 colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, part[3].str);
349 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
360 log_callback(avcl, level, fmt, vl);
389 va_list argument_list)
393 "version to the newest one from Git. If the problem still "
394 "occurs, it means that your file has a feature which has not "
395 "been implemented.\n");
398 "of this file to ftp://upload.ffmpeg.org/incoming/ "
399 "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)\n");
404 va_list argument_list;
406 va_start(argument_list, msg);
408 va_end(argument_list);
413 va_list argument_list;
415 va_start(argument_list, msg);
417 va_end(argument_list);
424 int main(
int argc,
char **argv)
431 av_log(NULL, i,
" %d", i);
433 av_log(NULL, i + 256*123,
"C%d", i);