info: add new TRACE log level and move refcounting there from LOG level

This makes it possible to easily get a *:5 debug log without all
the refcounting noise, and drastically reduces the number of lines
output for a normal log (46m to 28m for a 20min video). The full log
including refcounting information can still be gotten using *:7.

Fixes #620460.
This commit is contained in:
Tim-Philipp Müller 2010-06-03 01:49:51 +01:00
parent 2d5b1bbc1d
commit 66fc4c8ba2
6 changed files with 128 additions and 29 deletions

View file

@ -995,6 +995,7 @@ GST_CAT_INFO_OBJECT
GST_CAT_DEBUG_OBJECT GST_CAT_DEBUG_OBJECT
GST_CAT_LOG_OBJECT GST_CAT_LOG_OBJECT
GST_CAT_FIXME_OBJECT GST_CAT_FIXME_OBJECT
GST_CAT_TRACE_OBJECT
GST_CAT_MEMDUMP_OBJECT GST_CAT_MEMDUMP_OBJECT
GST_CAT_ERROR GST_CAT_ERROR
GST_CAT_WARNING GST_CAT_WARNING
@ -1002,6 +1003,7 @@ GST_CAT_INFO
GST_CAT_DEBUG GST_CAT_DEBUG
GST_CAT_LOG GST_CAT_LOG
GST_CAT_FIXME GST_CAT_FIXME
GST_CAT_TRACE
GST_CAT_MEMDUMP GST_CAT_MEMDUMP
GST_ERROR_OBJECT GST_ERROR_OBJECT
GST_WARNING_OBJECT GST_WARNING_OBJECT
@ -1009,6 +1011,7 @@ GST_INFO_OBJECT
GST_DEBUG_OBJECT GST_DEBUG_OBJECT
GST_LOG_OBJECT GST_LOG_OBJECT
GST_FIXME_OBJECT GST_FIXME_OBJECT
GST_TRACE_OBJECT
GST_MEMDUMP_OBJECT GST_MEMDUMP_OBJECT
GST_ERROR GST_ERROR
GST_WARNING GST_WARNING
@ -1016,6 +1019,7 @@ GST_INFO
GST_DEBUG GST_DEBUG
GST_LOG GST_LOG
GST_FIXME GST_FIXME
GST_TRACE
GST_MEMDUMP GST_MEMDUMP
GST_DEBUG_REGISTER_FUNCPTR GST_DEBUG_REGISTER_FUNCPTR
GST_DEBUG_FUNCPTR GST_DEBUG_FUNCPTR

View file

