mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-18 12:56:56 +00:00
log: Introduce a more verbose debug level
And deprecate av_dlog macro.
This commit is contained in:
parent
b8d7f3186e
commit
c253340ae6
@ -724,6 +724,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
|
|||||||
{ "info" , AV_LOG_INFO },
|
{ "info" , AV_LOG_INFO },
|
||||||
{ "verbose", AV_LOG_VERBOSE },
|
{ "verbose", AV_LOG_VERBOSE },
|
||||||
{ "debug" , AV_LOG_DEBUG },
|
{ "debug" , AV_LOG_DEBUG },
|
||||||
|
{ "trace" , AV_LOG_TRACE },
|
||||||
};
|
};
|
||||||
char *tail;
|
char *tail;
|
||||||
int level;
|
int level;
|
||||||
|
@ -13,6 +13,9 @@ libavutil: 2014-08-09
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2015-xx-xx - xxxxxxx - lavu 54.12.0
|
||||||
|
Add AV_LOG_TRACE for extremely verbose debugging.
|
||||||
|
|
||||||
2015-xx-xx - xxxxxxx - lavu 54.11.0
|
2015-xx-xx - xxxxxxx - lavu 54.11.0
|
||||||
Add av_small_strptime().
|
Add av_small_strptime().
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ Set the logging level used by the library.
|
|||||||
@item info
|
@item info
|
||||||
@item verbose
|
@item verbose
|
||||||
@item debug
|
@item debug
|
||||||
|
@item trace
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
By default the program logs to stderr, if coloring is supported by the
|
By default the program logs to stderr, if coloring is supported by the
|
||||||
|
@ -43,16 +43,19 @@
|
|||||||
static int av_log_level = AV_LOG_INFO;
|
static int av_log_level = AV_LOG_INFO;
|
||||||
static int flags;
|
static int flags;
|
||||||
|
|
||||||
|
#define NB_LEVELS 8
|
||||||
#if HAVE_SETCONSOLETEXTATTRIBUTE
|
#if HAVE_SETCONSOLETEXTATTRIBUTE
|
||||||
#include <windows.h>
|
#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 int16_t background, attr_orig;
|
||||||
static HANDLE con;
|
static HANDLE con;
|
||||||
#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
|
#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
|
||||||
#define reset_color() SetConsoleTextAttribute(con, attr_orig)
|
#define reset_color() SetConsoleTextAttribute(con, attr_orig)
|
||||||
#define print_256color(x)
|
#define print_256color(x)
|
||||||
#else
|
#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 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 print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)
|
||||||
#define reset_color() fprintf(stderr, "\033[0m")
|
#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);
|
fprintf(stderr, " Last message repeated %d times\n", count);
|
||||||
count = 0;
|
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);
|
av_strlcpy(prev, line, sizeof line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "avutil.h"
|
#include "avutil.h"
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe the class of an AVClass context structure. That is an
|
* Describe the class of an AVClass context structure. That is an
|
||||||
@ -143,6 +144,11 @@ typedef struct AVClass {
|
|||||||
*/
|
*/
|
||||||
#define AV_LOG_DEBUG 48
|
#define AV_LOG_DEBUG 48
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extremely verbose debugging, useful for libav* development.
|
||||||
|
*/
|
||||||
|
#define AV_LOG_TRACE 56
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@ -243,8 +249,10 @@ void av_log_default_callback(void *avcl, int level, const char *fmt,
|
|||||||
*/
|
*/
|
||||||
const char* av_default_item_name(void* ctx);
|
const char* av_default_item_name(void* ctx);
|
||||||
|
|
||||||
|
#if FF_API_DLOG
|
||||||
/**
|
/**
|
||||||
* av_dlog macros
|
* av_dlog macros
|
||||||
|
* @deprecated unused
|
||||||
* Useful to print debug messages that shouldn't get compiled in normally.
|
* Useful to print debug messages that shouldn't get compiled in normally.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -253,6 +261,7 @@ const char* av_default_item_name(void* ctx);
|
|||||||
#else
|
#else
|
||||||
# define av_dlog(pctx, ...)
|
# define av_dlog(pctx, ...)
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* FF_API_DLOG */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip repeated messages, this requires the user app to use av_log() instead of
|
* Skip repeated messages, this requires the user app to use av_log() instead of
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 54
|
#define LIBAVUTIL_VERSION_MAJOR 54
|
||||||
#define LIBAVUTIL_VERSION_MINOR 11
|
#define LIBAVUTIL_VERSION_MINOR 12
|
||||||
#define LIBAVUTIL_VERSION_MICRO 0
|
#define LIBAVUTIL_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
@ -111,6 +111,9 @@
|
|||||||
#ifndef FF_API_OPT_TYPE_METADATA
|
#ifndef FF_API_OPT_TYPE_METADATA
|
||||||
#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55)
|
#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_DLOG
|
||||||
|
#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user