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 #if defined (__GNUC__)
219 # define GST_FUNCTION ((const char*) (__FUNCTION__))
220 #elif defined (G_HAVE_ISO_VARARGS)
221 # define GST_FUNCTION ((const char*) (__func__))
223 # define GST_FUNCTION ((const char*) ("???"))
225 #endif /* ifndef GST_FUNCTION */
228 typedef struct _GstDebugMessage GstDebugMessage;
232 * @category: a #GstDebugCategory
233 * @level: a #GstDebugLevel
235 * @function: function name
237 * @object: a #GObject
238 * @message: the message
239 * @data: user data for the log function
241 * Function prototype for a logging function that can be registered with
242 * gst_debug_add_log_function().
243 * Use G_GNUC_NO_INSTRUMENT on that function.
245 typedef void (*GstLogFunction) (GstDebugCategory * category,
248 const gchar * function,
251 GstDebugMessage * message,
254 #ifndef GST_DISABLE_GST_DEBUG
256 void _gst_debug_init (void);
259 #ifdef GST_USING_PRINTF_EXTENSION
261 /* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
262 void gst_debug_log (GstDebugCategory * category,
265 const gchar * function,
268 const gchar * format,
269 ...) G_GNUC_NO_INSTRUMENT;
271 #else /* GST_USING_PRINTF_EXTENSION */
273 void gst_debug_log (GstDebugCategory * category,
276 const gchar * function,
279 const gchar * format,
280 ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
282 #endif /* GST_USING_PRINTF_EXTENSION */
284 void gst_debug_log_valist (GstDebugCategory * category,
287 const gchar * function,
290 const gchar * format,
291 va_list args) G_GNUC_NO_INSTRUMENT;
293 const gchar * gst_debug_message_get (GstDebugMessage * message);
295 void gst_debug_log_default (GstDebugCategory * category,
298 const gchar * function,
301 GstDebugMessage * message,
302 gpointer unused) G_GNUC_NO_INSTRUMENT;
304 G_CONST_RETURN gchar *
305 gst_debug_level_get_name (GstDebugLevel level);
307 void gst_debug_add_log_function (GstLogFunction func,
309 guint gst_debug_remove_log_function (GstLogFunction func);
310 guint gst_debug_remove_log_function_by_data (gpointer data);
312 void gst_debug_set_active (gboolean active);
313 gboolean gst_debug_is_active (void);
315 void gst_debug_set_colored (gboolean colored);
316 gboolean gst_debug_is_colored (void);
318 void gst_debug_set_default_threshold (GstDebugLevel level);
319 GstDebugLevel gst_debug_get_default_threshold (void);
320 void gst_debug_set_threshold_for_name (const gchar * name,
321 GstDebugLevel level);
322 void gst_debug_unset_threshold_for_name (const gchar * name);
325 * GST_DEBUG_CATEGORY:
328 * Defines a GstDebugCategory variable.
329 * This macro expands to nothing if debugging is disabled.
331 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
333 * GST_DEBUG_CATEGORY_EXTERN:
336 * Declares a GstDebugCategory variable as extern. Use in header files.
337 * This macro expands to nothing if debugging is disabled.
339 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
342 * GST_DEBUG_CATEGORY_STATIC:
345 * Defines a static GstDebugCategory variable.
346 * This macro expands to nothing if debugging is disabled.
348 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
349 /* do not use this function, use the macros below */
350 GstDebugCategory *_gst_debug_category_new (const gchar * name,
352 const gchar * description);
354 * GST_DEBUG_CATEGORY_INIT:
355 * @cat: the category to initialize.
356 * @name: the name of the category.
357 * @color: the colors to use for a color representation or 0 for no color.
358 * @description: optional description of the category.
360 * Initializes a new #GstDebugCategory with the given properties and set to
361 * the default threshold.
365 * This macro expands to nothing if debugging is disabled.
368 * When naming your category, please follow the following conventions to ensure
369 * that the pattern matching for categories works as expected. It is not
370 * earth-shattering if you don't follow these conventions, but it would be nice
374 * If you define a category for a plugin or a feature of it, name the category
375 * like the feature. So if you wanted to write a "filesrc" element, you would
376 * name the category "filesrc". Use lowercase letters only.
377 * If you define more than one category for the same element, append an
378 * underscore and an identifier to your categories, like this: "filesrc_cache"
381 * If you create a library or an application using debugging categories, use a
382 * common prefix followed by an underscore for all your categories. GStreamer
383 * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
384 * to include uppercase letters.
388 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
390 cat = _gst_debug_category_new (name,color,description); \
393 void gst_debug_category_free (GstDebugCategory * category);
394 void gst_debug_category_set_threshold (GstDebugCategory * category,
395 GstDebugLevel level);
396 void gst_debug_category_reset_threshold(GstDebugCategory * category);
398 gst_debug_category_get_threshold (GstDebugCategory * category);
399 G_CONST_RETURN gchar *
400 gst_debug_category_get_name (GstDebugCategory * category);
401 guint gst_debug_category_get_color (GstDebugCategory * category);
402 G_CONST_RETURN gchar *
403 gst_debug_category_get_description (GstDebugCategory * category);
405 gst_debug_get_all_categories (void);
407 gchar * gst_debug_construct_term_color (guint colorinfo);
413 * Default gstreamer core debug log category. Please define your own.
415 GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
416 /* this symbol may not be used */
417 extern gboolean __gst_debug_enabled;
419 /* since 0.10.7, the min debug level, used for quickly discarding debug
420 * messages that fall under the threshold. */
421 extern IMPORT_SYMBOL GstDebugLevel __gst_debug_min;
425 * @cat: category to use
426 * @level: the severity of the message
427 * @object: the #GObject the message belongs to or NULL if none
428 * @...: A printf-style message to output
430 * Outputs a debugging message. This is the most general macro for outputting
431 * debugging messages. You will probably want to use one of the ones described
434 #ifdef G_HAVE_ISO_VARARGS
435 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
436 if (G_UNLIKELY (level <= __gst_debug_min)) { \
437 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
438 (GObject *) (object), __VA_ARGS__); \
441 #else /* G_HAVE_GNUC_VARARGS */
442 #ifdef G_HAVE_GNUC_VARARGS
443 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
444 if (G_UNLIKELY (level <= __gst_debug_min)) { \
445 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
446 (GObject *) (object), ##args ); \
449 #else /* no variadic macros, use inline */
451 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
452 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
454 if (G_UNLIKELY (level <= __gst_debug_min)) {
455 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
461 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
462 gpointer object, const char *format, ...)
466 va_start (varargs, format);
467 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
471 #endif /* G_HAVE_ISO_VARARGS */
474 * GST_CAT_ERROR_OBJECT:
475 * @cat: category to use
476 * @obj: the #GObject the message belongs to
477 * @...: printf-style message to output
479 * Output an error message belonging to the given object in the given category.
482 * GST_CAT_WARNING_OBJECT:
483 * @cat: category to use
484 * @obj: the #GObject the message belongs to
485 * @...: printf-style message to output
487 * Output a warning message belonging to the given object in the given category.
490 * GST_CAT_INFO_OBJECT:
491 * @cat: category to use
492 * @obj: the #GObject the message belongs to
493 * @...: printf-style message to output
495 * Output an informational message belonging to the given object in the given
499 * GST_CAT_DEBUG_OBJECT:
500 * @cat: category to use
501 * @obj: the #GObject the message belongs to
502 * @...: printf-style message to output
504 * Output an debugging message belonging to the given object in the given category.
507 * GST_CAT_LOG_OBJECT:
508 * @cat: category to use
509 * @obj: the #GObject the message belongs to
510 * @...: printf-style message to output
512 * Output an logging message belonging to the given object in the given category.
518 * @cat: category to use
519 * @...: printf-style message to output
521 * Output an error message in the given category.
525 * @cat: category to use
526 * @...: printf-style message to output
528 * Output an warning message in the given category.
532 * @cat: category to use
533 * @...: printf-style message to output
535 * Output an informational message in the given category.
539 * @cat: category to use
540 * @...: printf-style message to output
542 * Output an debugging message in the given category.
546 * @cat: category to use
547 * @...: printf-style message to output
549 * Output an logging message in the given category.
555 * @obj: the #GObject the message belongs to
556 * @...: printf-style message to output
558 * Output an error message belonging to the given object in the default category.
561 * GST_WARNING_OBJECT:
562 * @obj: the #GObject the message belongs to
563 * @...: printf-style message to output
565 * Output a warning message belonging to the given object in the default category.
569 * @obj: the #GObject the message belongs to
570 * @...: printf-style message to output
572 * Output an informational message belonging to the given object in the default
577 * @obj: the #GObject the message belongs to
578 * @...: printf-style message to output
580 * Output a debugging message belonging to the given object in the default
585 * @obj: the #GObject the message belongs to
586 * @...: printf-style message to output
588 * Output a logging message belonging to the given object in the default category.
594 * @...: printf-style message to output
596 * Output an error message in the default category.
600 * @...: printf-style message to output
602 * Output a warning message in the default category.
606 * @...: printf-style message to output
608 * Output an informational message in the default category.
612 * @...: printf-style message to output
614 * Output a debugging message in the default category.
618 * @...: printf-style message to output
620 * Output a logging message in the default category.
623 #ifdef G_HAVE_ISO_VARARGS
625 #define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
626 #define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
627 #define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
628 #define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
629 #define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
631 #define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
632 #define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
633 #define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
634 #define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
635 #define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
637 #define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
638 #define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
639 #define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
640 #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
641 #define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
643 #define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
644 #define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
645 #define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
646 #define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
647 #define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
650 #ifdef G_HAVE_GNUC_VARARGS
652 #define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
653 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
654 #define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
655 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
656 #define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
658 #define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
659 #define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
660 #define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
661 #define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
662 #define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
664 #define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
665 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
666 #define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
667 #define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
668 #define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
670 #define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
671 #define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
672 #define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
673 #define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
674 #define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
677 /* no variadic macros, use inline */
679 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
684 va_start (varargs, format);
685 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
690 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
691 const char *format, ...)
695 va_start (varargs, format);
696 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
701 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
706 va_start (varargs, format);
707 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
712 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
717 va_start (varargs, format);
718 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
723 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
728 va_start (varargs, format);
729 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
734 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
738 va_start (varargs, format);
739 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
744 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
748 va_start (varargs, format);
749 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
754 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
758 va_start (varargs, format);
759 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
764 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
768 va_start (varargs, format);
769 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
774 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
778 va_start (varargs, format);
779 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
784 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
788 va_start (varargs, format);
789 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
795 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
799 va_start (varargs, format);
800 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
806 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
810 va_start (varargs, format);
811 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
817 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
821 va_start (varargs, format);
822 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
828 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
832 va_start (varargs, format);
833 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
839 GST_ERROR (const char *format, ...)
843 va_start (varargs, format);
844 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
850 GST_WARNING (const char *format, ...)
854 va_start (varargs, format);
855 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
861 GST_INFO (const char *format, ...)
865 va_start (varargs, format);
866 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
872 GST_DEBUG (const char *format, ...)
876 va_start (varargs, format);
877 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
883 GST_LOG (const char *format, ...)
887 va_start (varargs, format);
888 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
896 /********** function pointer stuff **********/
898 typedef void (* GstDebugFuncPtr) (void);
899 void _gst_debug_register_funcptr (GstDebugFuncPtr func,
900 const gchar * ptrname);
901 G_CONST_RETURN gchar *
902 _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
906 * @ptr: pointer to the function to register
908 * Register a pointer to a function with its name, so it can later be used by
909 * GST_DEBUG_FUNCPTR_NAME().
911 #define GST_DEBUG_FUNCPTR(ptr) \
912 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
915 * GST_DEBUG_FUNCPTR_NAME:
916 * @ptr: address of the function of which to look up the name
918 * Retrieves the name of the function, if it was previously registered with
919 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
921 * This macro returns a constant string which must not be modified or
922 * freed by the caller.
924 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
925 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
928 #else /* GST_DISABLE_GST_DEBUG */
931 #if defined(__GNUC__) && __GNUC__ >= 3
932 # pragma GCC poison gst_debug_log
933 # pragma GCC poison gst_debug_log_valist
934 # pragma GCC poison _gst_debug_category_new
937 #define _gst_debug_init() /* NOP */
939 #define gst_debug_set_default_threshold(level) /* NOP */
940 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
942 #define gst_debug_level_get_name(level) ("NONE")
943 #define gst_debug_message_get(message) ("NONE")
944 #define gst_debug_add_log_function(func,data) /* NOP */
945 guint gst_debug_remove_log_function (GstLogFunction func);
946 guint gst_debug_remove_log_function_by_data (gpointer data);
947 #define gst_debug_set_active(active) /* NOP */
948 #define gst_debug_is_active() (FALSE)
949 #define gst_debug_set_colored(colored) /* NOP */
950 #define gst_debug_is_colored() (FALSE)
951 #define gst_debug_set_default_threshold(level) /* NOP */
952 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
953 #define gst_debug_set_threshold_for_name(name,level) /* NOP */
954 #define gst_debug_unset_threshold_for_name(name) /* NOP */
956 #define GST_DEBUG_CATEGORY(var) /* NOP */
957 #define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */
958 #if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
959 #define GST_DEBUG_CATEGORY_STATIC(var) static GstDebugCategory *var = NULL
961 #define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
963 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
964 #define gst_debug_category_free(category) /* NOP */
965 #define gst_debug_category_set_threshold(category,level) /* NOP */
966 #define gst_debug_category_reset_threshold(category) /* NOP */
967 #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
968 #define gst_debug_category_get_name(cat) ("")
969 #define gst_debug_category_get_color(cat) (0)
970 #define gst_debug_category_get_description(cat) ("")
971 #define gst_debug_get_all_categories() (NULL)
972 #define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
974 #ifdef G_HAVE_ISO_VARARGS
976 #define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */
978 #define GST_CAT_ERROR_OBJECT(...) /* NOP */
979 #define GST_CAT_WARNING_OBJECT(...) /* NOP */
980 #define GST_CAT_INFO_OBJECT(...) /* NOP */
981 #define GST_CAT_DEBUG_OBJECT(...) /* NOP */
982 #define GST_CAT_LOG_OBJECT(...) /* NOP */
984 #define GST_CAT_ERROR(...) /* NOP */
985 #define GST_CAT_WARNING(...) /* NOP */
986 #define GST_CAT_INFO(...) /* NOP */
987 #define GST_CAT_DEBUG(...) /* NOP */
988 #define GST_CAT_LOG(...) /* NOP */
990 #define GST_ERROR_OBJECT(...) /* NOP */
991 #define GST_WARNING_OBJECT(...) /* NOP */
992 #define GST_INFO_OBJECT(...) /* NOP */
993 #define GST_DEBUG_OBJECT(...) /* NOP */
994 #define GST_LOG_OBJECT(...) /* NOP */
996 #define GST_ERROR(...) /* NOP */
997 #define GST_WARNING(...) /* NOP */
998 #define GST_INFO(...) /* NOP */
999 #define GST_DEBUG(...) /* NOP */
1000 #define GST_LOG(...) /* NOP */
1003 #ifdef G_HAVE_GNUC_VARARGS
1005 #define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */
1007 #define GST_CAT_ERROR_OBJECT(args...) /* NOP */
1008 #define GST_CAT_WARNING_OBJECT(args...) /* NOP */
1009 #define GST_CAT_INFO_OBJECT(args...) /* NOP */
1010 #define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
1011 #define GST_CAT_LOG_OBJECT(args...) /* NOP */
1013 #define GST_CAT_ERROR(args...) /* NOP */
1014 #define GST_CAT_WARNING(args...) /* NOP */
1015 #define GST_CAT_INFO(args...) /* NOP */
1016 #define GST_CAT_DEBUG(args...) /* NOP */
1017 #define GST_CAT_LOG(args...) /* NOP */
1019 #define GST_ERROR_OBJECT(args...) /* NOP */
1020 #define GST_WARNING_OBJECT(args...) /* NOP */
1021 #define GST_INFO_OBJECT(args...) /* NOP */
1022 #define GST_DEBUG_OBJECT(args...) /* NOP */
1023 #define GST_LOG_OBJECT(args...) /* NOP */
1025 #define GST_ERROR(args...) /* NOP */
1026 #define GST_WARNING(args...) /* NOP */
1027 #define GST_INFO(args...) /* NOP */
1028 #define GST_DEBUG(args...) /* NOP */
1029 #define GST_LOG(args...) /* NOP */
1033 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1034 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1039 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1045 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1046 const char *format, ...)
1051 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1057 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1063 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1069 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1074 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1079 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1084 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1089 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1094 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1099 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1104 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1109 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1114 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1119 GST_ERROR (const char *format, ...)
1124 GST_WARNING (const char *format, ...)
1129 GST_INFO (const char *format, ...)
1134 GST_DEBUG (const char *format, ...)
1139 GST_LOG (const char *format, ...)
1145 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1146 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1148 #endif /* GST_DISABLE_GST_DEBUG */
1151 void gst_debug_print_stack_trace (void);
1155 #endif /* __GSTINFO_H__ */