@ -394,7 +394,7 @@ gst_caps_ref (GstCaps * caps)
g_return_val_if_fail (caps != NULL, NULL); g_return_val_if_fail (caps != NULL, NULL);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p %d->%d", caps, GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p %d->%d", caps,
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) + 1); GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) + 1);
#endif #endif
g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0, NULL); g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0, NULL);
@ -417,7 +417,7 @@ gst_caps_unref (GstCaps * caps)
g_return_if_fail (caps != NULL); g_return_if_fail (caps != NULL);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p %d->%d", caps, GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p %d->%d", caps,
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) - 1); GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) - 1);
#endif #endif
@ -2000,7 +2000,7 @@ gst_caps_replace (GstCaps ** caps, GstCaps * newcaps)
oldcaps = *caps; oldcaps = *caps;
GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p, %p -> %p", caps, oldcaps, newcaps); GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p, %p -> %p", caps, oldcaps, newcaps);
if (newcaps != oldcaps) { if (newcaps != oldcaps) {
if (newcaps) if (newcaps)

View file

@ -830,8 +830,8 @@ static const guchar levelcolormap[GST_LEVEL_COUNT] = {
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
/* GST_LEVEL_FIXME */ /* GST_LEVEL_FIXME */
FOREGROUND_RED | FOREGROUND_GREEN, FOREGROUND_RED | FOREGROUND_GREEN,
/* placeholder for log level 7 */ /* GST_LEVEL_TRACE */
0, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
/* placeholder for log level 8 */ /* placeholder for log level 8 */
0, 0,
/* GST_LEVEL_MEMDUMP */ /* GST_LEVEL_MEMDUMP */
@ -852,7 +852,7 @@ static const gchar *levelcolormap[GST_LEVEL_COUNT] = {
"\033[36m", /* GST_LEVEL_DEBUG */ "\033[36m", /* GST_LEVEL_DEBUG */
"\033[37m", /* GST_LEVEL_LOG */ "\033[37m", /* GST_LEVEL_LOG */
"\033[33;01m", /* GST_LEVEL_FIXME */ "\033[33;01m", /* GST_LEVEL_FIXME */
"\033[37m", /* placeholder for log level 7 */ "\033[37m", /* GST_LEVEL_TRACE */
"\033[37m", /* placeholder for log level 8 */ "\033[37m", /* placeholder for log level 8 */
"\033[37m" /* GST_LEVEL_MEMDUMP */ "\033[37m" /* GST_LEVEL_MEMDUMP */
}; };
@ -992,6 +992,8 @@ gst_debug_level_get_name (GstDebugLevel level)
return "LOG "; return "LOG ";
case GST_LEVEL_FIXME: case GST_LEVEL_FIXME:
return "FIXME "; return "FIXME ";
case GST_LEVEL_TRACE:
return "TRACE ";
case GST_LEVEL_MEMDUMP: case GST_LEVEL_MEMDUMP:
return "MEMDUMP"; return "MEMDUMP";
default: default:

View file

@ -52,18 +52,23 @@ G_BEGIN_DECLS
* successfully determined the type of the stream or when an mp3 plugin detects * successfully determined the type of the stream or when an mp3 plugin detects
* the format to be used. ("This file has mono sound.") * the format to be used. ("This file has mono sound.")
* @GST_LEVEL_DEBUG: Debugging messages should be used when something common * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
* happens that is not the expected default behavior. * happens that is not the expected default behavior, or something that's
* An example would be notifications about state changes or receiving/sending of * useful to know but doesn't happen all the time (ie. per loop iteration or
* events. * buffer processed or event handled).
* An example would be notifications about state changes or receiving/sending
* of events.
* @GST_LEVEL_LOG: Log messages are messages that are very common but might be * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
* useful to know. As a rule of thumb a pipeline that is iterating as expected * useful to know. As a rule of thumb a pipeline that is iterating as expected
* should never output anzthing else but LOG messages. * should never output anything else but LOG messages. Use this log level to
* Examples for this are referencing/dereferencing of objects or cothread switches. * log recurring information in chain functions and loop functions, for
* example.
* @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
* in the executed code path is not fully implemented or handled yet. Note * 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 * 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 this message is to make it easier to spot incomplete/unfinished pieces
* of code when reading the debug log. (Since: 0.10.23) * of code when reading the debug log. (Since: 0.10.23)
* @GST_LEVEL_TRACE: Tracing-related messages (Since: 0.10.30)
* Examples for this are referencing/dereferencing of objects.
* @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of * @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 * data as memory dumps in the log. They will be displayed as hexdump with
* ASCII characters. (Since: 0.10.23) * ASCII characters. (Since: 0.10.23)
@ -80,6 +85,7 @@ typedef enum {
GST_LEVEL_DEBUG, GST_LEVEL_DEBUG,
GST_LEVEL_LOG, GST_LEVEL_LOG,
GST_LEVEL_FIXME = 6, GST_LEVEL_FIXME = 6,
GST_LEVEL_TRACE = 7,
/* add more */ /* add more */
GST_LEVEL_MEMDUMP = 9, GST_LEVEL_MEMDUMP = 9,
/* add more */ /* add more */
@ -602,6 +608,17 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
* *
* Since: 0.10.23 * Since: 0.10.23
*/ */
/**
* GST_CAT_TRACE_OBJECT:
* @cat: category to use
* @obj: the #GObject the message belongs to
* @...: printf-style message to output
*
* Output a tracing message belonging to the given object in the given
* category.
*
* Since: 0.10.30
*/
/** /**
* GST_CAT_MEMDUMP_OBJECT: * GST_CAT_MEMDUMP_OBJECT:
* @cat: category to use * @cat: category to use
@ -661,6 +678,15 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
* *
* Since: 0.10.23 * Since: 0.10.23
*/ */
/**
* GST_CAT_TRACE:
* @cat: category to use
* @...: printf-style message to output
*
* Output a tracing message in the given category.
*
* Since: 0.10.30
*/
/** /**
* GST_CAT_MEMDUMP: * GST_CAT_MEMDUMP:
* @cat: category to use * @cat: category to use
@ -716,10 +742,19 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
* @obj: the #GObject the message belongs to * @obj: the #GObject the message belongs to
* @...: printf-style message to output * @...: printf-style message to output
* *
* Output a logging message belonging to the given object in the default category. * Output a fixme message belonging to the given object in the default category.
* *
* Since: 0.10.23 * Since: 0.10.23
*/ */
/**
* GST_TRACE_OBJECT:
* @obj: the #GObject the message belongs to
* @...: printf-style message to output
*
* Output a tracing message belonging to the given object in the default category.
*
* Since: 0.10.30
*/
/** /**
* GST_MEMDUMP_OBJECT: * GST_MEMDUMP_OBJECT:
* @obj: the #GObject the message belongs to * @obj: the #GObject the message belongs to
@ -771,6 +806,14 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
* *
* Since: 0.10.23 * Since: 0.10.23
*/ */
/**
* GST_TRACE:
* @...: printf-style message to output
*
* Output a tracing message in the default category.
*
* Since: 0.10.30
*/
/** /**
* GST_MEMDUMP: * GST_MEMDUMP:
* @msg: message string to log with the data * @msg: message string to log with the data
@ -790,6 +833,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, 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_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_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__)
#define GST_CAT_TRACE_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, __VA_ARGS__)
#define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __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_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
@ -797,6 +841,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, 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_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_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
#define GST_CAT_TRACE(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
#define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __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_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
@ -804,6 +849,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, 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_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_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__)
#define GST_TRACE_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, __VA_ARGS__)
#define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __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_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
@ -811,6 +857,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, 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_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__) #define GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
#define GST_TRACE(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
#else #else
#ifdef G_HAVE_GNUC_VARARGS #ifdef G_HAVE_GNUC_VARARGS
@ -821,6 +868,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, 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_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_FIXME_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, ##args )
#define GST_CAT_TRACE_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, ##args )
#define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##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_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
@ -828,6 +876,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, 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_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_CAT_FIXME(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, ##args )
#define GST_CAT_TRACE(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, ##args )
#define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##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_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
@ -835,6 +884,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, 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_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_FIXME_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, ##args )
#define GST_TRACE_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, ##args )
#define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##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_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
@ -842,6 +892,7 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
#define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, 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_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 ) #define GST_FIXME(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, ##args )
#define GST_TRACE(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, ##args )
#else #else
/* no variadic macros, use inline */ /* no variadic macros, use inline */
@ -911,6 +962,17 @@ GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
va_end (varargs); va_end (varargs);
} }
static inline void
GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
va_end (varargs);
}
static inline void static inline void
GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...) GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
{ {
@ -971,6 +1033,16 @@ GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
va_end (varargs); va_end (varargs);
} }
static inline void
GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
va_end (varargs);
}
static inline void static inline void
GST_ERROR_OBJECT (gpointer obj, const char *format, ...) GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
{ {
@ -1037,6 +1109,17 @@ GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
va_end (varargs); va_end (varargs);
} }
static inline void
GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
varargs);
va_end (varargs);
}
static inline void static inline void
GST_ERROR (const char *format, ...) GST_ERROR (const char *format, ...)
{ {
@ -1102,6 +1185,17 @@ GST_FIXME (const char *format, ...)
varargs); varargs);
va_end (varargs); va_end (varargs);
} }
static inline void
GST_TRACE (const char *format, ...)
{
va_list varargs;
va_start (varargs, format);
GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
varargs);
va_end (varargs);
}
#endif #endif
#endif #endif

