46 #if HAVE_SETCONSOLETEXTATTRIBUTE
48 static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
49 static int16_t background, attr_orig;
51 #define set_color(x) SetConsoleTextAttribute(con, background | color[x])
52 #define reset_color() SetConsoleTextAttribute(con, attr_orig)
54 static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
55 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
56 #define reset_color() fprintf(stderr, "\033[0m")
63 #if HAVE_SETCONSOLETEXTATTRIBUTE
64 CONSOLE_SCREEN_BUFFER_INFO con_info;
65 con = GetStdHandle(STD_ERROR_HANDLE);
66 use_color = (con != INVALID_HANDLE_VALUE) && !getenv(
"NO_COLOR") &&
67 !getenv(
"AV_LOG_FORCE_NOCOLOR");
69 GetConsoleScreenBufferInfo(con, &con_info);
70 attr_orig = con_info.wAttributes;
71 background = attr_orig & 0xF0;
74 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
75 (getenv(
"TERM") && isatty(2) ||
76 getenv(
"AV_LOG_FORCE_COLOR"));
78 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
79 !getenv(
"AV_LOG_FORCE_NOCOLOR");
94 return (*(
AVClass **) ptr)->class_name;
99 static int print_prefix = 1;
101 static char prev[1024];
108 if (print_prefix && avc) {
112 if (parent && *parent) {
113 snprintf(line,
sizeof(line),
"[%s @ %p] ",
114 (*parent)->item_name(parent), parent);
117 snprintf(line + strlen(line),
sizeof(line) - strlen(line),
"[%s @ %p] ",
121 vsnprintf(line + strlen(line),
sizeof(line) - strlen(line), fmt, vl);
123 print_prefix = strlen(line) && line[strlen(line) - 1] ==
'\n';
127 is_atty = isatty(2) ? 1 : -1;
131 !strncmp(line, prev,
sizeof line)) {
134 fprintf(stderr,
" Last message repeated %d times\r", count);
138 fprintf(stderr,
" Last message repeated %d times\n", count);
153 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
186 va_list argument_list)
190 "version to the newest one from Git. If the problem still "
191 "occurs, it means that your file has a feature which has not "
192 "been implemented.\n");
195 "of this file to ftp://upload.libav.org/incoming/ "
196 "and contact the libav-devel mailing list.\n");
201 va_list argument_list;
203 va_start(argument_list, msg);
205 va_end(argument_list);
210 va_list argument_list;
212 va_start(argument_list, msg);
214 va_end(argument_list);
#define AV_LOG_WARNING
Something somehow does not look correct.
void av_log_set_level(int level)
Set the log level.
const char * av_default_item_name(void *ptr)
Return the context name.
static void missing_feature_sample(int sample, void *avc, const char *msg, va_list argument_list)
int log_level_offset_offset
Offset in the structure where log_level_offset is stored.
#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...
void av_log(void *avcl, int level, const char *fmt,...)
int av_log_get_level(void)
Get the current log level.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl)
Default logging callback.
common internal API header
void avpriv_report_missing_feature(void *avc, const char *msg,...)
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
static void(* av_log_callback)(void *, int, const char *, va_list)
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class...
static void colored_fputs(int level, const char *str)
#define AV_LOG_INFO
Standard information.
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
Describe the class of an AVClass context structure.
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int version
LIBAVUTIL_VERSION with which this structure was created.
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.
static const uint8_t color[]
void avpriv_request_sample(void *avc, const char *msg,...)
void av_log_set_flags(int arg)
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.