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>
34 #ifndef LIBGSTREAMER_EXPORTS
35 #define IMPORT_SYMBOL __declspec(dllimport)
42 #define M_PI 3.14159265358979323846
49 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
51 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured
52 * that stops the application from keeping working correctly.
53 * An examples is gst_element_error, which outputs a message with this priority.
54 * It does not mean that the application is terminating as with g_errror.
55 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
56 * that could lead to problems or weird behaviour later on. An example of this
57 * would be clocking issues ("your computer is pretty slow") or broken input
58 * data ("Can't synchronize to stream.")
59 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
60 * updated about what is happening.
61 * Examples where this should be used are when a typefind function has
62 * successfully determined the type of the stream or when an mp3 plugin detects
63 * the format to be used. ("This file has mono sound.")
64 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
65 * happens that is not the expected default behavior.
66 * An example would be notifications about state changes or receiving/sending of
68 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
69 * useful to know. As a rule of thumb a pipeline that is iterating as expected
70 * should never output anzthing else but LOG messages.
71 * Examples for this are referencing/dereferencing of objects or cothread switches.
72 * @GST_LEVEL_COUNT: The number of defined debugging levels.
74 * The level defines the importance of a debugging message. The more important a
75 * message is, the greater the probability that the debugging system outputs it.
91 * Defines the default debugging level to be used with GStreamer. It is normally
92 * set to #GST_LEVEL_NONE so nothing get printed.
93 * As it can be configured at compile time, developer builds may chose to
94 * override that though.
95 * You can use this as an argument to gst_debug_set_default_threshold() to
96 * reset the debugging output to default behaviour.
98 #ifndef GST_LEVEL_DEFAULT
99 #define GST_LEVEL_DEFAULT GST_LEVEL_NONE
102 /* defines for format (colors etc)
103 * don't change them around, it uses terminal layout
104 * Terminal color strings:
105 * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
107 * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
108 * Background color codes:
109 * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
112 * GstDebugColorFlags:
113 * @GST_DEBUG_FG_BLACK: Use black as foreground color.
114 * @GST_DEBUG_FG_RED: Use red as foreground color.
115 * @GST_DEBUG_FG_GREEN: Use green as foreground color.
116 * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
117 * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
118 * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
119 * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
120 * @GST_DEBUG_FG_WHITE: Use white as foreground color.
121 * @GST_DEBUG_BG_BLACK: Use black as background color.
122 * @GST_DEBUG_BG_RED: Use red as background color.
123 * @GST_DEBUG_BG_GREEN: Use green as background color.
124 * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
125 * @GST_DEBUG_BG_BLUE: Use blue as background color.
126 * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
127 * @GST_DEBUG_BG_CYAN: Use cyan as background color.
128 * @GST_DEBUG_BG_WHITE: Use white as background color.
129 * @GST_DEBUG_BOLD: Make the output bold.
130 * @GST_DEBUG_UNDERLINE: Underline the output.
132 * These are some terminal style flags you can use when creating your
133 * debugging categories to make them stand out in debugging output.
137 GST_DEBUG_FG_BLACK = 0x0000,
138 GST_DEBUG_FG_RED = 0x0001,
139 GST_DEBUG_FG_GREEN = 0x0002,
140 GST_DEBUG_FG_YELLOW = 0x0003,
141 GST_DEBUG_FG_BLUE = 0x0004,
142 GST_DEBUG_FG_MAGENTA = 0x0005,
143 GST_DEBUG_FG_CYAN = 0x0006,
144 GST_DEBUG_FG_WHITE = 0x0007,
145 /* background colors */
146 GST_DEBUG_BG_BLACK = 0x0000,
147 GST_DEBUG_BG_RED = 0x0010,
148 GST_DEBUG_BG_GREEN = 0x0020,
149 GST_DEBUG_BG_YELLOW = 0x0030,
150 GST_DEBUG_BG_BLUE = 0x0040,
151 GST_DEBUG_BG_MAGENTA = 0x0050,
152 GST_DEBUG_BG_CYAN = 0x0060,
153 GST_DEBUG_BG_WHITE = 0x0070,
155 GST_DEBUG_BOLD = 0x0100,
156 GST_DEBUG_UNDERLINE = 0x0200
157 } GstDebugColorFlags;
159 #define GST_DEBUG_FG_MASK (0x000F)
160 #define GST_DEBUG_BG_MASK (0x00F0)
161 #define GST_DEBUG_FORMAT_MASK (0xFF00)
163 typedef struct _GstDebugCategory GstDebugCategory;
167 * This is the struct that describes the categories. Once initialized with
168 * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
170 struct _GstDebugCategory {
173 guint color; /* see defines above */
176 const gchar * description;
179 /********** some convenience macros for debugging **********/
183 * @str: The string to check.
185 * Macro to use when a string must not be NULL, but may be NULL. If the string
186 * is NULL, "(NULL)" is printed instead.
187 * In GStreamer printf string arguments may not be NULL, because on some
188 * platforms (ie Solaris) the libc crashes in that case. This includes debugging
191 #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
193 /* FIXME, not MT safe */
195 * GST_DEBUG_PAD_NAME:
196 * @pad: The pad to debug.
198 * Evaluates to 2 strings, that describe the pad. Often used in debugging
201 #define GST_DEBUG_PAD_NAME(pad) \
203 ((GST_OBJECT_PARENT(pad) != NULL) ? \
204 GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
206 (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
211 * This macro should evaluate to the name of the current function and be should
212 * be defined when configuring your project, as it is compiler dependant. If it
213 * is not defined, some default value is used. It is used to provide debugging
214 * output with the function name of the message.
217 #if defined (__GNUC__)
218 # define GST_FUNCTION ((const char*) (__FUNCTION__))
219 #elif defined (G_HAVE_ISO_VARARGS)
220 # define GST_FUNCTION ((const char*) (__func__))
222 # define GST_FUNCTION ((const char*) ("???"))
224 #endif /* ifndef GST_FUNCTION */
227 typedef struct _GstDebugMessage GstDebugMessage;
231 * @category: a #GstDebugCategory
232 * @level: a #GstDebugLevel
234 * @function: function name
236 * @object: a #GObject
237 * @message: the message
238 * @data: user data for the log function
240 * Function prototype for a logging function that can be registered with
241 * gst_debug_add_log_function().
242 * Use G_GNUC_NO_INSTRUMENT on that function.
244 typedef void (*GstLogFunction) (GstDebugCategory * category,
247 const gchar * function,
250 GstDebugMessage * message,
253 #ifndef GST_DISABLE_GST_DEBUG
255 void _gst_debug_init (void);
258 #ifdef GST_USING_PRINTF_EXTENSION
260 /* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
261 void gst_debug_log (GstDebugCategory * category,
264 const gchar * function,
267 const gchar * format,
268 ...) G_GNUC_NO_INSTRUMENT;
270 #else /* GST_USING_PRINTF_EXTENSION */
272 void gst_debug_log (GstDebugCategory * category,
275 const gchar * function,
278 const gchar * format,
279 ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
281 #endif /* GST_USING_PRINTF_EXTENSION */
283 void gst_debug_log_valist (GstDebugCategory * category,
286 const gchar * function,
289 const gchar * format,
290 va_list args) G_GNUC_NO_INSTRUMENT;
292 const gchar * gst_debug_message_get (GstDebugMessage * message);
294 void gst_debug_log_default (GstDebugCategory * category,
297 const gchar * function,
300 GstDebugMessage * message,
301 gpointer unused) G_GNUC_NO_INSTRUMENT;
303 G_CONST_RETURN gchar *
304 gst_debug_level_get_name (GstDebugLevel level);
306 void gst_debug_add_log_function (GstLogFunction func,
308 guint gst_debug_remove_log_function (GstLogFunction func);
309 guint gst_debug_remove_log_function_by_data (gpointer data);
311 void gst_debug_set_active (gboolean active);
312 gboolean gst_debug_is_active (void);
314 void gst_debug_set_colored (gboolean colored);
315 gboolean gst_debug_is_colored (void);
317 void gst_debug_set_default_threshold (GstDebugLevel level);
318 GstDebugLevel gst_debug_get_default_threshold (void);
319 void gst_debug_set_threshold_for_name (const gchar * name,
320 GstDebugLevel level);
321 void gst_debug_unset_threshold_for_name (const gchar * name);
324 * GST_DEBUG_CATEGORY:
327 * Defines a GstDebugCategory variable.
328 * This macro expands to nothing if debugging is disabled.
330 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
332 * GST_DEBUG_CATEGORY_EXTERN:
335 * Declares a GstDebugCategory variable as extern. Use in header files.
336 * This macro expands to nothing if debugging is disabled.
339 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
341 #define GST_DEBUG_CATEGORY_EXTERN(cat) \
342 extern __declspec (dllimport) GstDebugCategory *cat;
346 * GST_DEBUG_CATEGORY_STATIC:
349 * Defines a static GstDebugCategory variable.
350 * This macro expands to nothing if debugging is disabled.
352 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
353 /* do not use this function, use the macros below */
354 GstDebugCategory *_gst_debug_category_new (const gchar * name,
356 const gchar * description);
358 * GST_DEBUG_CATEGORY_INIT:
359 * @cat: the category to initialize.
360 * @name: the name of the category.
361 * @color: the colors to use for a color representation or 0 for no color.
362 * @description: optional description of the category.
364 * Initializes a new #GstDebugCategory with the given properties and set to
365 * the default threshold.
369 * This macro expands to nothing if debugging is disabled.
372 * When naming your category, please follow the following conventions to ensure
373 * that the pattern matching for categories works as expected. It is not
374 * earth-shattering if you don't follow these conventions, but it would be nice
378 * If you define a category for a plugin or a feature of it, name the category
379 * like the feature. So if you wanted to write a "filesrc" element, you would
380 * name the category "filesrc". Use lowercase letters only.
381 * If you define more than one category for the same element, append an
382 * underscore and an identifier to your categories, like this: "filesrc_cache"
385 * If you create a library or an application using debugging categories, use a
386 * common prefix followed by an underscore for all your categories. GStreamer
387 * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
388 * to include uppercase letters.
392 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
394 cat = _gst_debug_category_new (name,color,description); \
397 void gst_debug_category_free (GstDebugCategory * category);
398 void gst_debug_category_set_threshold (GstDebugCategory * category,
399 GstDebugLevel level);
400 void gst_debug_category_reset_threshold(GstDebugCategory * category);
402 gst_debug_category_get_threshold (GstDebugCategory * category);
403 G_CONST_RETURN gchar *
404 gst_debug_category_get_name (GstDebugCategory * category);
405 guint gst_debug_category_get_color (GstDebugCategory * category);
406 G_CONST_RETURN gchar *
407 gst_debug_category_get_description (GstDebugCategory * category);
409 gst_debug_get_all_categories (void);
411 gchar * gst_debug_construct_term_color (guint colorinfo);
417 * Default gstreamer core debug log category. Please define your own.
419 GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
420 /* this symbol may not be used */
421 extern gboolean __gst_debug_enabled;
423 /* since 0.10.7, the min debug level, used for quickly discarding debug
424 * messages that fall under the threshold. */
425 extern IMPORT_SYMBOL GstDebugLevel __gst_debug_min;
429 * @cat: category to use
430 * @level: the severity of the message
431 * @object: the #GObject the message belongs to or NULL if none
432 * @...: A printf-style message to output
434 * Outputs a debugging message. This is the most general macro for outputting
435 * debugging messages. You will probably want to use one of the ones described
438 #ifdef G_HAVE_ISO_VARARGS
439 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
440 if (G_UNLIKELY (level <= __gst_debug_min)) { \
441 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
442 (GObject *) (object), __VA_ARGS__); \
445 #else /* G_HAVE_GNUC_VARARGS */
446 #ifdef G_HAVE_GNUC_VARARGS
447 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
448 if (G_UNLIKELY (level <= __gst_debug_min)) { \
449 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
450 (GObject *) (object), ##args ); \
453 #else /* no variadic macros, use inline */
455 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
456 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
458 if (G_UNLIKELY (level <= __gst_debug_min)) {
459 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
465 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
466 gpointer object, const char *format, ...)
470 va_start (varargs, format);
471 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
475 #endif /* G_HAVE_ISO_VARARGS */
478 * GST_CAT_ERROR_OBJECT:
479 * @cat: category to use
480 * @obj: the #GObject the message belongs to
481 * @...: printf-style message to output
483 * Output an error message belonging to the given object in the given category.
486 * GST_CAT_WARNING_OBJECT:
487 * @cat: category to use
488 * @obj: the #GObject the message belongs to
489 * @...: printf-style message to output
491 * Output a warning message belonging to the given object in the given category.
494 * GST_CAT_INFO_OBJECT:
495 * @cat: category to use
496 * @obj: the #GObject the message belongs to
497 * @...: printf-style message to output
499 * Output an informational message belonging to the given object in the given
503 * GST_CAT_DEBUG_OBJECT:
504 * @cat: category to use
505 * @obj: the #GObject the message belongs to
506 * @...: printf-style message to output
508 * Output an debugging message belonging to the given object in the given category.
511 * GST_CAT_LOG_OBJECT:
512 * @cat: category to use
513 * @obj: the #GObject the message belongs to
514 * @...: printf-style message to output
516 * Output an logging message belonging to the given object in the given category.
522 * @cat: category to use
523 * @...: printf-style message to output
525 * Output an error message in the given category.
529 * @cat: category to use
530 * @...: printf-style message to output
532 * Output an warning message in the given category.
536 * @cat: category to use
537 * @...: printf-style message to output
539 * Output an informational message in the given category.
543 * @cat: category to use
544 * @...: printf-style message to output
546 * Output an debugging message in the given category.
550 * @cat: category to use
551 * @...: printf-style message to output
553 * Output an logging message in the given category.
559 * @obj: the #GObject the message belongs to
560 * @...: printf-style message to output
562 * Output an error message belonging to the given object in the default category.
565 * GST_WARNING_OBJECT:
566 * @obj: the #GObject the message belongs to
567 * @...: printf-style message to output
569 * Output a warning message belonging to the given object in the default category.
573 * @obj: the #GObject the message belongs to
574 * @...: printf-style message to output
576 * Output an informational message belonging to the given object in the default
581 * @obj: the #GObject the message belongs to
582 * @...: printf-style message to output
584 * Output a debugging message belonging to the given object in the default
589 * @obj: the #GObject the message belongs to
590 * @...: printf-style message to output
592 * Output a logging message belonging to the given object in the default category.
598 * @...: printf-style message to output
600 * Output an error message in the default category.
604 * @...: printf-style message to output
606 * Output a warning message in the default category.
610 * @...: printf-style message to output
612 * Output an informational message in the default category.
616 * @...: printf-style message to output
618 * Output a debugging message in the default category.
622 * @...: printf-style message to output
624 * Output a logging message in the default category.
627 #ifdef G_HAVE_ISO_VARARGS
629 #define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
630 #define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
631 #define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
632 #define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
633 #define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
635 #define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
636 #define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
637 #define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
638 #define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
639 #define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
641 #define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
642 #define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
643 #define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
644 #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
645 #define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
647 #define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
648 #define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
649 #define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
650 #define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
651 #define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
654 #ifdef G_HAVE_GNUC_VARARGS
656 #define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
657 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
658 #define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
659 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
660 #define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
662 #define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
663 #define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
664 #define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
665 #define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
666 #define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
668 #define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
669 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
670 #define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
671 #define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
672 #define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
674 #define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
675 #define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
676 #define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
677 #define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
678 #define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
681 /* no variadic macros, use inline */
683 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
688 va_start (varargs, format);
689 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
694 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
695 const char *format, ...)
699 va_start (varargs, format);
700 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
705 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
710 va_start (varargs, format);
711 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
716 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
721 va_start (varargs, format);
722 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
727 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
732 va_start (varargs, format);
733 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
738 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
742 va_start (varargs, format);
743 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
748 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
752 va_start (varargs, format);
753 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
758 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
762 va_start (varargs, format);
763 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
768 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
772 va_start (varargs, format);
773 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
778 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
782 va_start (varargs, format);
783 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
788 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
792 va_start (varargs, format);
793 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
799 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
803 va_start (varargs, format);
804 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
810 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
814 va_start (varargs, format);
815 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
821 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
825 va_start (varargs, format);
826 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
832 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
836 va_start (varargs, format);
837 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
843 GST_ERROR (const char *format, ...)
847 va_start (varargs, format);
848 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
854 GST_WARNING (const char *format, ...)
858 va_start (varargs, format);
859 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
865 GST_INFO (const char *format, ...)
869 va_start (varargs, format);
870 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
876 GST_DEBUG (const char *format, ...)
880 va_start (varargs, format);
881 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
887 GST_LOG (const char *format, ...)
891 va_start (varargs, format);
892 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
900 /********** function pointer stuff **********/
902 typedef void (* GstDebugFuncPtr) (void);
903 void _gst_debug_register_funcptr (GstDebugFuncPtr func,
904 const gchar * ptrname);
905 G_CONST_RETURN gchar *
906 _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
910 * @ptr: pointer to the function to register
912 * Register a pointer to a function with its name, so it can later be used by
913 * GST_DEBUG_FUNCPTR_NAME().
915 #define GST_DEBUG_FUNCPTR(ptr) \
916 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
919 * GST_DEBUG_FUNCPTR_NAME:
920 * @ptr: address of the function of which to look up the name
922 * Retrieves the name of the function, if it was previously registered with
923 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
925 * This macro returns a constant string which must not be modified or
926 * freed by the caller.
928 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
929 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
931 #else /* GST_DISABLE_GST_DEBUG */
933 #if defined(__GNUC__) && __GNUC__ >= 3
934 # pragma GCC poison gst_debug_log
935 # pragma GCC poison gst_debug_log_valist
936 # pragma GCC poison _gst_debug_category_new
939 #define _gst_debug_init() /* NOP */
941 #define gst_debug_set_default_threshold(level) /* NOP */
942 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
944 #define gst_debug_level_get_name(level) ("NONE")
945 #define gst_debug_message_get(message) ("NONE")
946 #define gst_debug_add_log_function(func,data) /* NOP */
947 guint gst_debug_remove_log_function (GstLogFunction func);
948 guint gst_debug_remove_log_function_by_data (gpointer data);
949 #define gst_debug_set_active(active) /* NOP */
950 #define gst_debug_is_active() (FALSE)
951 #define gst_debug_set_colored(colored) /* NOP */
952 #define gst_debug_is_colored() (FALSE)
953 #define gst_debug_set_default_threshold(level) /* NOP */
954 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
955 #define gst_debug_set_threshold_for_name(name,level) /* NOP */
956 #define gst_debug_unset_threshold_for_name(name) /* NOP */
958 #define GST_DEBUG_CATEGORY(var) /* NOP */
959 #define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */
960 #if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
961 #define GST_DEBUG_CATEGORY_STATIC(var) static GstDebugCategory *var = NULL
963 #define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
965 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
966 #define gst_debug_category_free(category) /* NOP */
967 #define gst_debug_category_set_threshold(category,level) /* NOP */
968 #define gst_debug_category_reset_threshold(category) /* NOP */
969 #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
970 #define gst_debug_category_get_name(cat) ("")
971 #define gst_debug_category_get_color(cat) (0)
972 #define gst_debug_category_get_description(cat) ("")
973 #define gst_debug_get_all_categories() (NULL)
974 #define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
976 #ifdef G_HAVE_ISO_VARARGS
978 #define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */
980 #define GST_CAT_ERROR_OBJECT(...) /* NOP */
981 #define GST_CAT_WARNING_OBJECT(...) /* NOP */
982 #define GST_CAT_INFO_OBJECT(...) /* NOP */
983 #define GST_CAT_DEBUG_OBJECT(...) /* NOP */
984 #define GST_CAT_LOG_OBJECT(...) /* NOP */
986 #define GST_CAT_ERROR(...) /* NOP */
987 #define GST_CAT_WARNING(...) /* NOP */
988 #define GST_CAT_INFO(...) /* NOP */
989 #define GST_CAT_DEBUG(...) /* NOP */
990 #define GST_CAT_LOG(...) /* NOP */
992 #define GST_ERROR_OBJECT(...) /* NOP */
993 #define GST_WARNING_OBJECT(...) /* NOP */
994 #define GST_INFO_OBJECT(...) /* NOP */
995 #define GST_DEBUG_OBJECT(...) /* NOP */
996 #define GST_LOG_OBJECT(...) /* NOP */
998 #define GST_ERROR(...) /* NOP */
999 #define GST_WARNING(...) /* NOP */
1000 #define GST_INFO(...) /* NOP */
1001 #define GST_DEBUG(...) /* NOP */
1002 #define GST_LOG(...) /* NOP */
1005 #ifdef G_HAVE_GNUC_VARARGS
1007 #define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */
1009 #define GST_CAT_ERROR_OBJECT(args...) /* NOP */
1010 #define GST_CAT_WARNING_OBJECT(args...) /* NOP */
1011 #define GST_CAT_INFO_OBJECT(args...) /* NOP */
1012 #define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
1013 #define GST_CAT_LOG_OBJECT(args...) /* NOP */
1015 #define GST_CAT_ERROR(args...) /* NOP */
1016 #define GST_CAT_WARNING(args...) /* NOP */
1017 #define GST_CAT_INFO(args...) /* NOP */
1018 #define GST_CAT_DEBUG(args...) /* NOP */
1019 #define GST_CAT_LOG(args...) /* NOP */
1021 #define GST_ERROR_OBJECT(args...) /* NOP */
1022 #define GST_WARNING_OBJECT(args...) /* NOP */
1023 #define GST_INFO_OBJECT(args...) /* NOP */
1024 #define GST_DEBUG_OBJECT(args...) /* NOP */
1025 #define GST_LOG_OBJECT(args...) /* NOP */
1027 #define GST_ERROR(args...) /* NOP */
1028 #define GST_WARNING(args...) /* NOP */
1029 #define GST_INFO(args...) /* NOP */
1030 #define GST_DEBUG(args...) /* NOP */
1031 #define GST_LOG(args...) /* NOP */
1035 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1036 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1041 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1047 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1048 const char *format, ...)
1053 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1059 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1065 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1071 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1076 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1081 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1086 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1091 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1096 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1101 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1106 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1111 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1116 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1121 GST_ERROR (const char *format, ...)
1126 GST_WARNING (const char *format, ...)
1131 GST_INFO (const char *format, ...)
1136 GST_DEBUG (const char *format, ...)
1141 GST_LOG (const char *format, ...)
1147 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1148 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1150 #endif /* GST_DISABLE_GST_DEBUG */
1152 void gst_debug_print_stack_trace (void);
1156 #endif /* __GSTINFO_H__ */