View file

@ -309,8 +309,7 @@ gst_mini_object_ref (GstMiniObject * mini_object)
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
g_return_val_if_fail (GST_IS_MINI_OBJECT (mini_object), NULL); g_return_val_if_fail (GST_IS_MINI_OBJECT (mini_object), NULL);
GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p ref %d->%d", GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p ref %d->%d", mini_object,
mini_object,
GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object), GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) + 1); GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) + 1);
#endif #endif
@ -359,7 +358,7 @@ gst_mini_object_unref (GstMiniObject * mini_object)
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
g_return_if_fail (GST_IS_MINI_OBJECT (mini_object)); g_return_if_fail (GST_IS_MINI_OBJECT (mini_object));
GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p unref %d->%d", GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p unref %d->%d",
mini_object, mini_object,
GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object), GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) - 1); GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) - 1);
@ -387,7 +386,7 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
g_return_if_fail (olddata != NULL); g_return_if_fail (olddata != NULL);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG (GST_CAT_REFCOUNTING, "replace %p (%d) with %p (%d)", GST_CAT_TRACE (GST_CAT_REFCOUNTING, "replace %p (%d) with %p (%d)",
*olddata, *olddata ? (*olddata)->refcount : 0, *olddata, *olddata ? (*olddata)->refcount : 0,
newdata, newdata ? newdata->refcount : 0); newdata, newdata ? newdata->refcount : 0);
#endif #endif

View file

