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>
32 #define M_PI 3.14159265358979323846
39 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
41 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured
42 * that stops the application from keeping working correctly.
43 * An examples is gst_element_error, which outputs a message with this priority.
44 * It does not mean that the application is terminating as with g_errror.
45 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
46 * that could lead to problems or weird behaviour later on. An example of this
47 * would be clocking issues ("your computer is pretty slow") or broken input
48 * data ("Can't synchronize to stream.")
49 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
50 * updated about what is happening.
51 * Examples where this should be used are when a typefind function has
52 * successfully determined the type of the stream or when an mp3 plugin detects
53 * the format to be used. ("This file has mono sound.")
54 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
55 * happens that is not the expected default behavior.
56 * An example would be notifications about state changes or receiving/sending of
58 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
59 * useful to know. As a rule of thumb a pipeline that is iterating as expected
60 * should never output anzthing else but LOG messages.
61 * Examples for this are referencing/dereferencing of objects or cothread switches.
62 * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
63 * in the executed code path is not fully implemented or handled yet. Note
64 * that this does not replace proper error handling in any way, the purpose
65 * of this message is to make it easier to spot incomplete/unfinished pieces
66 * of code when reading the debug log. (Since: 0.10.23)
67 * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
68 * data as memory dumps in the log. They will be displayed as hexdump with
69 * ASCII characters. (Since: 0.10.23)
70 * @GST_LEVEL_COUNT: The number of defined debugging levels.
72 * The level defines the importance of a debugging message. The more important a
73 * message is, the greater the probability that the debugging system outputs it.
84 GST_LEVEL_MEMDUMP = 9,
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.
217 * Note that this is different from G_STRFUNC as we do not want the full
218 * function signature in C++ code.
221 #if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
222 # define GST_FUNCTION ((const char*) (__FUNCTION__))
223 #elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
224 # define GST_FUNCTION ((const char*) (__func__))
226 # define GST_FUNCTION ((const char*) ("???"))
228 #endif /* ifndef GST_FUNCTION */
231 typedef struct _GstDebugMessage GstDebugMessage;
235 * @category: a #GstDebugCategory
236 * @level: a #GstDebugLevel
238 * @function: function name
240 * @object: a #GObject
241 * @message: the message
242 * @data: user data for the log function
244 * Function prototype for a logging function that can be registered with
245 * gst_debug_add_log_function().
246 * Use G_GNUC_NO_INSTRUMENT on that function.
248 typedef void (*GstLogFunction) (GstDebugCategory * category,
251 const gchar * function,
254 GstDebugMessage * message,
257 #ifndef GST_DISABLE_GST_DEBUG
259 /* FIXME 0.11: move this into private headers */
260 void _gst_debug_init (void);
263 #ifdef GST_USING_PRINTF_EXTENSION
265 /* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
266 void gst_debug_log (GstDebugCategory * category,
269 const gchar * function,
272 const gchar * format,
273 ...) G_GNUC_NO_INSTRUMENT;
275 #else /* GST_USING_PRINTF_EXTENSION */
277 void gst_debug_log (GstDebugCategory * category,
280 const gchar * function,
283 const gchar * format,
284 ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
286 #endif /* GST_USING_PRINTF_EXTENSION */
288 void gst_debug_log_valist (GstDebugCategory * category,
291 const gchar * function,
294 const gchar * format,
295 va_list args) G_GNUC_NO_INSTRUMENT;
297 const gchar * gst_debug_message_get (GstDebugMessage * message);
299 void gst_debug_log_default (GstDebugCategory * category,
302 const gchar * function,
305 GstDebugMessage * message,
306 gpointer unused) G_GNUC_NO_INSTRUMENT;
308 G_CONST_RETURN gchar *
309 gst_debug_level_get_name (GstDebugLevel level);
311 void gst_debug_add_log_function (GstLogFunction func,
313 guint gst_debug_remove_log_function (GstLogFunction func);
314 guint gst_debug_remove_log_function_by_data (gpointer data);
316 void gst_debug_set_active (gboolean active);
317 gboolean gst_debug_is_active (void);
319 void gst_debug_set_colored (gboolean colored);
320 gboolean gst_debug_is_colored (void);
322 void gst_debug_set_default_threshold (GstDebugLevel level);
323 GstDebugLevel gst_debug_get_default_threshold (void);
324 void gst_debug_set_threshold_for_name (const gchar * name,
325 GstDebugLevel level);
326 void gst_debug_unset_threshold_for_name (const gchar * name);
329 * GST_DEBUG_CATEGORY:
332 * Defines a GstDebugCategory variable.
333 * This macro expands to nothing if debugging is disabled.
335 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
337 * GST_DEBUG_CATEGORY_EXTERN:
340 * Declares a GstDebugCategory variable as extern. Use in header files.
341 * This macro expands to nothing if debugging is disabled.
343 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern 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);
412 gint gst_debug_construct_win_color (guint colorinfo);
418 * Default gstreamer core debug log category. Please define your own.
420 GST_EXPORT GstDebugCategory * GST_CAT_DEFAULT;
421 /* this symbol may not be used */
422 extern gboolean __gst_debug_enabled;
424 /* since 0.10.7, the min debug level, used for quickly discarding debug
425 * messages that fall under the threshold. */
426 GST_EXPORT GstDebugLevel __gst_debug_min;
430 * @cat: category to use
431 * @level: the severity of the message
432 * @object: the #GObject the message belongs to or NULL if none
433 * @...: A printf-style message to output
435 * Outputs a debugging message. This is the most general macro for outputting
436 * debugging messages. You will probably want to use one of the ones described
439 #ifdef G_HAVE_ISO_VARARGS
440 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
441 if (G_UNLIKELY (level <= __gst_debug_min)) { \
442 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
443 (GObject *) (object), __VA_ARGS__); \
446 #else /* G_HAVE_GNUC_VARARGS */
447 #ifdef G_HAVE_GNUC_VARARGS
448 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
449 if (G_UNLIKELY (level <= __gst_debug_min)) { \
450 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
451 (GObject *) (object), ##args ); \
454 #else /* no variadic macros, use inline */
456 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
457 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
459 if (G_UNLIKELY (level <= __gst_debug_min)) {
460 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
466 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
467 gpointer object, const char *format, ...)
471 va_start (varargs, format);
472 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
476 #endif /* G_HAVE_ISO_VARARGS */
478 /* private helper function */
479 void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
480 const gchar * func, gint line, GObject * obj, const gchar * msg,
481 const guint8 * data, guint length);
483 /* This one doesn't have varargs in the macro, so it's different than all the
484 * other macros and hence in a separate block right here. Docs chunks are
485 * with the other doc chunks below though. */
486 #define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{ \
487 if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= __gst_debug_min)) { \
488 _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__, \
489 (GObject *) (object), (msg), (data), (length)); \
493 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) \
494 __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
495 #define GST_CAT_MEMDUMP(cat,msg,data,length) \
496 __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
497 #define GST_MEMDUMP_OBJECT(obj,msg,data,length) \
498 __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
499 #define GST_MEMDUMP(msg,data,length) \
500 __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
503 * GST_CAT_ERROR_OBJECT:
504 * @cat: category to use
505 * @obj: the #GObject the message belongs to
506 * @...: printf-style message to output
508 * Output an error message belonging to the given object in the given category.
511 * GST_CAT_WARNING_OBJECT:
512 * @cat: category to use
513 * @obj: the #GObject the message belongs to
514 * @...: printf-style message to output
516 * Output a warning message belonging to the given object in the given category.
519 * GST_CAT_INFO_OBJECT:
520 * @cat: category to use
521 * @obj: the #GObject the message belongs to
522 * @...: printf-style message to output
524 * Output an informational message belonging to the given object in the given
528 * GST_CAT_DEBUG_OBJECT:
529 * @cat: category to use
530 * @obj: the #GObject the message belongs to
531 * @...: printf-style message to output
533 * Output an debugging message belonging to the given object in the given category.
536 * GST_CAT_LOG_OBJECT:
537 * @cat: category to use
538 * @obj: the #GObject the message belongs to
539 * @...: printf-style message to output
541 * Output an logging message belonging to the given object in the given category.
544 * GST_CAT_FIXME_OBJECT:
545 * @cat: category to use
546 * @obj: the #GObject the message belongs to
547 * @...: printf-style message to output
549 * Output a fixme message belonging to the given object in the given category.
554 * GST_CAT_MEMDUMP_OBJECT:
555 * @cat: category to use
556 * @obj: the #GObject the message belongs to
557 * @msg: message string to log with the data
558 * @data: pointer to the data to output
559 * @length: length of the data to output
561 * Output a hexdump of @data relating to the given object in the given
570 * @cat: category to use
571 * @...: printf-style message to output
573 * Output an error message in the given category.
577 * @cat: category to use
578 * @...: printf-style message to output
580 * Output an warning message in the given category.
584 * @cat: category to use
585 * @...: printf-style message to output
587 * Output an informational message in the given category.
591 * @cat: category to use
592 * @...: printf-style message to output
594 * Output an debugging message in the given category.
598 * @cat: category to use
599 * @...: printf-style message to output
601 * Output an logging message in the given category.
605 * @cat: category to use
606 * @...: printf-style message to output
608 * Output an fixme message in the given category.
614 * @cat: category to use
615 * @msg: message string to log with the data
616 * @data: pointer to the data to output
617 * @length: length of the data to output
619 * Output a hexdump of @data in the given category.
627 * @obj: the #GObject the message belongs to
628 * @...: printf-style message to output
630 * Output an error message belonging to the given object in the default category.
633 * GST_WARNING_OBJECT:
634 * @obj: the #GObject the message belongs to
635 * @...: printf-style message to output
637 * Output a warning message belonging to the given object in the default category.
641 * @obj: the #GObject the message belongs to
642 * @...: printf-style message to output
644 * Output an informational message belonging to the given object in the default
649 * @obj: the #GObject the message belongs to
650 * @...: printf-style message to output
652 * Output a debugging message belonging to the given object in the default
657 * @obj: the #GObject the message belongs to
658 * @...: printf-style message to output
660 * Output a logging message belonging to the given object in the default category.
664 * @obj: the #GObject the message belongs to
665 * @...: printf-style message to output
667 * Output a logging message belonging to the given object in the default category.
672 * GST_MEMDUMP_OBJECT:
673 * @obj: the #GObject the message belongs to
674 * @msg: message string to log with the data
675 * @data: pointer to the data to output
676 * @length: length of the data to output
678 * Output a logging message belonging to the given object in the default category.
686 * @...: printf-style message to output
688 * Output an error message in the default category.
692 * @...: printf-style message to output
694 * Output a warning message in the default category.
698 * @...: printf-style message to output
700 * Output an informational message in the default category.
704 * @...: printf-style message to output
706 * Output a debugging message in the default category.
710 * @...: printf-style message to output
712 * Output a logging message in the default category.
716 * @...: printf-style message to output
718 * Output a fixme message in the default category.
724 * @msg: message string to log with the data
725 * @data: pointer to the data to output
726 * @length: length of the data to output
728 * Output a hexdump of @data.
733 #ifdef G_HAVE_ISO_VARARGS
735 #define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
736 #define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
737 #define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
738 #define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
739 #define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
740 #define GST_CAT_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__)
742 #define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
743 #define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
744 #define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
745 #define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
746 #define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
747 #define GST_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
749 #define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
750 #define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
751 #define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
752 #define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
753 #define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
754 #define GST_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__)
756 #define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
757 #define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
758 #define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
759 #define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
760 #define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
761 #define GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
764 #ifdef G_HAVE_GNUC_VARARGS
766 #define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
767 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
768 #define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
769 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
770 #define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
771 #define GST_CAT_FIXME_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, ##args )
773 #define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
774 #define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
775 #define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
776 #define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
777 #define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
778 #define GST_CAT_FIXME(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, ##args )
780 #define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
781 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
782 #define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
783 #define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
784 #define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
785 #define GST_FIXME_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, ##args )
787 #define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
788 #define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
789 #define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
790 #define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
791 #define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
792 #define GST_FIXME(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, ##args )
795 /* no variadic macros, use inline */
797 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
802 va_start (varargs, format);
803 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
808 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
809 const char *format, ...)
813 va_start (varargs, format);
814 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
819 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
824 va_start (varargs, format);
825 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
830 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
835 va_start (varargs, format);
836 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
841 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
846 va_start (varargs, format);
847 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
852 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
857 va_start (varargs, format);
858 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
863 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
867 va_start (varargs, format);
868 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
873 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
877 va_start (varargs, format);
878 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
883 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
887 va_start (varargs, format);
888 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
893 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
897 va_start (varargs, format);
898 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
903 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
907 va_start (varargs, format);
908 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
913 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
917 va_start (varargs, format);
918 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
923 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
927 va_start (varargs, format);
928 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
934 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
938 va_start (varargs, format);
939 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
945 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
949 va_start (varargs, format);
950 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
956 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
960 va_start (varargs, format);
961 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
967 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
971 va_start (varargs, format);
972 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
978 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
982 va_start (varargs, format);
983 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
989 GST_ERROR (const char *format, ...)
993 va_start (varargs, format);
994 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
1000 GST_WARNING (const char *format, ...)
1004 va_start (varargs, format);
1005 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
1011 GST_INFO (const char *format, ...)
1015 va_start (varargs, format);
1016 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
1022 GST_DEBUG (const char *format, ...)
1026 va_start (varargs, format);
1027 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
1033 GST_LOG (const char *format, ...)
1037 va_start (varargs, format);
1038 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
1044 GST_FIXME (const char *format, ...)
1048 va_start (varargs, format);
1049 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
1057 /********** function pointer stuff **********/
1059 typedef void (* GstDebugFuncPtr) (void);
1060 void _gst_debug_register_funcptr (GstDebugFuncPtr func,
1061 const gchar * ptrname);
1062 G_CONST_RETURN gchar *
1063 _gst_debug_nameof_funcptr (GstDebugFuncPtr func);
1066 * GST_DEBUG_FUNCPTR:
1067 * @ptr: pointer to the function to register
1069 * Register a pointer to a function with its name, so it can later be used by
1070 * GST_DEBUG_FUNCPTR_NAME().
1072 #define GST_DEBUG_FUNCPTR(ptr) \
1073 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1076 * GST_DEBUG_FUNCPTR_NAME:
1077 * @ptr: address of the function of which to look up the name
1079 * Retrieves the name of the function, if it was previously registered with
1080 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
1082 * This macro returns a constant string which must not be modified or
1083 * freed by the caller.
1085 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
1086 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1089 #else /* GST_DISABLE_GST_DEBUG */
1094 #if defined(__GNUC__) && __GNUC__ >= 3
1095 # pragma GCC poison gst_debug_log
1096 # pragma GCC poison gst_debug_log_valist
1097 # pragma GCC poison _gst_debug_category_new
1100 #define __gst_debug_min GST_LEVEL_NONE
1102 #define _gst_debug_init() /* NOP */
1104 #define gst_debug_set_default_threshold(level) /* NOP */
1105 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
1107 #define gst_debug_level_get_name(level) ("NONE")
1108 #define gst_debug_message_get(message) ("")
1109 #define gst_debug_add_log_function(func,data) /* NOP */
1110 guint gst_debug_remove_log_function (GstLogFunction func);
1111 guint gst_debug_remove_log_function_by_data (gpointer data);
1112 #define gst_debug_set_active(active) /* NOP */
1113 #define gst_debug_is_active() (FALSE)
1114 #define gst_debug_set_colored(colored) /* NOP */
1115 #define gst_debug_is_colored() (FALSE)
1116 #define gst_debug_set_default_threshold(level) /* NOP */
1117 #define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
1118 #define gst_debug_set_threshold_for_name(name,level) /* NOP */
1119 #define gst_debug_unset_threshold_for_name(name) /* NOP */
1121 #define GST_DEBUG_CATEGORY(var) /* NOP */
1122 #define GST_DEBUG_CATEGORY_EXTERN(var) /* NOP */
1123 #if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
1124 #define GST_DEBUG_CATEGORY_STATIC(var) static GstDebugCategory *var = NULL
1126 #define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
1128 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
1129 #define gst_debug_category_free(category) /* NOP */
1130 #define gst_debug_category_set_threshold(category,level) /* NOP */
1131 #define gst_debug_category_reset_threshold(category) /* NOP */
1132 #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
1133 #define gst_debug_category_get_name(cat) ("")
1134 #define gst_debug_category_get_color(cat) (0)
1135 #define gst_debug_category_get_description(cat) ("")
1136 #define gst_debug_get_all_categories() (NULL)
1137 #define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
1138 #define gst_debug_construct_win_color(colorinfo) (0)
1140 #endif /* !GST_INFO_C */
1142 #ifdef G_HAVE_ISO_VARARGS
1144 #define GST_CAT_LEVEL_LOG(cat,level,...) /* NOP */
1146 #define GST_CAT_ERROR_OBJECT(...) /* NOP */
1147 #define GST_CAT_WARNING_OBJECT(...) /* NOP */
1148 #define GST_CAT_INFO_OBJECT(...) /* NOP */
1149 #define GST_CAT_DEBUG_OBJECT(...) /* NOP */
1150 #define GST_CAT_LOG_OBJECT(...) /* NOP */
1151 #define GST_CAT_FIXME_OBJECT(...) /* NOP */
1153 #define GST_CAT_ERROR(...) /* NOP */
1154 #define GST_CAT_WARNING(...) /* NOP */
1155 #define GST_CAT_INFO(...) /* NOP */
1156 #define GST_CAT_DEBUG(...) /* NOP */
1157 #define GST_CAT_LOG(...) /* NOP */
1158 #define GST_CAT_FIXME(...) /* NOP */
1160 #define GST_ERROR_OBJECT(...) /* NOP */
1161 #define GST_WARNING_OBJECT(...) /* NOP */
1162 #define GST_INFO_OBJECT(...) /* NOP */
1163 #define GST_DEBUG_OBJECT(...) /* NOP */
1164 #define GST_LOG_OBJECT(...) /* NOP */
1165 #define GST_FIXME_OBJECT(...) /* NOP */
1167 #define GST_ERROR(...) /* NOP */
1168 #define GST_WARNING(...) /* NOP */
1169 #define GST_INFO(...) /* NOP */
1170 #define GST_DEBUG(...) /* NOP */
1171 #define GST_LOG(...) /* NOP */
1172 #define GST_FIXME(...) /* NOP */
1174 #else /* !G_HAVE_ISO_VARARGS */
1175 #ifdef G_HAVE_GNUC_VARARGS
1177 #define GST_CAT_LEVEL_LOG(cat,level,args...) /* NOP */
1179 #define GST_CAT_ERROR_OBJECT(args...) /* NOP */
1180 #define GST_CAT_WARNING_OBJECT(args...) /* NOP */
1181 #define GST_CAT_INFO_OBJECT(args...) /* NOP */
1182 #define GST_CAT_DEBUG_OBJECT(args...) /* NOP */
1183 #define GST_CAT_LOG_OBJECT(args...) /* NOP */
1184 #define GST_CAT_FIXME_OBJECT(args...) /* NOP */
1186 #define GST_CAT_ERROR(args...) /* NOP */
1187 #define GST_CAT_WARNING(args...) /* NOP */
1188 #define GST_CAT_INFO(args...) /* NOP */
1189 #define GST_CAT_DEBUG(args...) /* NOP */
1190 #define GST_CAT_LOG(args...) /* NOP */
1191 #define GST_CAT_FIXME(args...) /* NOP */
1193 #define GST_ERROR_OBJECT(args...) /* NOP */
1194 #define GST_WARNING_OBJECT(args...) /* NOP */
1195 #define GST_INFO_OBJECT(args...) /* NOP */
1196 #define GST_DEBUG_OBJECT(args...) /* NOP */
1197 #define GST_LOG_OBJECT(args...) /* NOP */
1198 #define GST_FIXME_OBJECT(args...) /* NOP */
1200 #define GST_ERROR(args...) /* NOP */
1201 #define GST_WARNING(args...) /* NOP */
1202 #define GST_INFO(args...) /* NOP */
1203 #define GST_DEBUG(args...) /* NOP */
1204 #define GST_LOG(args...) /* NOP */
1205 #define GST_FIXME(args...) /* NOP */
1207 #else /* !G_HAVE_GNUC_VARARGS */
1209 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1210 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1215 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1221 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1222 const char *format, ...)
1227 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1233 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1239 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1245 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1251 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1256 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1261 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1266 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1271 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1276 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1281 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1286 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1291 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1296 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1301 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1306 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1311 GST_ERROR (const char *format, ...)
1316 GST_WARNING (const char *format, ...)
1321 GST_INFO (const char *format, ...)
1326 GST_DEBUG (const char *format, ...)
1331 GST_LOG (const char *format, ...)
1336 GST_FIXME (const char *format, ...)
1340 #endif /* G_HAVE_GNUC_VARARGS */
1341 #endif /* G_HAVE_ISO_VARARGS */
1343 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1344 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1346 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) /* NOP */
1347 #define GST_CAT_MEMDUMP(cat,msg,data,length) /* NOP */
1348 #define GST_MEMDUMP_OBJECT(obj,msg,data,length) /* NOP */
1349 #define GST_MEMDUMP(msg,data,length) /* NOP */
1351 #endif /* GST_DISABLE_GST_DEBUG */
1354 void gst_debug_print_stack_trace (void);
1358 #endif /* __GSTINFO_H__ */