2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
6 * gstinfo.h: debugging functions
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
28 #include <glib-object.h>
29 #include <gst/gstconfig.h>
35 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
37 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured
38 * that stops the application from keeping working correctly.
39 * An examples is gst_element_error, which outputs a message with this priority.
40 * It does not mean that the application is terminating as with g_errror.
41 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
42 * that could lead to problems or weird behaviour later on. An example of this
43 * would be clocking issues ("your computer is pretty slow") or broken input
44 * data ("Can't synchronize to stream.")
45 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
46 * updated about what is happening.
47 * Examples where this should be used are when a typefind function has
48 * successfully determined the type of the stream or when an mp3 plugin detects
49 * the format to be used. ("This file has mono sound.")
50 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
51 * happens that is not the expected default behavior.
52 * An example would be notifications about state changes or receiving/sending of
54 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
55 * useful to know. As a rule of thumb a pipeline that is iterating as expected
56 * should never output anzthing else but LOG messages.
57 * Examples for this are referencing/dereferencing of objects or cothread switches.
58 * @GST_LEVEL_COUNT: The number of defined debugging levels.
60 * The level defines the importance of a debugging message. The more important a
61 * message is, the greater the probability that the debugging system outputs it.
77 * Defines the default debugging level to be used with GStreamer. It is normally
78 * set to #GST_LEVEL_NONE so nothing get printed.
79 * As it can be configured at compile time, developer builds may chose to
80 * override that though.
81 * You can use this as an argument to gst_debug_set_default_threshold() to
82 * reset the debugging output to default behaviour.
84 #ifndef GST_LEVEL_DEFAULT
85 #define GST_LEVEL_DEFAULT GST_LEVEL_NONE
88 /* defines for format (colors etc)
89 * don't change them around, it uses terminal layout
90 * Terminal color strings:
91 * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
93 * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
94 * Background color codes:
95 * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
99 * @GST_DEBUG_FG_BLACK: Use black as foreground color.
100 * @GST_DEBUG_FG_RED: Use red as foreground color.
101 * @GST_DEBUG_FG_GREEN: Use green as foreground color.
102 * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
103 * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
104 * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
105 * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
106 * @GST_DEBUG_FG_WHITE: Use white as foreground color.
107 * @GST_DEBUG_BG_BLACK: Use black as background color.
108 * @GST_DEBUG_BG_RED: Use red as background color.
109 * @GST_DEBUG_BG_GREEN: Use green as background color.
110 * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
111 * @GST_DEBUG_BG_BLUE: Use blue as background color.
112 * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
113 * @GST_DEBUG_BG_CYAN: Use cyan as background color.
114 * @GST_DEBUG_BG_WHITE: Use white as background color.
115 * @GST_DEBUG_BOLD: Make the output bold.
116 * @GST_DEBUG_UNDERLINE: Underline the output.
118 * These are some terminal style flags you can use when creating your
119 * debugging categories to make them stand out in debugging output.
123 GST_DEBUG_FG_BLACK = 0x0000,
124 GST_DEBUG_FG_RED = 0x0001,
125 GST_DEBUG_FG_GREEN = 0x0002,
126 GST_DEBUG_FG_YELLOW = 0x0003,
127 GST_DEBUG_FG_BLUE = 0x0004,
128 GST_DEBUG_FG_MAGENTA = 0x0005,
129 GST_DEBUG_FG_CYAN = 0x0006,
130 GST_DEBUG_FG_WHITE = 0x0007,
131 /* background colors */
132 GST_DEBUG_BG_BLACK = 0x0000,
133 GST_DEBUG_BG_RED = 0x0010,
134 GST_DEBUG_BG_GREEN = 0x0020,
135 GST_DEBUG_BG_YELLOW = 0x0030,
136 GST_DEBUG_BG_BLUE = 0x0040,
137 GST_DEBUG_BG_MAGENTA = 0x0050,
138 GST_DEBUG_BG_CYAN = 0x0060,
139 GST_DEBUG_BG_WHITE = 0x0070,
141 GST_DEBUG_BOLD = 0x0100,
142 GST_DEBUG_UNDERLINE = 0x0200
143 } GstDebugColorFlags;
145 #define GST_DEBUG_FG_MASK (0x000F)
146 #define GST_DEBUG_BG_MASK (0x00F0)
147 #define GST_DEBUG_FORMAT_MASK (0xFF00)
149 typedef struct _GstDebugCategory GstDebugCategory;
153 * This is the struct that describes the categories. Once initialized with
154 * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
156 struct _GstDebugCategory {
159 guint color; /* see defines above */
162 const gchar * description;
165 /********** some convenience macros for debugging **********/
169 * @str: The string to check.
171 * Macro to use when a string must not be NULL, but may be NULL. If the string
172 * is NULL, "(NULL)" is printed instead.
173 * In GStreamer printf string arguments may not be NULL, because on some
174 * platforms (ie Solaris) the libc crashes in that case. This includes debugging
177 #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
179 /* FIXME, not MT safe */
181 * GST_DEBUG_PAD_NAME:
182 * @pad: The pad to debug.
184 * Evaluates to 2 strings, that describe the pad. Often used in debugging
187 #define GST_DEBUG_PAD_NAME(pad) \
189 ((GST_OBJECT_PARENT(pad) != NULL) ? \
190 GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
192 (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
197 * This macro should evaluate to the name of the current function and be should
198 * be defined when configuring your project, as it is compiler dependant. If it
199 * is not defined, some default value is used. It is used to provide debugging
200 * output with the function name of the message.
203 #if defined (__GNUC__)
204 # define GST_FUNCTION ((const char*) (__PRETTY_FUNCTION__))
205 #elif defined (G_HAVE_ISO_VARARGS)
206 # define GST_FUNCTION ((const char*) (__func__))
208 # define GST_FUNCTION ((const char*) ("???"))
210 #endif /* ifndef GST_FUNCTION */
213 typedef struct _GstDebugMessage GstDebugMessage;
217 * @category: a #GstDebugCategory
218 * @level: a #GstDebugLevel
220 * @function: function name
222 * @object: a #GObject
223 * @message: the message
224 * @data: user data for the log function
226 * Function prototype for a logging function that can be registered with
227 * gst_debug_add_log_function().
228 * Use G_GNUC_NO_INSTRUMENT on that function.
230 typedef void (*GstLogFunction) (GstDebugCategory * category,
233 const gchar * function,
236 GstDebugMessage * message,
239 #ifndef GST_DISABLE_GST_DEBUG
241 void _gst_debug_init (void);
243 /* note we can't use G_GNUC_PRINTF (7, 8) because gcc chokes on %P, which
244 * we use for GST_PTR_FORMAT. */
245 void gst_debug_log (GstDebugCategory * category,
248 const gchar * function,
251 const gchar * format,
252 ...) G_GNUC_NO_INSTRUMENT;
253 void gst_debug_log_valist (GstDebugCategory * category,
256 const gchar * function,
259 const gchar * format,
260 va_list args) G_GNUC_NO_INSTRUMENT;
262 const gchar * gst_debug_message_get (GstDebugMessage * message);
264 void gst_debug_log_default (GstDebugCategory * category,
267 const gchar * function,
270 GstDebugMessage * message,
271 gpointer unused) G_GNUC_NO_INSTRUMENT;
273 G_CONST_RETURN gchar *
274 gst_debug_level_get_name (GstDebugLevel level);
276 void gst_debug_add_log_function (GstLogFunction func,
278 guint gst_debug_remove_log_function (GstLogFunction func);
279 guint gst_debug_remove_log_function_by_data (gpointer data);
281 void gst_debug_set_active (gboolean active);
282 gboolean gst_debug_is_active (void);
284 void gst_debug_set_colored (gboolean colored);
285 gboolean gst_debug_is_colored (void);
287 void gst_debug_set_default_threshold (GstDebugLevel level);
288 GstDebugLevel gst_debug_get_default_threshold (void);
289 void gst_debug_set_threshold_for_name (const gchar * name,
290 GstDebugLevel level);
291 void gst_debug_unset_threshold_for_name (const gchar * name);
294 * GST_DEBUG_CATEGORY:
297 * Defines a GstDebugCategory variable.
298 * This macro expands to nothing if debugging is disabled.
300 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
302 * GST_DEBUG_CATEGORY_EXTERN:
305 * Declares a GstDebugCategory variable as extern. Use in header files.
306 * This macro expands to nothing if debugging is disabled.
309 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
311 #define GST_DEBUG_CATEGORY_EXTERN(cat) \
312 extern _declspec (dllimport) GstDebugCategory *cat;
316 * GST_DEBUG_CATEGORY_STATIC:
319 * Defines a static GstDebugCategory variable.
320 * This macro expands to nothing if debugging is disabled.
322 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
323 /* do not use this function, use the macros below */
324 GstDebugCategory *_gst_debug_category_new (gchar * name,
326 gchar * description);
328 * GST_DEBUG_CATEGORY_INIT:
329 * @cat: the category to initialize.
330 * @name: the name of the category.
331 * @color: the colors to use for a color representation or 0 for no color.
332 * @description: optional description of the category.
334 * Initializes a new #GstDebugCategory with the given properties and set to
335 * the default threshold.
339 * This macro expands to nothing if debugging is disabled.
342 * When naming your category, please follow the following conventions to ensure
343 * that the pattern matching for categories works as expected. It is not
344 * earth-shattering if you don't follow these conventions, but it would be nice
348 * If you define a category for a plugin or a feature of it, name the category
349 * like the feature. So if you wanted to write a "filesrc" element, you would
350 * name the category "filesrc". Use lowercase letters only.
351 * If you define more than one category for the same element, append an
352 * underscore and an identifier to your categories, like this: "filesrc_cache"
355 * If you create a library or an application using debugging categories, use a
356 * common prefix followed by an underscore for all your categories. GStreamer
357 * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
358 * to include uppercase letters.
362 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
364 cat = _gst_debug_category_new (name,color,description); \
367 void gst_debug_category_free (GstDebugCategory * category);
368 void gst_debug_category_set_threshold (GstDebugCategory * category,
369 GstDebugLevel level);
370 void gst_debug_category_reset_threshold(GstDebugCategory * category);
372 gst_debug_category_get_threshold (GstDebugCategory * category);
373 G_CONST_RETURN gchar *
374 gst_debug_category_get_name (GstDebugCategory * category);
375 guint gst_debug_category_get_color (GstDebugCategory * category);
376 G_CONST_RETURN gchar *
377 gst_debug_category_get_description (GstDebugCategory * category);
379 gst_debug_get_all_categories (void);
381 gchar * gst_debug_construct_term_color (guint colorinfo);
387 * Default gstreamer core debug log category. Please define your own.
389 GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
390 /* this symbol may not be used */
391 extern gboolean __gst_debug_enabled;
393 /* since 0.10.7, the min debug level, used for quickly discarding debug
394 * messages that fall under the threshold. */
395 extern GstDebugLevel __gst_debug_min;
399 * @cat: category to use
400 * @level: the severity of the message
401 * @object: the #GObject the message belongs to or NULL if none
402 * @...: A printf-style message to output
404 * Outputs a debugging message. This is the most general macro for outputting
405 * debugging messages. You will probably want to use one of the ones described
408 #ifdef G_HAVE_ISO_VARARGS
409 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
410 if (G_UNLIKELY (level <= __gst_debug_min)) { \
411 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
412 (GObject *) (object), __VA_ARGS__); \
415 #else /* G_HAVE_GNUC_VARARGS */
416 #ifdef G_HAVE_GNUC_VARARGS
417 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
418 if (G_UNLIKELY (level <= __gst_debug_min)) { \
419 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
420 (GObject *) (object), ##args ); \
423 #else /* no variadic macros, use inline */
425 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
426 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
428 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
433 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
434 gpointer object, const char *format, ...)
436 if (G_UNLIKELY (level <= __gst_debug_min)) { \
439 va_start (varargs, format);
440 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
445 #endif /* G_HAVE_ISO_VARARGS */
448 * GST_CAT_ERROR_OBJECT:
449 * @cat: category to use
450 * @obj: the #GObject the message belongs to
451 * @...: printf-style message to output
453 * Output an error message belonging to the given object in the given category.
456 * GST_CAT_WARNING_OBJECT:
457 * @cat: category to use
458 * @obj: the #GObject the message belongs to
459 * @...: printf-style message to output
461 * Output a warning message belonging to the given object in the given category.
464 * GST_CAT_INFO_OBJECT:
465 * @cat: category to use
466 * @obj: the #GObject the message belongs to
467 * @...: printf-style message to output
469 * Output an informational message belonging to the given object in the given
473 * GST_CAT_DEBUG_OBJECT:
474 * @cat: category to use
475 * @obj: the #GObject the message belongs to
476 * @...: printf-style message to output
478 * Output an debugging message belonging to the given object in the given category.
481 * GST_CAT_LOG_OBJECT:
482 * @cat: category to use
483 * @obj: the #GObject the message belongs to
484 * @...: printf-style message to output
486 * Output an logging message belonging to the given object in the given category.
492 * @cat: category to use
493 * @...: printf-style message to output
495 * Output an error message in the given category.
499 * @cat: category to use
500 * @...: printf-style message to output
502 * Output an warning message in the given category.
506 * @cat: category to use
507 * @...: printf-style message to output
509 * Output an informational message in the given category.
513 * @cat: category to use
514 * @...: printf-style message to output
516 * Output an debugging message in the given category.
520 * @cat: category to use
521 * @...: printf-style message to output
523 * Output an logging message in the given category.
529 * @obj: the #GObject the message belongs to
530 * @...: printf-style message to output
532 * Output an error message belonging to the given object in the default category.
535 * GST_WARNING_OBJECT:
536 * @obj: the #GObject the message belongs to
537 * @...: printf-style message to output
539 * Output a warning message belonging to the given object in the default category.
543 * @obj: the #GObject the message belongs to
544 * @...: printf-style message to output
546 * Output an informational message belonging to the given object in the default
551 * @obj: the #GObject the message belongs to
552 * @...: printf-style message to output
554 * Output a debugging message belonging to the given object in the default
559 * @obj: the #GObject the message belongs to
560 * @...: printf-style message to output
562 * Output a logging message belonging to the given object in the default category.
568 * @...: printf-style message to output
570 * Output an error message in the default category.
574 * @...: printf-style message to output
576 * Output a warning message in the default category.
580 * @...: printf-style message to output
582 * Output an informational message in the default category.
586 * @...: printf-style message to output
588 * Output a debugging message in the default category.
592 * @...: printf-style message to output
594 * Output a logging message in the default category.
597 #ifdef G_HAVE_ISO_VARARGS
599 #define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
600 #define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
601 #define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
602 #define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
603 #define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
605 #define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
606 #define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
607 #define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
608 #define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
609 #define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
611 #define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
612 #define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
613 #define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
614 #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
615 #define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
617 #define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
618 #define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
619 #define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
620 #define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
621 #define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
624 #ifdef G_HAVE_GNUC_VARARGS
626 #define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
627 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
628 #define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
629 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
630 #define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
632 #define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
633 #define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
634 #define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
635 #define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
636 #define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
638 #define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
639 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
640 #define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
641 #define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
642 #define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
644 #define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
645 #define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
646 #define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
647 #define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
648 #define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
651 /* no variadic macros, use inline */
653 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
658 va_start (varargs, format);
659 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
664 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
665 const char *format, ...)
669 va_start (varargs, format);
670 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
675 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
680 va_start (varargs, format);
681 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
686 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
691 va_start (varargs, format);
692 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
697 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
702 va_start (varargs, format);
703 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
708 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
712 va_start (varargs, format);
713 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
718 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
722 va_start (varargs, format);
723 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
728 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
732 va_start (varargs, format);
733 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
738 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
742 va_start (varargs, format);
743 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
748 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
752 va_start (varargs, format);
753 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
758 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
762 va_start (varargs, format);
763 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
769 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
773 va_start (varargs, format);
774 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
780 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
784 va_start (varargs, format);
785 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
791 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
795 va_start (varargs, format);
796 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
802 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
806 va_start (varargs, format);
807 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
813 GST_ERROR (const char *format, ...)
817 va_start (varargs, format);
818 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
824 GST_WARNING (const char *format, ...)
828 va_start (varargs, format);
829 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
835 GST_INFO (const char *format, ...)
839 va_start (varargs, format);
840 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
846 GST_DEBUG (const char *format, ...)
850 va_start (varargs, format);
851 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
857 GST_LOG (const char *format, ...)
861 va_start (varargs, format);
862 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
870 /********** function pointer stuff **********/
872 typedef void (* GstDebugFuncPtr) (void);
873 void _gst_debug_register_funcptr (GstDebugFuncPtr func,
875 G_CONST_RETURN gchar *
876 _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
880 * @ptr: pointer to the function to register
882 * Register a pointer to a function with its name, so it can later be used by
883 * GST_DEBUG_FUNCPTR_NAME().
885 #define GST_DEBUG_FUNCPTR(ptr) \
886 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
889 * GST_DEBUG_FUNCPTR_NAME:
890 * @ptr: address of the function of which to look up the name
892 * Retrieves the name of the function, if it was previously registered with
893 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
895 * This macro returns a constant string which must not be modified or
896 * freed by the caller.
898 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
899 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
901 #else /* GST_DISABLE_GST_DEBUG */
903 #if defined(__GNUC__) && __GNUC__ >= 3
904 # pragma GCC poison gst_debug_log
905 # pragma GCC poison gst_debug_log_valist
906 # pragma GCC poison _gst_debug_category_new
909 #define _gst_debug_init() /* NOP */
911 #define gst_debug_set_default_threshold(level) /* NOP */
912 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
914 #define gst_debug_level_get_name(level) ("NONE")
915 #define gst_debug_add_log_function(func,data) /* NOP */
916 guint gst_debug_remove_log_function (GstLogFunction func);
917 guint gst_debug_remove_log_function_by_data (gpointer data);
918 #define gst_debug_set_active(active) /* NOP */
919 #define gst_debug_is_active() (FALSE)
920 #define gst_debug_set_colored(colored) /* NOP */
921 #define gst_debug_is_colored() (FALSE)
922 #define gst_debug_set_default_threshold(level) /* NOP */
923 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
924 #define gst_debug_set_threshold_for_name(name,level) /* NOP */
925 #define gst_debug_unset_threshold_for_name(name) /* NOP */
927 #define GST_DEBUG_CATEGORY(var) /* NOP */
928 #define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */
929 #if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
930 #define GST_DEBUG_CATEGORY_STATIC(var) static GstDebugCategory *var = NULL
932 #define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
934 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
935 #define gst_debug_category_free(category) /* NOP */
936 #define gst_debug_category_set_threshold(category,level) /* NOP */
937 #define gst_debug_category_reset_threshold(category) /* NOP */
938 #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
939 #define gst_debug_category_get_name(cat) ("")
940 #define gst_debug_category_get_color(cat) (0)
941 #define gst_debug_category_get_description(cat) ("")
942 #define gst_debug_get_all_categories() (NULL)
943 #define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
945 #ifdef G_HAVE_ISO_VARARGS
947 #define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */
949 #define GST_CAT_ERROR_OBJECT(...) /* NOP */
950 #define GST_CAT_WARNING_OBJECT(...) /* NOP */
951 #define GST_CAT_INFO_OBJECT(...) /* NOP */
952 #define GST_CAT_DEBUG_OBJECT(...) /* NOP */
953 #define GST_CAT_LOG_OBJECT(...) /* NOP */
955 #define GST_CAT_ERROR(...) /* NOP */
956 #define GST_CAT_WARNING(...) /* NOP */
957 #define GST_CAT_INFO(...) /* NOP */
958 #define GST_CAT_DEBUG(...) /* NOP */
959 #define GST_CAT_LOG(...) /* NOP */
961 #define GST_ERROR_OBJECT(...) /* NOP */
962 #define GST_WARNING_OBJECT(...) /* NOP */
963 #define GST_INFO_OBJECT(...) /* NOP */
964 #define GST_DEBUG_OBJECT(...) /* NOP */
965 #define GST_LOG_OBJECT(...) /* NOP */
967 #define GST_ERROR(...) /* NOP */
968 #define GST_WARNING(...) /* NOP */
969 #define GST_INFO(...) /* NOP */
970 #define GST_DEBUG(...) /* NOP */
971 #define GST_LOG(...) /* NOP */
974 #ifdef G_HAVE_GNUC_VARARGS
976 #define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */
978 #define GST_CAT_ERROR_OBJECT(args...) /* NOP */
979 #define GST_CAT_WARNING_OBJECT(args...) /* NOP */
980 #define GST_CAT_INFO_OBJECT(args...) /* NOP */
981 #define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
982 #define GST_CAT_LOG_OBJECT(args...) /* NOP */
984 #define GST_CAT_ERROR(args...) /* NOP */
985 #define GST_CAT_WARNING(args...) /* NOP */
986 #define GST_CAT_INFO(args...) /* NOP */
987 #define GST_CAT_DEBUG(args...) /* NOP */
988 #define GST_CAT_LOG(args...) /* NOP */
990 #define GST_ERROR_OBJECT(args...) /* NOP */
991 #define GST_WARNING_OBJECT(args...) /* NOP */
992 #define GST_INFO_OBJECT(args...) /* NOP */
993 #define GST_DEBUG_OBJECT(args...) /* NOP */
994 #define GST_LOG_OBJECT(args...) /* NOP */
996 #define GST_ERROR(args...) /* NOP */
997 #define GST_WARNING(args...) /* NOP */
998 #define GST_INFO(args...) /* NOP */
999 #define GST_DEBUG(args...) /* NOP */
1000 #define GST_LOG(args...) /* NOP */
1004 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1005 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1010 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1016 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1017 const char *format, ...)
1022 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1028 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1034 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1040 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1045 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1050 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1055 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1060 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1065 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1070 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1075 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1080 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1085 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1090 GST_ERROR (const char *format, ...)
1095 GST_WARNING (const char *format, ...)
1100 GST_INFO (const char *format, ...)
1105 GST_DEBUG (const char *format, ...)
1110 GST_LOG (const char *format, ...)
1116 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1117 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1119 #endif /* GST_DISABLE_GST_DEBUG */
1121 void gst_debug_print_stack_trace (void);
1125 #endif /* __GSTINFO_H__ */