History

log: Introduce a more verbose debug level

And deprecate av_dlog macro.

Vittorio Giovara committed 11 years ago

Commit c2533401 parent b8d7f316 files · +24 −4Browse files

Unified · Split

6 files
  1. cmdutils.c +1 −0
  2. doc/APIchanges +3 −0
  3. doc/avtools-common-opts.texi +1 −0
  4. libavutil/log.c +6 −3
  5. libavutil/log.h +9 −0
  6. libavutil/version.h +4 −1
cmdutils.c+1−0
@@ -724,6 +724,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) · 723 unmodified lines
724724 { "info" , AV_LOG_INFO },
725725 { "verbose", AV_LOG_VERBOSE },
726726 { "debug" , AV_LOG_DEBUG },
727+ { "trace" , AV_LOG_TRACE },
727728 };
728729 char *tail;
729730 int level;
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2014-08-09 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2015-xx-xx - xxxxxxx - lavu 54.12.0
17+ Add AV_LOG_TRACE for extremely verbose debugging.
18+
1619 2015-xx-xx - xxxxxxx - lavu 54.11.0
1720 Add av_small_strptime().
1821
doc/avtools-common-opts.texi+1−0
@@ -145,6 +145,7 @@ Set the logging level used by the library. · 144 unmodified lines
145145 @item info
146146 @item verbose
147147 @item debug
148+@item trace
148149 @end table
149150
150151 By default the program logs to stderr, if coloring is supported by the
libavutil/log.c+6−3
@@ -43,16 +43,19 @@ · 42 unmodified lines
4343 static int av_log_level = AV_LOG_INFO;
4444 static int flags;
4545
46+#define NB_LEVELS 8
4647 #if HAVE_SETCONSOLETEXTATTRIBUTE
4748 #include <windows.h>
48−static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
49+static const uint8_t color[NB_LEVELS] = { 12, 12, 12, 14, 7, 10, 11, 8};
4950 static int16_t background, attr_orig;
5051 static HANDLE con;
5152 #define set_color(x) SetConsoleTextAttribute(con, background | color[x])
5253 #define reset_color() SetConsoleTextAttribute(con, attr_orig)
5354 #define print_256color(x)
5455 #else
55−static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
56+static const uint8_t color[NB_LEVELS] = {
57+ 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06, 0x07
58+};
5659 #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
5760 #define print_256color(x) fprintf(stderr, "\033[38;5;%dm", x)
5861 #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) · 100 unmodified lines
159162 fprintf(stderr, " Last message repeated %d times\n", count);
160163 count = 0;
161164 }
162− colored_fputs(av_clip(level >> 3, 0, 6), tint >> 8, line);
165+ colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, line);
163166 av_strlcpy(prev, line, sizeof line);
164167 }
165168
libavutil/log.h+9−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <stdarg.h>
2525 #include "avutil.h"
2626 #include "attributes.h"
27+#include "version.h"
2728
2829 /**
2930 * Describe the class of an AVClass context structure. That is an
@@ -143,6 +144,11 @@ typedef struct AVClass { · 113 unmodified lines
143144 */
144145 #define AV_LOG_DEBUG 48
145146
147+/**
148+ * Extremely verbose debugging, useful for libav* development.
149+ */
150+#define AV_LOG_TRACE 56
151+
146152 /**
147153 * @}
148154 */
@@ -243,8 +249,10 @@ void av_log_default_callback(void *avcl, int level, const char *fmt, · 94 unmodified lines
243249 */
244250 const char* av_default_item_name(void* ctx);
245251
252+#if FF_API_DLOG
246253 /**
247254 * av_dlog macros
255+ * @deprecated unused
248256 * Useful to print debug messages that shouldn't get compiled in normally.
249257 */
250258
@@ -253,6 +261,7 @@ const char* av_default_item_name(void* ctx); · 2 unmodified lines
253261 #else
254262 # define av_dlog(pctx, ...)
255263 #endif
264+#endif /* FF_API_DLOG */
256265
257266 /**
258267 * Skip repeated messages, this requires the user app to use av_log() instead of
libavutil/version.h+4−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 */
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 54
57−#define LIBAVUTIL_VERSION_MINOR 11
57+#define LIBAVUTIL_VERSION_MINOR 12
5858 #define LIBAVUTIL_VERSION_MICRO 0
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -111,6 +111,9 @@ · 50 unmodified lines
111111 #ifndef FF_API_OPT_TYPE_METADATA
112112 #define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55)
113113 #endif
114+#ifndef FF_API_DLOG
115+#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
116+#endif
114117
115118
116119 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t