@ -261,7 +261,7 @@ gst_object_init (GstObject * object)
object->lock = g_mutex_new (); object->lock = g_mutex_new ();
object->parent = NULL; object->parent = NULL;
object->name = NULL; object->name = NULL;
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p new", object); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p new", object);
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
gst_alloc_trace_new (_gst_object_trace, object); gst_alloc_trace_new (_gst_object_trace, object);
@ -291,8 +291,7 @@ gst_object_ref (gpointer object)
g_return_val_if_fail (object != NULL, NULL); g_return_val_if_fail (object != NULL, NULL);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d", GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p ref %d->%d", object,
object,
((GObject *) object)->ref_count, ((GObject *) object)->ref_count + 1); ((GObject *) object)->ref_count, ((GObject *) object)->ref_count + 1);
#endif #endif
g_object_ref (object); g_object_ref (object);
@ -318,8 +317,7 @@ gst_object_unref (gpointer object)
g_return_if_fail (((GObject *) object)->ref_count > 0); g_return_if_fail (((GObject *) object)->ref_count > 0);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d", GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d", object,
object,
((GObject *) object)->ref_count, ((GObject *) object)->ref_count - 1); ((GObject *) object)->ref_count, ((GObject *) object)->ref_count - 1);
#endif #endif
g_object_unref (object); g_object_unref (object);
@ -349,7 +347,8 @@ gst_object_ref_sink (gpointer object)
GST_OBJECT_LOCK (object); GST_OBJECT_LOCK (object);
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) { if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unsetting floating flag"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object,
"unsetting floating flag");
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING); GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
GST_OBJECT_UNLOCK (object); GST_OBJECT_UNLOCK (object);
} else { } else {
@ -380,11 +379,11 @@ gst_object_sink (gpointer object)
{ {
g_return_if_fail (GST_IS_OBJECT (object)); g_return_if_fail (GST_IS_OBJECT (object));
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "sink"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "sink");
GST_OBJECT_LOCK (object); GST_OBJECT_LOCK (object);
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) { if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "clear floating flag"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "clear floating flag");
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING); GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
GST_OBJECT_UNLOCK (object); GST_OBJECT_UNLOCK (object);
gst_object_unref (object); gst_object_unref (object);
@ -415,7 +414,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj)); g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj));
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
GST_CAT_LOG (GST_CAT_REFCOUNTING, "replace %p %s (%d) with %p %s (%d)", GST_CAT_TRACE (GST_CAT_REFCOUNTING, "replace %p %s (%d) with %p %s (%d)",
*oldobj, *oldobj ? GST_STR_NULL (GST_OBJECT_NAME (*oldobj)) : "(NONE)", *oldobj, *oldobj ? GST_STR_NULL (GST_OBJECT_NAME (*oldobj)) : "(NONE)",
*oldobj ? G_OBJECT (*oldobj)->ref_count : 0, *oldobj ? G_OBJECT (*oldobj)->ref_count : 0,
newobj, newobj ? GST_STR_NULL (GST_OBJECT_NAME (newobj)) : "(NONE)", newobj, newobj ? GST_STR_NULL (GST_OBJECT_NAME (newobj)) : "(NONE)",
@ -439,7 +438,7 @@ gst_object_dispose (GObject * object)
{ {
GstObject *parent; GstObject *parent;
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
GST_OBJECT_LOCK (object); GST_OBJECT_LOCK (object);
if ((parent = GST_OBJECT_PARENT (object))) if ((parent = GST_OBJECT_PARENT (object)))
@ -471,7 +470,7 @@ gst_object_finalize (GObject * object)
{ {
GstObject *gstobject = GST_OBJECT_CAST (object); GstObject *gstobject = GST_OBJECT_CAST (object);
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "finalize"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "finalize");
g_signal_handlers_destroy (object); g_signal_handlers_destroy (object);
@ -801,7 +800,8 @@ gst_object_set_parent (GstObject * object, GstObject * parent)
* in the floating case. */ * in the floating case. */
object->parent = parent; object->parent = parent;
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) { if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unsetting floating flag"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object,
"unsetting floating flag");
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING); GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
GST_OBJECT_UNLOCK (object); GST_OBJECT_UNLOCK (object);
} else { } else {
@ -871,7 +871,7 @@ gst_object_unparent (GstObject * object)
parent = object->parent; parent = object->parent;
if (G_LIKELY (parent != NULL)) { if (G_LIKELY (parent != NULL)) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unparent"); GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "unparent");
object->parent = NULL; object->parent = NULL;
GST_OBJECT_UNLOCK (object); GST_OBJECT_UNLOCK (object);