API: add FIXME and DUMPMEM log levels and convenience macros

Two new log levels to dump FIXMEs into the log and to log data
in form of a hex dump (#578114).

API: GST_CAT_FIXME_OBJECT
API: GST_CAT_MEMDUMP_OBJECT
API: GST_CAT_FIXME
API: GST_CAT_MEMDUMP
API: GST_FIXME_OBJECT
API: GST_MEMDUMP_OBJECT
API: GST_FIXME
API: GST_MEMDUMP
This commit is contained in:
Tim-Philipp Müller 2009-04-06 01:27:26 +01:00
parent 7d0b4f10c6
commit 116c8be6bf
5 changed files with 339 additions and 5 deletions

View file

@ -930,21 +930,29 @@ GST_CAT_WARNING_OBJECT
GST_CAT_INFO_OBJECT
GST_CAT_DEBUG_OBJECT
GST_CAT_LOG_OBJECT
GST_CAT_FIXME_OBJECT
GST_CAT_MEMDUMP_OBJECT
GST_CAT_ERROR
GST_CAT_WARNING
GST_CAT_INFO
GST_CAT_DEBUG
GST_CAT_LOG
GST_CAT_FIXME
GST_CAT_MEMDUMP
GST_ERROR_OBJECT
GST_WARNING_OBJECT
GST_INFO_OBJECT
GST_DEBUG_OBJECT
GST_LOG_OBJECT
GST_FIXME_OBJECT
GST_MEMDUMP_OBJECT
GST_ERROR
GST_WARNING
GST_INFO
GST_DEBUG
GST_LOG
GST_FIXME
GST_MEMDUMP
GST_DEBUG_FUNCPTR
GST_DEBUG_FUNCPTR_NAME
GST_DEBUG_BIN_TO_DOT_FILE

View file

@ -702,7 +702,7 @@ gst_debug_construct_win_color (guint colorinfo)
#define CAT_FMT "%20s %s:%d:%s:%s"
#ifdef G_OS_WIN32
static const guchar levelcolormap[] = {
static const guchar levelcolormap[GST_LEVEL_COUNT] = {
/* GST_LEVEL_NONE */
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
/* GST_LEVEL_ERROR */
@ -714,22 +714,34 @@ static const guchar levelcolormap[] = {
/* GST_LEVEL_DEBUG */
FOREGROUND_GREEN | FOREGROUND_BLUE,
/* GST_LEVEL_LOG */
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
/* GST_LEVEL_FIXME */
FOREGROUND_RED | FOREGROUND_GREEN,
/* placeholder for log level 7 */
0,
/* placeholder for log level 8 */
0,
/* GST_LEVEL_MEMDUMP */
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
};
static const guchar available_colors[6] = {
static const guchar available_colors[] = {
FOREGROUND_RED, FOREGROUND_GREEN, FOREGROUND_RED | FOREGROUND_GREEN,
FOREGROUND_BLUE, FOREGROUND_RED | FOREGROUND_BLUE,
FOREGROUND_GREEN | FOREGROUND_BLUE,
};
#else
static const gchar *levelcolormap[] = {
static const gchar *levelcolormap[GST_LEVEL_COUNT] = {
"\033[37m", /* GST_LEVEL_NONE */
"\033[31;01m", /* GST_LEVEL_ERROR */
"\033[33;01m", /* GST_LEVEL_WARNING */
"\033[32;01m", /* GST_LEVEL_INFO */
"\033[36m", /* GST_LEVEL_DEBUG */
"\033[37m" /* GST_LEVEL_LOG */
"\033[37m", /* GST_LEVEL_LOG */
"\033[33;01m", /* GST_LEVEL_FIXME */
"\033[37m", /* placeholder for log level 7 */
"\033[37m", /* placeholder for log level 8 */
"\033[37m" /* GST_LEVEL_MEMDUMP */
};
#endif
@ -806,7 +818,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
/* timestamp */
g_printerr ("%" GST_TIME_FORMAT " ", GST_TIME_ARGS (elapsed));
/* pid */
SET_COLOR (available_colors[pid % 6]);
SET_COLOR (available_colors[pid % G_N_ELEMENTS (available_colors)]);
g_printerr (PID_FMT, pid);
/* thread */
SET_COLOR (clear);
@ -860,6 +872,10 @@ gst_debug_level_get_name (GstDebugLevel level)
return "DEBUG";
case GST_LEVEL_LOG:
return "LOG ";
case GST_LEVEL_FIXME:
return "FIXME";
case GST_LEVEL_MEMDUMP:
return "MEMDUMP ";
default:
g_warning ("invalid level specified for gst_debug_level_get_name");
return "";
@ -1468,6 +1484,62 @@ _gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
}
#endif /* HAVE_PRINTF_EXTENSION */
static void
gst_info_dump_mem_line (gchar * linebuf, gsize linebuf_size,
const guint8 * mem, gsize mem_offset, gsize mem_size)
{
gchar hexstr[50], ascstr[18], digitstr[4];
if (mem_size > 16)
mem_size = 16;
hexstr[0] = '\0';
ascstr[0] = '\0';
if (mem != NULL) {
guint i = 0;
mem += mem_offset;
while (i < mem_size) {
ascstr[i] = (g_ascii_isprint (mem[i])) ? mem[i] : '.';
g_snprintf (digitstr, sizeof (digitstr), "%02x ", mem[i]);
g_strlcat (hexstr, digitstr, sizeof (hexstr));
++i;
}
ascstr[i] = '\0';
}
g_snprintf (linebuf, linebuf_size, "%08x: %-48.48s %-16.16s",
mem_offset, hexstr, ascstr);
}
void
_gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
const gchar * func, gint line, GObject * obj, const gchar * msg,
const guint8 * data, guint length)
{
guint off = 0;
gst_debug_log ((cat), GST_LEVEL_MEMDUMP, file, func, line, obj, "--------"
"-------------------------------------------------------------------");
if (msg != NULL && *msg != '\0') {
gst_debug_log ((cat), GST_LEVEL_MEMDUMP, file, func, line, obj, msg);
}
while (off < length) {
gchar buf[128];
/* gst_info_dump_mem_line will process 16 bytes at most */
gst_info_dump_mem_line (buf, sizeof (buf), data, off, length - off);
gst_debug_log (cat, GST_LEVEL_MEMDUMP, file, func, line, obj, "%s", buf);
off += 16;
}
gst_debug_log ((cat), GST_LEVEL_MEMDUMP, file, func, line, obj, "--------"
"-------------------------------------------------------------------");
}
#else /* !GST_DISABLE_GST_DEBUG */
#ifndef GST_REMOVE_DISABLED
void
@ -1537,6 +1609,13 @@ _priv_gst_in_valgrind (void)
{
return FALSE;
}
void
_gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
const gchar * func, gint line, GObject * obj, const gchar * msg,
const guint8 * data, guint length)
{
}
#endif /* GST_REMOVE_DISABLED */
#endif /* GST_DISABLE_GST_DEBUG */

View file

@ -59,6 +59,14 @@ G_BEGIN_DECLS
* useful to know. As a rule of thumb a pipeline that is iterating as expected
* should never output anzthing else but LOG messages.
* Examples for this are referencing/dereferencing of objects or cothread switches.
* @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
* in the executed code path is not fully implemented or handled yet. Note
* that this does not replace proper error handling in any way, the purpose
* of this message is to make it easier to spot incomplete/unfinished pieces
* of code when reading the debug log. (Since: 0.10.23)
* @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
* data as memory dumps in the log. They will be displayed as hexdump with
* ASCII characters. (Since: 0.10.23)
* @GST_LEVEL_COUNT: The number of defined debugging levels.
*
* The level defines the importance of a debugging message. The more important a
@ -71,6 +79,9 @@ typedef enum {
GST_LEVEL_INFO,
GST_LEVEL_DEBUG,
GST_LEVEL_LOG,
GST_LEVEL_FIXME = 6,
/* add more */
GST_LEVEL_MEMDUMP = 9,
/* add more */
GST_LEVEL_COUNT
} GstDebugLevel;
@ -464,6 +475,30 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#endif
#endif /* G_HAVE_ISO_VARARGS */
/* private helper function */
void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
const gchar * func, gint line, GObject * obj, const gchar * msg,
const guint8 * data, guint length);
/* This one doesn't have varargs in the macro, so it's different than all the
* other macros and hence in a separate block right here. Docs chunks are
* with the other doc chunks below though. */
#define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{ \
if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= __gst_debug_min)) { \
_gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__, \
(GObject *) (object), (msg), (data), (length)); \
} \
}G_STMT_END
#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) \
__GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
#define GST_CAT_MEMDUMP(cat,msg,data,length) \
__GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
#define GST_MEMDUMP_OBJECT(obj,msg,data,length) \
__GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
#define GST_MEMDUMP(msg,data,length) \
__GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
/**
* GST_CAT_ERROR_OBJECT:
* @cat: category to use
@ -505,6 +540,29 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
*
* Output an logging message belonging to the given object in the given category.
*/
/**
* GST_CAT_FIXME_OBJECT:
* @cat: category to use
* @obj: the #GObject the message belongs to
* @...: printf-style message to output
*
* Output a fixme message belonging to the given object in the given category.
*
* Since: 0.10.23
*/
/**
* GST_CAT_MEMDUMP_OBJECT:
* @cat: category to use
* @obj: the #GObject the message belongs to
* @msg: message string to log with the data
* @data: pointer to the data to output
* @length: length of the data to output
*
* Output a hexdump of @data relating to the given object in the given
* category.
*
* Since: 0.10.23
*/
/**
@ -542,6 +600,26 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
*
* Output an logging message in the given category.
*/
/**
* GST_CAT_FIXME:
* @cat: category to use
* @...: printf-style message to output
*
* Output an fixme message in the given category.
*
* Since: 0.10.23
*/
/**
* GST_CAT_MEMDUMP:
* @cat: category to use
* @msg: message string to log with the data
* @data: pointer to the data to output
* @length: length of the data to output
*
* Output a hexdump of @data in the given category.
*
* Since: 0.10.23
*/
/**
@ -581,6 +659,26 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
*
* Output a logging message belonging to the given object in the default category.
*/
/**
* GST_FIXME_OBJECT:
* @obj: the #GObject the message belongs to
* @...: printf-style message to output
*
* Output a logging message belonging to the given object in the default category.
*
* Since: 0.10.23
*/
/**
* GST_MEMDUMP_OBJECT:
* @obj: the #GObject the message belongs to
* @msg: message string to log with the data
* @data: pointer to the data to output
* @length: length of the data to output
*
* Output a logging message belonging to the given object in the default category.
*
* Since: 0.10.23
*/
/**
@ -613,6 +711,24 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
*
* Output a logging message in the default category.
*/
/**
* GST_FIXME:
* @...: printf-style message to output
*
* Output a fixme message in the default category.
*
* Since: 0.10.23
*/
/**
* GST_MEMDUMP:
* @msg: message string to log with the data
* @data: pointer to the data to output
* @length: length of the data to output
*
* Output a hexdump of @data.
*
* Since: 0.10.23
*/
#ifdef G_HAVE_ISO_VARARGS
@ -621,24 +737,28 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
#define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
#define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
#define GST_CAT_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__)
#define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
#define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
#define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
#define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
#define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
#define GST_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
#define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
#define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
#define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
#define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
#define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
#define GST_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__)
#define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
#define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
#define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
#define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
#define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
#define GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
#else
#ifdef G_HAVE_GNUC_VARARGS
@ -648,24 +768,28 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
#define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
#define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
#define GST_CAT_FIXME_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, ##args )
#define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
#define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
#define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
#define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
#define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
#define GST_CAT_FIXME(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, ##args )
#define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
#define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
#define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
#define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
#define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
#define GST_FIXME_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, ##args )
#define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
#define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
#define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
#define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
#define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
#define GST_FIXME(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, ##args )
#else
/* no variadic macros, use inline */
@ -724,6 +848,17 @@ GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
va_end (varargs);
}
static inline void
GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
va_end (varargs);
}
static inline void
GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
{
@ -774,6 +909,16 @@ GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
va_end (varargs);
}
static inline void
GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
va_end (varargs);
}
static inline void
GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
{
@ -829,6 +974,17 @@ GST_LOG_OBJECT (gpointer obj, const char *format, ...)
va_end (varargs);
}
static inline void
GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
varargs);
va_end (varargs);
}
static inline void
GST_ERROR (const char *format, ...)
{
@ -883,6 +1039,17 @@ GST_LOG (const char *format, ...)
format, varargs);
va_end (varargs);
}
static inline void
GST_FIXME (const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
varargs);
va_end (varargs);
}
#endif
#endif
@ -975,24 +1142,28 @@ guint gst_debug_remove_log_function_by_data (gpointer data);
#define GST_CAT_INFO_OBJECT(...) /* NOP */
#define GST_CAT_DEBUG_OBJECT(...) /* NOP */
#define GST_CAT_LOG_OBJECT(...) /* NOP */
#define GST_CAT_FIXME_OBJECT(...) /* NOP */
#define GST_CAT_ERROR(...) /* NOP */
#define GST_CAT_WARNING(...) /* NOP */
#define GST_CAT_INFO(...) /* NOP */
#define GST_CAT_DEBUG(...) /* NOP */
#define GST_CAT_LOG(...) /* NOP */
#define GST_CAT_FIXME(...) /* NOP */
#define GST_ERROR_OBJECT(...) /* NOP */
#define GST_WARNING_OBJECT(...) /* NOP */
#define GST_INFO_OBJECT(...) /* NOP */
#define GST_DEBUG_OBJECT(...) /* NOP */
#define GST_LOG_OBJECT(...) /* NOP */
#define GST_FIXME_OBJECT(...) /* NOP */
#define GST_ERROR(...) /* NOP */
#define GST_WARNING(...) /* NOP */
#define GST_INFO(...) /* NOP */
#define GST_DEBUG(...) /* NOP */
#define GST_LOG(...) /* NOP */
#define GST_FIXME(...) /* NOP */
#else
#ifdef G_HAVE_GNUC_VARARGS
@ -1004,24 +1175,28 @@ guint gst_debug_remove_log_function_by_data (gpointer data);
#define GST_CAT_INFO_OBJECT(args...) /* NOP */
#define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
#define GST_CAT_LOG_OBJECT(args...) /* NOP */
#define GST_CAT_FIXME_OBJECT(args...) /* NOP */
#define GST_CAT_ERROR(args...) /* NOP */
#define GST_CAT_WARNING(args...) /* NOP */
#define GST_CAT_INFO(args...) /* NOP */
#define GST_CAT_DEBUG(args...) /* NOP */
#define GST_CAT_LOG(args...) /* NOP */
#define GST_CAT_FIXME(args...) /* NOP */
#define GST_ERROR_OBJECT(args...) /* NOP */
#define GST_WARNING_OBJECT(args...) /* NOP */
#define GST_INFO_OBJECT(args...) /* NOP */
#define GST_DEBUG_OBJECT(args...) /* NOP */
#define GST_LOG_OBJECT(args...) /* NOP */
#define GST_FIXME_OBJECT(args...) /* NOP */
#define GST_ERROR(args...) /* NOP */
#define GST_WARNING(args...) /* NOP */
#define GST_INFO(args...) /* NOP */
#define GST_DEBUG(args...) /* NOP */
#define GST_LOG(args...) /* NOP */
#define GST_FIXME(args...) /* NOP */
#else
static inline void
@ -1060,6 +1235,12 @@ GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
{
}
static inline void
GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
...)
{
}
static inline void
GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
{
@ -1085,6 +1266,11 @@ GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
{
}
static inline void
GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
{
}
static inline void
GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
{
@ -1110,6 +1296,11 @@ GST_LOG_OBJECT (gpointer obj, const char *format, ...)
{
}
static inline void
GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
{
}
static inline void
GST_ERROR (const char *format, ...)
{
@ -1134,12 +1325,23 @@ static inline void
GST_LOG (const char *format, ...)
{
}
static inline void
GST_FIXME (const char *format, ...)
{
}
#endif
#endif
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) /* NOP */
#define GST_CAT_MEMDUMP(cat,msg,data,length) /* NOP */
#define GST_MEMDUMP_OBJECT(obj,msg,data,length) /* NOP */
#define GST_MEMDUMP(msg,data,length) /* NOP */
#endif /* GST_DISABLE_GST_DEBUG */

View file

@ -190,6 +190,48 @@ GST_START_TEST (info_log_handler)
GST_END_TEST;
GST_START_TEST (info_dump_mem)
{
GstDebugCategory *cat = NULL;
GstElement *e;
const guint8 data[] = { 0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70,
0x71, 0x74, 0x20, 0x20, 0x20, 0x05, 0x03, 0x00, 0x71, 0x74, 0x20, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xef, 0xe1, 0x6d, 0x6f, 0x6f, 0x76, 0x00, 0x00, 0x00, 0x6c,
0x6d, 0x76, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xd1, 0x00, 0x1d,
0xbf, 0xd1, 0x00, 0x1e, 0x00, 0x00, 0x0b, 0xb5, 0x00, 0x04, 0x59, 0xc5,
0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, '%', 's', '%', 's'
};
e = gst_element_factory_make ("fakesink", NULL);
GST_DEBUG_CATEGORY_INIT (cat, "dumpcat", 0, "data dump debug category");
GST_MEMDUMP ("quicktime header", data, sizeof (data));
GST_MEMDUMP (NULL, data, sizeof (data));
GST_CAT_MEMDUMP (cat, "quicktime header", data, sizeof (data));
GST_MEMDUMP_OBJECT (e, "object stuff", data, sizeof (data));
GST_CAT_MEMDUMP_OBJECT (cat, e, "object/cat stuff", data, sizeof (data));
gst_object_unref (e);
}
GST_END_TEST;
GST_START_TEST (info_fixme)
{
GstDebugCategory *cat = NULL;
GstElement *e;
e = gst_element_factory_make ("fakesink", NULL);
GST_DEBUG_CATEGORY_INIT (cat, "fixcat", 0, "FIXME debug category");
GST_FIXME ("fix %s thing", "this");
GST_FIXME_OBJECT (e, "fix %s object", "this");
GST_CAT_FIXME (cat, "fix some%s in this category", "thing");
GST_CAT_FIXME_OBJECT (cat, e, "fix some%s in this cat and object", "thing");
gst_object_unref (e);
}
GST_END_TEST;
#endif
static Suite *
@ -205,6 +247,8 @@ gst_info_suite (void)
tcase_add_test (tc_chain, info_segment_format_printf_extension);
tcase_add_test (tc_chain, info_ptr_format_printf_extension);
tcase_add_test (tc_chain, info_log_handler);
tcase_add_test (tc_chain, info_dump_mem);
tcase_add_test (tc_chain, info_fixme);
#endif
return s;

View file

@ -35,6 +35,7 @@ EXPORTS
_gst_debug_bin_to_dot_file
_gst_debug_bin_to_dot_file_with_ts
_gst_debug_category_new
_gst_debug_dump_mem
_gst_debug_nameof_funcptr
_gst_debug_register_funcptr
_gst_element_error_printf