log: Introduce a more verbose debug level

And deprecate av_dlog macro.
This commit is contained in:
Vittorio Giovara
2015-03-16 08:57:34 +00:00
parent b8d7f3186e
commit c253340ae6
6 changed files with 24 additions and 4 deletions

View File

@@ -43,16 +43,19 @@
static int av_log_level = AV_LOG_INFO;
static int flags;
#define NB_LEVELS 8
#if HAVE_SETCONSOLETEXTATTRIBUTE
#include <windows.h>
static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
static const uint8_t color[NB_LEVELS] = { 12, 12, 12, 14, 7, 10, 11, 8};
static int16_t background, attr_orig;
static HANDLE con;
#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
#define reset_color() SetConsoleTextAttribute(con, attr_orig)
#define print_256color(x)
#else
static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
static const uint8_t color[NB_LEVELS] = {
0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06, 0x07
};
#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
#define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)
#define reset_color() fprintf(stderr, "\033[0m")
@@ -159,7 +162,7 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl)
fprintf(stderr, " Last message repeated %d times\n", count);
count = 0;
}
colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, line);
colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, line);
av_strlcpy(prev, line, sizeof line);
}