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 #ifndef LIBGSTREAMER_EXPORTS
36 #define IMPORT_SYMBOL __declspec(dllimport)
43 #define M_PI 3.14159265358979323846
50 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
52 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured
53 * that stops the application from keeping working correctly.
54 * An examples is gst_element_error, which outputs a message with this priority.
55 * It does not mean that the application is terminating as with g_errror.
56 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
57 * that could lead to problems or weird behaviour later on. An example of this
58 * would be clocking issues ("your computer is pretty slow") or broken input
59 * data ("Can't synchronize to stream.")
60 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
61 * updated about what is happening.
62 * Examples where this should be used are when a typefind function has
63 * successfully determined the type of the stream or when an mp3 plugin detects
64 * the format to be used. ("This file has mono sound.")
65 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
66 * happens that is not the expected default behavior.
67 * An example would be notifications about state changes or receiving/sending of
69 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
70 * useful to know. As a rule of thumb a pipeline that is iterating as expected
71 * should never output anzthing else but LOG messages.
72 * Examples for this are referencing/dereferencing of objects or cothread switches.
73 * @GST_LEVEL_COUNT: The number of defined debugging levels.
75 * The level defines the importance of a debugging message. The more important a
76 * message is, the greater the probability that the debugging system outputs it.
92 * Defines the default debugging level to be used with GStreamer. It is normally
93 * set to #GST_LEVEL_NONE so nothing get printed.
94 * As it can be configured at compile time, developer builds may chose to
95 * override that though.
96 * You can use this as an argument to gst_debug_set_default_threshold() to
97 * reset the debugging output to default behaviour.
99 #ifndef GST_LEVEL_DEFAULT
100 #define GST_LEVEL_DEFAULT GST_LEVEL_NONE
103 /* defines for format (colors etc)
104 * don't change them around, it uses terminal layout
105 * Terminal color strings:
106 * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
108 * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
109 * Background color codes:
110 * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
113 * GstDebugColorFlags:
114 * @GST_DEBUG_FG_BLACK: Use black as foreground color.
115 * @GST_DEBUG_FG_RED: Use red as foreground color.
116 * @GST_DEBUG_FG_GREEN: Use green as foreground color.
117 * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
118 * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
119 * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
120 * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
121 * @GST_DEBUG_FG_WHITE: Use white as foreground color.
122 * @GST_DEBUG_BG_BLACK: Use black as background color.
123 * @GST_DEBUG_BG_RED: Use red as background color.
124 * @GST_DEBUG_BG_GREEN: Use green as background color.
125 * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
126 * @GST_DEBUG_BG_BLUE: Use blue as background color.
127 * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
128 * @GST_DEBUG_BG_CYAN: Use cyan as background color.
129 * @GST_DEBUG_BG_WHITE: Use white as background color.
130 * @GST_DEBUG_BOLD: Make the output bold.
131 * @GST_DEBUG_UNDERLINE: Underline the output.
133 * These are some terminal style flags you can use when creating your
134 * debugging categories to make them stand out in debugging output.
138 GST_DEBUG_FG_BLACK = 0x0000,
139 GST_DEBUG_FG_RED = 0x0001,
140 GST_DEBUG_FG_GREEN = 0x0002,
141 GST_DEBUG_FG_YELLOW = 0x0003,
142 GST_DEBUG_FG_BLUE = 0x0004,
143 GST_DEBUG_FG_MAGENTA = 0x0005,
144 GST_DEBUG_FG_CYAN = 0x0006,
145 GST_DEBUG_FG_WHITE = 0x0007,
146 /* background colors */
147 GST_DEBUG_BG_BLACK = 0x0000,
148 GST_DEBUG_BG_RED = 0x0010,
149 GST_DEBUG_BG_GREEN = 0x0020,
150 GST_DEBUG_BG_YELLOW = 0x0030,
151 GST_DEBUG_BG_BLUE = 0x0040,
152 GST_DEBUG_BG_MAGENTA = 0x0050,
153 GST_DEBUG_BG_CYAN = 0x0060,
154 GST_DEBUG_BG_WHITE = 0x0070,
156 GST_DEBUG_BOLD = 0x0100,
157 GST_DEBUG_UNDERLINE = 0x0200
158 } GstDebugColorFlags;
160 #define GST_DEBUG_FG_MASK (0x000F)
161 #define GST_DEBUG_BG_MASK (0x00F0)
162 #define GST_DEBUG_FORMAT_MASK (0xFF00)
164 typedef struct _GstDebugCategory GstDebugCategory;
168 * This is the struct that describes the categories. Once initialized with
169 * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
171 struct _GstDebugCategory {
174 guint color; /* see defines above */
177 const gchar * description;
180 /********** some convenience macros for debugging **********/
184 * @str: The string to check.
186 * Macro to use when a string must not be NULL, but may be NULL. If the string
187 * is NULL, "(NULL)" is printed instead.
188 * In GStreamer printf string arguments may not be NULL, because on some
189 * platforms (ie Solaris) the libc crashes in that case. This includes debugging
192 #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
194 /* FIXME, not MT safe */
196 * GST_DEBUG_PAD_NAME:
197 * @pad: The pad to debug.
199 * Evaluates to 2 strings, that describe the pad. Often used in debugging
202 #define GST_DEBUG_PAD_NAME(pad) \
204 ((GST_OBJECT_PARENT(pad) != NULL) ? \
205 GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
207 (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
212 * This macro should evaluate to the name of the current function and be should
213 * be defined when configuring your project, as it is compiler dependant. If it
214 * is not defined, some default value is used. It is used to provide debugging
215 * output with the function name of the message.
218 # define GST_FUNCTION G_STRFUNC
219 #endif /* ifndef GST_FUNCTION */
222 typedef struct _GstDebugMessage GstDebugMessage;
226 * @category: a #GstDebugCategory
227 * @level: a #GstDebugLevel
229 * @function: function name
231 * @object: a #GObject
232 * @message: the message
233 * @data: user data for the log function
235 * Function prototype for a logging function that can be registered with
236 * gst_debug_add_log_function().
237 * Use G_GNUC_NO_INSTRUMENT on that function.
239 typedef void (*GstLogFunction) (GstDebugCategory * category,
242 const gchar * function,
245 GstDebugMessage * message,
248 #ifndef GST_DISABLE_GST_DEBUG
250 /* FIXME 0.11: move this into private headers */
251 void _gst_debug_init (void);
254 #ifdef GST_USING_PRINTF_EXTENSION
256 /* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
257 void gst_debug_log (GstDebugCategory * category,
260 const gchar * function,
263 const gchar * format,
264 ...) G_GNUC_NO_INSTRUMENT;
266 #else /* GST_USING_PRINTF_EXTENSION */
268 void gst_debug_log (GstDebugCategory * category,
271 const gchar * function,
274 const gchar * format,
275 ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
277 #endif /* GST_USING_PRINTF_EXTENSION */
279 void gst_debug_log_valist (GstDebugCategory * category,
282 const gchar * function,
285 const gchar * format,
286 va_list args) G_GNUC_NO_INSTRUMENT;
288 const gchar * gst_debug_message_get (GstDebugMessage * message);
290 void gst_debug_log_default (GstDebugCategory * category,
293 const gchar * function,
296 GstDebugMessage * message,
297 gpointer unused) G_GNUC_NO_INSTRUMENT;
299 G_CONST_RETURN gchar *
300 gst_debug_level_get_name (GstDebugLevel level);
302 void gst_debug_add_log_function (GstLogFunction func,
304 guint gst_debug_remove_log_function (GstLogFunction func);
305 guint gst_debug_remove_log_function_by_data (gpointer data);
307 void gst_debug_set_active (gboolean active);
308 gboolean gst_debug_is_active (void);
310 void gst_debug_set_colored (gboolean colored);
311 gboolean gst_debug_is_colored (void);
313 void gst_debug_set_default_threshold (GstDebugLevel level);
314 GstDebugLevel gst_debug_get_default_threshold (void);
315 void gst_debug_set_threshold_for_name (const gchar * name,
316 GstDebugLevel level);
317 void gst_debug_unset_threshold_for_name (const gchar * name);
320 * GST_DEBUG_CATEGORY:
323 * Defines a GstDebugCategory variable.
324 * This macro expands to nothing if debugging is disabled.
326 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
328 * GST_DEBUG_CATEGORY_EXTERN:
331 * Declares a GstDebugCategory variable as extern. Use in header files.
332 * This macro expands to nothing if debugging is disabled.
334 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
337 * GST_DEBUG_CATEGORY_STATIC:
340 * Defines a static GstDebugCategory variable.
341 * This macro expands to nothing if debugging is disabled.
343 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
344 /* do not use this function, use the macros below */
345 GstDebugCategory *_gst_debug_category_new (const gchar * name,
347 const gchar * description);
349 * GST_DEBUG_CATEGORY_INIT:
350 * @cat: the category to initialize.
351 * @name: the name of the category.
352 * @color: the colors to use for a color representation or 0 for no color.
353 * @description: optional description of the category.
355 * Initializes a new #GstDebugCategory with the given properties and set to
356 * the default threshold.
360 * This macro expands to nothing if debugging is disabled.
363 * When naming your category, please follow the following conventions to ensure
364 * that the pattern matching for categories works as expected. It is not
365 * earth-shattering if you don't follow these conventions, but it would be nice
369 * If you define a category for a plugin or a feature of it, name the category
370 * like the feature. So if you wanted to write a "filesrc" element, you would
371 * name the category "filesrc". Use lowercase letters only.
372 * If you define more than one category for the same element, append an
373 * underscore and an identifier to your categories, like this: "filesrc_cache"
376 * If you create a library or an application using debugging categories, use a
377 * common prefix followed by an underscore for all your categories. GStreamer
378 * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
379 * to include uppercase letters.
383 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
385 cat = _gst_debug_category_new (name,color,description); \
388 void gst_debug_category_free (GstDebugCategory * category);
389 void gst_debug_category_set_threshold (GstDebugCategory * category,
390 GstDebugLevel level);
391 void gst_debug_category_reset_threshold(GstDebugCategory * category);
393 gst_debug_category_get_threshold (GstDebugCategory * category);
394 G_CONST_RETURN gchar *
395 gst_debug_category_get_name (GstDebugCategory * category);
396 guint gst_debug_category_get_color (GstDebugCategory * category);
397 G_CONST_RETURN gchar *
398 gst_debug_category_get_description (GstDebugCategory * category);
400 gst_debug_get_all_categories (void);
402 gchar * gst_debug_construct_term_color (guint colorinfo);
408 * Default gstreamer core debug log category. Please define your own.
410 GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
411 /* this symbol may not be used */
412 extern gboolean __gst_debug_enabled;
414 /* since 0.10.7, the min debug level, used for quickly discarding debug
415 * messages that fall under the threshold. */
416 extern IMPORT_SYMBOL GstDebugLevel __gst_debug_min;
420 * @cat: category to use
421 * @level: the severity of the message
422 * @object: the #GObject the message belongs to or NULL if none
423 * @...: A printf-style message to output
425 * Outputs a debugging message. This is the most general macro for outputting
426 * debugging messages. You will probably want to use one of the ones described
429 #ifdef G_HAVE_ISO_VARARGS
430 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
431 if (G_UNLIKELY (level <= __gst_debug_min)) { \
432 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
433 (GObject *) (object), __VA_ARGS__); \
436 #else /* G_HAVE_GNUC_VARARGS */
437 #ifdef G_HAVE_GNUC_VARARGS
438 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
439 if (G_UNLIKELY (level <= __gst_debug_min)) { \
440 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
441 (GObject *) (object), ##args ); \
444 #else /* no variadic macros, use inline */
446 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
447 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
449 if (G_UNLIKELY (level <= __gst_debug_min)) {
450 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
456 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
457 gpointer object, const char *format, ...)
461 va_start (varargs, format);
462 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
466 #endif /* G_HAVE_ISO_VARARGS */
469 * GST_CAT_ERROR_OBJECT:
470 * @cat: category to use
471 * @obj: the #GObject the message belongs to
472 * @...: printf-style message to output
474 * Output an error message belonging to the given object in the given category.
477 * GST_CAT_WARNING_OBJECT:
478 * @cat: category to use
479 * @obj: the #GObject the message belongs to
480 * @...: printf-style message to output
482 * Output a warning message belonging to the given object in the given category.
485 * GST_CAT_INFO_OBJECT:
486 * @cat: category to use
487 * @obj: the #GObject the message belongs to
488 * @...: printf-style message to output
490 * Output an informational message belonging to the given object in the given
494 * GST_CAT_DEBUG_OBJECT:
495 * @cat: category to use
496 * @obj: the #GObject the message belongs to
497 * @...: printf-style message to output
499 * Output an debugging message belonging to the given object in the given category.
502 * GST_CAT_LOG_OBJECT:
503 * @cat: category to use
504 * @obj: the #GObject the message belongs to
505 * @...: printf-style message to output
507 * Output an logging message belonging to the given object in the given category.
513 * @cat: category to use
514 * @...: printf-style message to output
516 * Output an error message in the given category.
520 * @cat: category to use
521 * @...: printf-style message to output
523 * Output an warning message in the given category.
527 * @cat: category to use
528 * @...: printf-style message to output
530 * Output an informational message in the given category.
534 * @cat: category to use
535 * @...: printf-style message to output
537 * Output an debugging message in the given category.
541 * @cat: category to use
542 * @...: printf-style message to output
544 * Output an logging message in the given category.
550 * @obj: the #GObject the message belongs to
551 * @...: printf-style message to output
553 * Output an error message belonging to the given object in the default category.
556 * GST_WARNING_OBJECT:
557 * @obj: the #GObject the message belongs to
558 * @...: printf-style message to output
560 * Output a warning message belonging to the given object in the default category.
564 * @obj: the #GObject the message belongs to
565 * @...: printf-style message to output
567 * Output an informational message belonging to the given object in the default
572 * @obj: the #GObject the message belongs to
573 * @...: printf-style message to output
575 * Output a debugging message belonging to the given object in the default
580 * @obj: the #GObject the message belongs to
581 * @...: printf-style message to output
583 * Output a logging message belonging to the given object in the default category.
589 * @...: printf-style message to output
591 * Output an error message in the default category.
595 * @...: printf-style message to output
597 * Output a warning message in the default category.
601 * @...: printf-style message to output
603 * Output an informational message in the default category.
607 * @...: printf-style message to output
609 * Output a debugging message in the default category.
613 * @...: printf-style message to output
615 * Output a logging message in the default category.
618 #ifdef G_HAVE_ISO_VARARGS
620 #define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
621 #define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
622 #define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
623 #define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
624 #define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
626 #define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
627 #define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
628 #define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
629 #define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
630 #define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
632 #define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
633 #define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
634 #define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
635 #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
636 #define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
638 #define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
639 #define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
640 #define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
641 #define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
642 #define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
645 #ifdef G_HAVE_GNUC_VARARGS
647 #define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
648 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
649 #define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
650 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
651 #define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
653 #define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
654 #define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
655 #define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
656 #define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
657 #define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
659 #define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
660 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
661 #define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
662 #define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
663 #define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
665 #define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
666 #define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
667 #define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
668 #define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
669 #define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
672 /* no variadic macros, use inline */
674 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
679 va_start (varargs, format);
680 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
685 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
686 const char *format, ...)
690 va_start (varargs, format);
691 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
696 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
701 va_start (varargs, format);
702 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
707 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
712 va_start (varargs, format);
713 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
718 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
723 va_start (varargs, format);
724 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
729 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
733 va_start (varargs, format);
734 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
739 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
743 va_start (varargs, format);
744 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
749 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
753 va_start (varargs, format);
754 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
759 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
763 va_start (varargs, format);
764 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
769 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
773 va_start (varargs, format);
774 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
779 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
783 va_start (varargs, format);
784 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
790 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
794 va_start (varargs, format);
795 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
801 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
805 va_start (varargs, format);
806 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
812 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
816 va_start (varargs, format);
817 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
823 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
827 va_start (varargs, format);
828 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
834 GST_ERROR (const char *format, ...)
838 va_start (varargs, format);
839 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
845 GST_WARNING (const char *format, ...)
849 va_start (varargs, format);
850 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
856 GST_INFO (const char *format, ...)
860 va_start (varargs, format);
861 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
867 GST_DEBUG (const char *format, ...)
871 va_start (varargs, format);
872 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
878 GST_LOG (const char *format, ...)
882 va_start (varargs, format);
883 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
891 /********** function pointer stuff **********/
893 typedef void (* GstDebugFuncPtr) (void);
894 void _gst_debug_register_funcptr (GstDebugFuncPtr func,
895 const gchar * ptrname);
896 G_CONST_RETURN gchar *
897 _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
901 * @ptr: pointer to the function to register
903 * Register a pointer to a function with its name, so it can later be used by
904 * GST_DEBUG_FUNCPTR_NAME().
906 #define GST_DEBUG_FUNCPTR(ptr) \
907 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
910 * GST_DEBUG_FUNCPTR_NAME:
911 * @ptr: address of the function of which to look up the name
913 * Retrieves the name of the function, if it was previously registered with
914 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
916 * This macro returns a constant string which must not be modified or
917 * freed by the caller.
919 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
920 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
923 #else /* GST_DISABLE_GST_DEBUG */
926 #if defined(__GNUC__) && __GNUC__ >= 3
927 # pragma GCC poison gst_debug_log
928 # pragma GCC poison gst_debug_log_valist
929 # pragma GCC poison _gst_debug_category_new
932 #define _gst_debug_init() /* NOP */
934 #define gst_debug_set_default_threshold(level) /* NOP */
935 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
937 #define gst_debug_level_get_name(level) ("NONE")
938 #define gst_debug_message_get(message) ("NONE")
939 #define gst_debug_add_log_function(func,data) /* NOP */
940 guint gst_debug_remove_log_function (GstLogFunction func);
941 guint gst_debug_remove_log_function_by_data (gpointer data);
942 #define gst_debug_set_active(active) /* NOP */
943 #define gst_debug_is_active() (FALSE)
944 #define gst_debug_set_colored(colored) /* NOP */
945 #define gst_debug_is_colored() (FALSE)
946 #define gst_debug_set_default_threshold(level) /* NOP */
947 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
948 #define gst_debug_set_threshold_for_name(name,level) /* NOP */
949 #define gst_debug_unset_threshold_for_name(name) /* NOP */
951 #define GST_DEBUG_CATEGORY(var) /* NOP */
952 #define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */
953 #if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
954 #define GST_DEBUG_CATEGORY_STATIC(var) static GstDebugCategory *var = NULL
956 #define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
958 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
959 #define gst_debug_category_free(category) /* NOP */
960 #define gst_debug_category_set_threshold(category,level) /* NOP */
961 #define gst_debug_category_reset_threshold(category) /* NOP */
962 #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
963 #define gst_debug_category_get_name(cat) ("")
964 #define gst_debug_category_get_color(cat) (0)
965 #define gst_debug_category_get_description(cat) ("")
966 #define gst_debug_get_all_categories() (NULL)
967 #define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
969 #ifdef G_HAVE_ISO_VARARGS
971 #define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */
973 #define GST_CAT_ERROR_OBJECT(...) /* NOP */
974 #define GST_CAT_WARNING_OBJECT(...) /* NOP */
975 #define GST_CAT_INFO_OBJECT(...) /* NOP */
976 #define GST_CAT_DEBUG_OBJECT(...) /* NOP */
977 #define GST_CAT_LOG_OBJECT(...) /* NOP */
979 #define GST_CAT_ERROR(...) /* NOP */
980 #define GST_CAT_WARNING(...) /* NOP */
981 #define GST_CAT_INFO(...) /* NOP */
982 #define GST_CAT_DEBUG(...) /* NOP */
983 #define GST_CAT_LOG(...) /* NOP */
985 #define GST_ERROR_OBJECT(...) /* NOP */
986 #define GST_WARNING_OBJECT(...) /* NOP */
987 #define GST_INFO_OBJECT(...) /* NOP */
988 #define GST_DEBUG_OBJECT(...) /* NOP */
989 #define GST_LOG_OBJECT(...) /* NOP */
991 #define GST_ERROR(...) /* NOP */
992 #define GST_WARNING(...) /* NOP */
993 #define GST_INFO(...) /* NOP */
994 #define GST_DEBUG(...) /* NOP */
995 #define GST_LOG(...) /* NOP */
998 #ifdef G_HAVE_GNUC_VARARGS
1000 #define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */
1002 #define GST_CAT_ERROR_OBJECT(args...) /* NOP */
1003 #define GST_CAT_WARNING_OBJECT(args...) /* NOP */
1004 #define GST_CAT_INFO_OBJECT(args...) /* NOP */
1005 #define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
1006 #define GST_CAT_LOG_OBJECT(args...) /* NOP */
1008 #define GST_CAT_ERROR(args...) /* NOP */
1009 #define GST_CAT_WARNING(args...) /* NOP */
1010 #define GST_CAT_INFO(args...) /* NOP */
1011 #define GST_CAT_DEBUG(args...) /* NOP */
1012 #define GST_CAT_LOG(args...) /* NOP */
1014 #define GST_ERROR_OBJECT(args...) /* NOP */
1015 #define GST_WARNING_OBJECT(args...) /* NOP */
1016 #define GST_INFO_OBJECT(args...) /* NOP */
1017 #define GST_DEBUG_OBJECT(args...) /* NOP */
1018 #define GST_LOG_OBJECT(args...) /* NOP */
1020 #define GST_ERROR(args...) /* NOP */
1021 #define GST_WARNING(args...) /* NOP */
1022 #define GST_INFO(args...) /* NOP */
1023 #define GST_DEBUG(args...) /* NOP */
1024 #define GST_LOG(args...) /* NOP */
1028 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1029 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1034 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1040 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1041 const char *format, ...)
1046 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1052 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1058 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1064 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1069 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1074 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1079 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1084 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1089 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1094 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1099 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1104 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1109 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1114 GST_ERROR (const char *format, ...)
1119 GST_WARNING (const char *format, ...)
1124 GST_INFO (const char *format, ...)
1129 GST_DEBUG (const char *format, ...)
1134 GST_LOG (const char *format, ...)
1140 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1141 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1143 #endif /* GST_DISABLE_GST_DEBUG */
1146 void gst_debug_print_stack_trace (void);
1150 #endif /* __GSTINFO_H__ */