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 *print_prefix = strlen(part[2]) && part[2][strlen(part[2]) - 1] ==
'\n';
197 char *
line,
int line_size,
int *print_prefix)
200 format_line(ptr, level, fmt, vl, part,
sizeof(part[0]), print_prefix,
NULL);
201 snprintf(line, line_size,
"%s%s%s", part[0], part[1], part[2]);
206 static int print_prefix = 1;
216 format_line(ptr, level, fmt, vl, part,
sizeof(part[0]), &print_prefix, type);
217 snprintf(line,
sizeof(line),
"%s%s%s", part[0], part[1], part[2]);
221 is_atty = isatty(2) ? 1 : -1;
227 fprintf(stderr,
" Last message repeated %d times\r", count);
231 fprintf(stderr,
" Last message repeated %d times\n", count);
251 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
288 "version to the newest one from Git. If the problem still " 289 "occurs, it means that your file has a feature which has not " 290 "been implemented.\n");
293 "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ " 294 "and contact the ffmpeg-devel mailing list.\n");
299 va_list argument_list;
301 va_start(argument_list, msg);
303 va_end(argument_list);
308 va_list argument_list;
310 va_start(argument_list, msg);
312 va_end(argument_list);
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time)
#define AV_LOG_PANIC
Something went really wrong and we will crash now.
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
#define AV_LOG_WARNING
Something somehow does not look correct.
static void format_line(void *ptr, int level, const char *fmt, va_list vl, char part[3][LINE_SZ], int part_size, int *print_prefix, int type[2])
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
AVClassCategory av_default_get_category(void *ptr)
static void missing_feature_sample(int sample, void *avc, const char *msg, va_list argument_list)
int av_log_get_level(void)
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class...
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
int log_level_offset_offset
Offset in the structure where log_level_offset is stored.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
static void sanitize(uint8_t *line)
static int get_category(void *ptr)
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
void av_log(void *avcl, int level, const char *fmt,...)
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
void av_log_set_level(int level)
common internal API header
void avpriv_report_missing_feature(void *avc, const char *msg,...)
static void(* av_log_callback)(void *, int, const char *, va_list)
FIXME Range Coding of cr are level
static void colored_fputs(int level, const char *str)
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
typedef void(RENAME(mix_any_func_type))
const char * av_default_item_name(void *ptr)
void av_log_set_flags(int arg)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Describe the class of an AVClass context structure.
int version
LIBAVUTIL_VERSION with which this structure was created.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
common internal and external API header
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
void avpriv_request_sample(void *avc, const char *msg,...)
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
#define INVALID_HANDLE_VALUE