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)
53 #define print_256color(x)
55 static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
56 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
57 #define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)
58 #define reset_color() fprintf(stderr, "\033[0m")
64 #if HAVE_SETCONSOLETEXTATTRIBUTE
65 CONSOLE_SCREEN_BUFFER_INFO con_info;
66 con = GetStdHandle(STD_ERROR_HANDLE);
67 use_color = (con != INVALID_HANDLE_VALUE) && !getenv(
"NO_COLOR") &&
68 !getenv(
"AV_LOG_FORCE_NOCOLOR");
70 GetConsoleScreenBufferInfo(con, &con_info);
71 attr_orig = con_info.wAttributes;
72 background = attr_orig & 0xF0;
75 char *term = getenv(
"TERM");
76 use_color = !getenv(
"NO_COLOR") && !getenv(
"AV_LOG_FORCE_NOCOLOR") &&
77 (getenv(
"TERM") && isatty(2) || getenv(
"AV_LOG_FORCE_COLOR"));
79 use_color += term && strstr(term,
"256color");
81 use_color = getenv(
"AV_LOG_FORCE_COLOR") && !getenv(
"NO_COLOR") &&
82 !getenv(
"AV_LOG_FORCE_NOCOLOR");
111 return (*(
AVClass **) ptr)->class_name;
116 static int print_prefix = 1;
118 static char prev[1024];
122 unsigned tint = level & 0xff00;
129 if (print_prefix && avc) {
133 if (parent && *parent) {
134 snprintf(line,
sizeof(line),
"[%s @ %p] ",
135 (*parent)->item_name(parent), parent);
138 snprintf(line + strlen(line),
sizeof(line) - strlen(line),
"[%s @ %p] ",
142 vsnprintf(line + strlen(line),
sizeof(line) - strlen(line), fmt, vl);
144 print_prefix = strlen(line) && line[strlen(line) - 1] ==
'\n';
148 is_atty = isatty(2) ? 1 : -1;
152 !strncmp(line, prev,
sizeof line)) {
155 fprintf(stderr,
" Last message repeated %d times\r", count);
159 fprintf(stderr,
" Last message repeated %d times\n", count);
174 if (avc && avc->
version >= (50 << 16 | 15 << 8 | 2) &&
207 va_list argument_list)
211 "version to the newest one from Git. If the problem still "
212 "occurs, it means that your file has a feature which has not "
213 "been implemented.\n");
216 "of this file to ftp://upload.libav.org/incoming/ "
217 "and contact the libav-devel mailing list.\n");
222 va_list argument_list;
224 va_start(argument_list, msg);
226 va_end(argument_list);
231 va_list argument_list;
233 va_start(argument_list, msg);
235 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.
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.
static void colored_fputs(int level, int tint, const char *str)