43 #if HAVE_VALGRIND_VALGRIND_H 44 #include <valgrind/valgrind.h> 46 #define BACKTRACE_LOGLEVEL AV_LOG_ERROR 53 #if HAVE_SETCONSOLETEXTATTRIBUTE 56 static int16_t background, attr_orig;
58 #define set_color(x) SetConsoleTextAttribute(con, background | color[x]) 59 #define reset_color() SetConsoleTextAttribute(con, attr_orig) 60 #define print_256color(x) 63 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06, 0x07
65 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15) 66 #define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x) 67 #define reset_color() fprintf(stderr, "\033[0m") 73 #if HAVE_SETCONSOLETEXTATTRIBUTE 74 CONSOLE_SCREEN_BUFFER_INFO con_info;
75 con = GetStdHandle(STD_ERROR_HANDLE);
76 use_color = (con != INVALID_HANDLE_VALUE) && !getenv(
"NO_COLOR") &&
77 !getenv(
"AV_LOG_FORCE_NOCOLOR");
79 GetConsoleScreenBufferInfo(con, &con_info);
80 attr_orig = con_info.wAttributes;
81 background = attr_orig & 0xF0;
84 char *term = getenv(
"TERM");
85 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
86 (getenv(
"TERM") &&
isatty(2) || getenv(
"AV_LOG_FORCE_COLOR"));
88 use_color += term && strstr(term,
"256color");
90 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
91 !getenv(
"AV_LOG_FORCE_NOCOLOR");
120 return (*(
AVClass **) ptr)->class_name;
125 static int print_prefix = 1;
127 static char prev[1024];
131 unsigned tint = level & 0xff00;
138 if (print_prefix && avc) {
142 if (parent && *parent) {
143 snprintf(line,
sizeof(line),
"[%s @ %p] ",
144 (*parent)->item_name(parent), parent);
147 snprintf(line + strlen(line),
sizeof(line) - strlen(line),
"[%s @ %p] ",
151 vsnprintf(line + strlen(line),
sizeof(line) - strlen(line), fmt, vl);
153 print_prefix = strlen(line) && line[strlen(line) - 1] ==
'\n';
157 is_atty =
isatty(2) ? 1 : -1;
161 !strncmp(line, prev,
sizeof line)) {
164 fprintf(stderr,
" Last message repeated %d times\r", count);
168 fprintf(stderr,
" Last message repeated %d times\n", count);
174 #if CONFIG_VALGRIND_BACKTRACE 175 if (level <= BACKTRACE_LOGLEVEL)
176 VALGRIND_PRINTF_BACKTRACE(
"");
188 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
221 va_list argument_list)
225 "version to the newest one from Git. If the problem still " 226 "occurs, it means that your file has a feature which has not " 227 "been implemented.\n");
230 "of this file to ftp://upload.libav.org/incoming/ " 231 "and contact the libav-devel mailing list.\n");
236 va_list argument_list;
238 va_start(argument_list, msg);
240 va_end(argument_list);
245 va_list argument_list;
247 va_start(argument_list, msg);
249 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)
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class...
int log_level_offset_offset
Offset in the structure where log_level_offset is stored.
#define print_256color(x)
#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
static void check_color_terminal(void)
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)
#define AV_LOG_INFO
Standard information.
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
Describe the class of an AVClass context structure.
static const uint8_t color[NB_LEVELS]
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.
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.
static void colored_fputs(int level, int tint, const char *str)