docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
[platform/upstream/gstreamer.git] / gst / gstinfo.h
1 /* GStreamer
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>
5  *
6  * gstinfo.h: debugging functions
7  *
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.
12  *
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.
17  *
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., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23
24 #ifndef __GSTINFO_H__
25 #define __GSTINFO_H__
26
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <gst/gstconfig.h>
30
31 G_BEGIN_DECLS
32
33 /**
34  * GstDebugLevel:
35  * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
36  *  debugging output.
37  * @GST_LEVEL_ERROR: Error messages are to be used only when an error occurred
38  *  that stops the application from keeping working correctly.
39  *  An examples is gst_element_error, which outputs a message with this priority.
40  *  It does not mean that the application is terminating as with g_error.
41  * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
42  *  that could lead to problems or weird behaviour later on. An example of this
43  *  would be clocking issues ("your computer is pretty slow") or broken input
44  *  data ("Can't synchronize to stream.")
45  * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
46  *  in the executed code path is not fully implemented or handled yet. Note
47  *  that this does not replace proper error handling in any way, the purpose
48  *  of this message is to make it easier to spot incomplete/unfinished pieces
49  *  of code when reading the debug log.
50  * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
51  *  updated about what is happening.
52  *  Examples where this should be used are when a typefind function has
53  *  successfully determined the type of the stream or when an mp3 plugin detects
54  *  the format to be used. ("This file has mono sound.")
55  * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
56  *  happens that is not the expected default behavior, or something that's
57  *  useful to know but doesn't happen all the time (ie. per loop iteration or
58  *  buffer processed or event handled).
59  *  An example would be notifications about state changes or receiving/sending
60  *  of events.
61  * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
62  *  useful to know. As a rule of thumb a pipeline that is iterating as expected
63  *  should never output anything else but LOG messages. Use this log level to
64  *  log recurring information in chain functions and loop functions, for
65  *  example.
66  * @GST_LEVEL_TRACE: Tracing-related messages.
67  *  Examples for this are referencing/dereferencing of objects.
68  * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
69  *  data as memory dumps in the log. They will be displayed as hexdump with
70  *  ASCII characters.
71  * @GST_LEVEL_COUNT: The number of defined debugging levels.
72  *
73  * The level defines the importance of a debugging message. The more important a
74  * message is, the greater the probability that the debugging system outputs it.
75  */
76 typedef enum {
77   GST_LEVEL_NONE = 0,
78   GST_LEVEL_ERROR = 1,
79   GST_LEVEL_WARNING = 2,
80   GST_LEVEL_FIXME = 3,
81   GST_LEVEL_INFO = 4,
82   GST_LEVEL_DEBUG = 5,
83   GST_LEVEL_LOG = 6,
84   GST_LEVEL_TRACE = 7,
85   /* add more */
86   GST_LEVEL_MEMDUMP = 9,
87   /* add more */
88   GST_LEVEL_COUNT
89 } GstDebugLevel;
90
91 /**
92  * GST_LEVEL_DEFAULT:
93  *
94  * Defines the default debugging level to be used with GStreamer. It is normally
95  * set to #GST_LEVEL_NONE so nothing get printed.
96  * As it can be configured at compile time, developer builds may chose to
97  * override that though.
98  * You can use this as an argument to gst_debug_set_default_threshold() to
99  * reset the debugging output to default behaviour.
100  */
101 #ifndef GST_LEVEL_DEFAULT
102 #define GST_LEVEL_DEFAULT GST_LEVEL_NONE
103 #endif
104
105 /* defines for format (colors etc)
106  * don't change them around, it uses terminal layout
107  * Terminal color strings:
108  * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
109  * Text color codes:
110  * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
111  * Background color codes:
112  * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
113  */
114 /**
115  * GstDebugColorFlags:
116  * @GST_DEBUG_FG_BLACK: Use black as foreground color.
117  * @GST_DEBUG_FG_RED: Use red as foreground color.
118  * @GST_DEBUG_FG_GREEN: Use green as foreground color.
119  * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
120  * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
121  * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
122  * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
123  * @GST_DEBUG_FG_WHITE: Use white as foreground color.
124  * @GST_DEBUG_BG_BLACK: Use black as background color.
125  * @GST_DEBUG_BG_RED: Use red as background color.
126  * @GST_DEBUG_BG_GREEN: Use green as background color.
127  * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
128  * @GST_DEBUG_BG_BLUE: Use blue as background color.
129  * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
130  * @GST_DEBUG_BG_CYAN: Use cyan as background color.
131  * @GST_DEBUG_BG_WHITE: Use white as background color.
132  * @GST_DEBUG_BOLD: Make the output bold.
133  * @GST_DEBUG_UNDERLINE: Underline the output.
134  *
135  * These are some terminal style flags you can use when creating your
136  * debugging categories to make them stand out in debugging output.
137  */
138 typedef enum {
139   /* colors */
140   GST_DEBUG_FG_BLACK            = 0x0000,
141   GST_DEBUG_FG_RED              = 0x0001,
142   GST_DEBUG_FG_GREEN            = 0x0002,
143   GST_DEBUG_FG_YELLOW           = 0x0003,
144   GST_DEBUG_FG_BLUE             = 0x0004,
145   GST_DEBUG_FG_MAGENTA          = 0x0005,
146   GST_DEBUG_FG_CYAN             = 0x0006,
147   GST_DEBUG_FG_WHITE            = 0x0007,
148   /* background colors */
149   GST_DEBUG_BG_BLACK            = 0x0000,
150   GST_DEBUG_BG_RED              = 0x0010,
151   GST_DEBUG_BG_GREEN            = 0x0020,
152   GST_DEBUG_BG_YELLOW           = 0x0030,
153   GST_DEBUG_BG_BLUE             = 0x0040,
154   GST_DEBUG_BG_MAGENTA          = 0x0050,
155   GST_DEBUG_BG_CYAN             = 0x0060,
156   GST_DEBUG_BG_WHITE            = 0x0070,
157   /* other formats */
158   GST_DEBUG_BOLD                = 0x0100,
159   GST_DEBUG_UNDERLINE           = 0x0200
160 } GstDebugColorFlags;
161
162 /**
163  * GstDebugColorMode:
164  * @GST_DEBUG_COLOR_MODE_OFF: Do not use colors in logs.
165  * @GST_DEBUG_COLOR_MODE_ON: Paint logs in a platform-specific way.
166  * @GST_DEBUG_COLOR_MODE_UNIX: Paint logs with UNIX terminal color codes
167  *                             no matter what platform GStreamer is running on.
168  */
169 typedef enum {
170   GST_DEBUG_COLOR_MODE_OFF  = 0,
171   GST_DEBUG_COLOR_MODE_ON   = 1,
172   GST_DEBUG_COLOR_MODE_UNIX = 2
173 } GstDebugColorMode;
174
175
176 #define GST_DEBUG_FG_MASK       (0x000F)
177 #define GST_DEBUG_BG_MASK       (0x00F0)
178 #define GST_DEBUG_FORMAT_MASK   (0xFF00)
179
180 typedef struct _GstDebugCategory GstDebugCategory;
181 /**
182  * GstDebugCategory:
183  *
184  * This is the struct that describes the categories. Once initialized with
185  * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
186  */
187 struct _GstDebugCategory {
188   /*< private >*/
189   gint                  threshold;
190   guint                 color;          /* see defines above */
191
192   const gchar *         name;
193   const gchar *         description;
194 };
195
196 /********** some convenience macros for debugging **********/
197
198 /**
199  * GST_STR_NULL:
200  * @str: The string to check.
201  *
202  * Macro to use when a string must not be %NULL, but may be %NULL. If the string
203  * is %NULL, "(NULL)" is printed instead.
204  * In GStreamer printf string arguments may not be %NULL, because on some
205  * platforms (ie Solaris) the libc crashes in that case. This includes debugging
206  * strings.
207  */
208 #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
209
210 /* FIXME, not MT safe */
211 /**
212  * GST_DEBUG_PAD_NAME:
213  * @pad: The pad to debug.
214  *
215  * Evaluates to 2 strings, that describe the pad. Often used in debugging
216  * statements.
217  */
218 #define GST_DEBUG_PAD_NAME(pad) \
219   (pad != NULL) ?  \
220   ((GST_OBJECT_PARENT(pad) != NULL) ? \
221   GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
222   "''" ) : "''", \
223   (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
224
225 /**
226  * GST_FUNCTION:
227  *
228  * This macro should evaluate to the name of the current function and be should
229  * be defined when configuring your project, as it is compiler dependant. If it
230  * is not defined, some default value is used. It is used to provide debugging
231  * output with the function name of the message.
232  *
233  * Note that this is different from G_STRFUNC as we do not want the full
234  * function signature in C++ code.
235  */
236 #ifndef GST_FUNCTION
237 #if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
238 #  define GST_FUNCTION     ((const char*) (__FUNCTION__))
239 #elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
240 #  define GST_FUNCTION     ((const char*) (__func__))
241 #else
242 #  define GST_FUNCTION     ((const char*) ("???"))
243 #endif
244 #endif /* ifndef GST_FUNCTION */
245
246 /**
247  * GST_PTR_FORMAT:
248  *
249  * printf format type used to debug GStreamer types.
250  * This can only be used on types whose size is >= sizeof(gpointer).
251  */
252 #define GST_PTR_FORMAT     "p\aA"
253
254 /**
255  * GST_SEGMENT_FORMAT:
256  *
257  * printf format type used to debug GStreamer segments.
258  * This can only be used on pointers to GstSegment structures.
259  */
260 #define GST_SEGMENT_FORMAT "p\aB"
261
262 typedef struct _GstDebugMessage GstDebugMessage;
263
264 /**
265  * GstLogFunction:
266  * @category: a #GstDebugCategory
267  * @level: a #GstDebugLevel
268  * @file: file name
269  * @function: function name
270  * @line: line number
271  * @object: a #GObject
272  * @message: the message
273  * @user_data: user data for the log function
274  *
275  * Function prototype for a logging function that can be registered with
276  * gst_debug_add_log_function().
277  * Use G_GNUC_NO_INSTRUMENT on that function.
278  */
279 typedef void (*GstLogFunction)  (GstDebugCategory * category,
280                                  GstDebugLevel      level,
281                                  const gchar      * file,
282                                  const gchar      * function,
283                                  gint               line,
284                                  GObject          * object,
285                                  GstDebugMessage  * message,
286                                  gpointer           user_data);
287
288 void                gst_debug_log            (GstDebugCategory * category,
289                                           GstDebugLevel      level,
290                                           const gchar      * file,
291                                           const gchar      * function,
292                                           gint               line,
293                                           GObject          * object,
294                                           const gchar      * format,
295                                           ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
296
297 void            gst_debug_log_valist     (GstDebugCategory * category,
298                                           GstDebugLevel      level,
299                                           const gchar      * file,
300                                           const gchar      * function,
301                                           gint                line,
302                                           GObject          * object,
303                                           const gchar      * format,
304                                           va_list            args) G_GNUC_NO_INSTRUMENT;
305
306 /* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro */
307 GstDebugCategory *_gst_debug_category_new (const gchar * name,
308                                            guint         color,
309                                            const gchar * description);
310 /* do not use this function, use the GST_DEBUG_CATEGORY_GET macro */
311 GstDebugCategory *_gst_debug_get_category (const gchar *name);
312
313
314 /* do not use this function, use the GST_CAT_MEMDUMP_* macros */
315 void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
316     const gchar * func, gint line, GObject * obj, const gchar * msg,
317     const guint8 * data, guint length);
318
319 /* we define this to avoid a compiler warning regarding a cast from a function
320  * pointer to a void pointer
321  * (see https://bugzilla.gnome.org/show_bug.cgi?id=309253)
322  */
323 typedef void (* GstDebugFuncPtr)        (void);
324
325 /* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
326 void    _gst_debug_register_funcptr     (GstDebugFuncPtr        func,
327                                          const gchar *          ptrname);
328 const gchar *
329         _gst_debug_nameof_funcptr       (GstDebugFuncPtr        func) G_GNUC_NO_INSTRUMENT;
330
331
332 const gchar   * gst_debug_message_get    (GstDebugMessage  * message);
333
334 void            gst_debug_log_default    (GstDebugCategory * category,
335                                           GstDebugLevel      level,
336                                           const gchar      * file,
337                                           const gchar      * function,
338                                           gint               line,
339                                           GObject          * object,
340                                           GstDebugMessage  * message,
341                                           gpointer           unused) G_GNUC_NO_INSTRUMENT;
342
343 const gchar *   gst_debug_level_get_name (GstDebugLevel level);
344
345 void            gst_debug_add_log_function            (GstLogFunction func,
346                                                        gpointer       user_data,
347                                                        GDestroyNotify notify);
348
349 guint           gst_debug_remove_log_function         (GstLogFunction func);
350 guint           gst_debug_remove_log_function_by_data (gpointer       data);
351
352 void            gst_debug_set_active  (gboolean active);
353 gboolean        gst_debug_is_active   (void);
354
355 void            gst_debug_set_colored (gboolean colored);
356 void            gst_debug_set_color_mode   (GstDebugColorMode mode);
357 void            gst_debug_set_color_mode_from_string (const gchar * mode);
358 gboolean        gst_debug_is_colored  (void);
359 GstDebugColorMode gst_debug_get_color_mode (void);
360
361 void            gst_debug_set_default_threshold      (GstDebugLevel level);
362 GstDebugLevel   gst_debug_get_default_threshold      (void);
363 void            gst_debug_set_threshold_for_name     (const gchar * name,
364                                                       GstDebugLevel level);
365 void            gst_debug_set_threshold_from_string  (const gchar * list, gboolean reset);
366 void            gst_debug_unset_threshold_for_name   (const gchar * name);
367
368
369 void            gst_debug_category_free              (GstDebugCategory *        category);
370 void                gst_debug_category_set_threshold     (GstDebugCategory *    category,
371                                                       GstDebugLevel             level);
372 void            gst_debug_category_reset_threshold   (GstDebugCategory *        category);
373 GstDebugLevel   gst_debug_category_get_threshold     (GstDebugCategory *        category);
374 const gchar *   gst_debug_category_get_name          (GstDebugCategory *        category);
375 guint           gst_debug_category_get_color         (GstDebugCategory *        category);
376 const gchar *   gst_debug_category_get_description   (GstDebugCategory *        category);
377 GSList *        gst_debug_get_all_categories    (void);
378
379
380 gchar * gst_debug_construct_term_color (guint colorinfo);
381 gint    gst_debug_construct_win_color  (guint colorinfo);
382
383
384 #ifndef GST_DISABLE_GST_DEBUG
385
386 #define gst_debug_add_log_function(func,data,notify) \
387 G_STMT_START{                                        \
388   if (func == gst_debug_log_default) {               \
389     gst_debug_add_log_function(NULL,data,notify);    \
390   } else {                                           \
391     gst_debug_add_log_function(func,data,notify);    \
392   }                                                  \
393 }G_STMT_END
394
395 #define gst_debug_remove_log_function(func)   \
396     (func == gst_debug_log_default) ?         \
397         gst_debug_remove_log_function(NULL) : \
398         gst_debug_remove_log_function(func)
399
400 /**
401  * GST_DEBUG_CATEGORY:
402  * @cat: the category
403  *
404  * Defines a GstDebugCategory variable.
405  * This macro expands to nothing if debugging is disabled.
406  */
407 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
408 /**
409  * GST_DEBUG_CATEGORY_EXTERN:
410  * @cat: the category
411  *
412  * Declares a GstDebugCategory variable as extern. Use in header files.
413  * This macro expands to nothing if debugging is disabled.
414  */
415 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
416
417 /**
418  * GST_DEBUG_CATEGORY_STATIC:
419  * @cat: the category
420  *
421  * Defines a static GstDebugCategory variable.
422  * This macro expands to nothing if debugging is disabled.
423  */
424 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
425
426 /**
427  * GST_DEBUG_CATEGORY_INIT:
428  * @cat: the category to initialize.
429  * @name: the name of the category.
430  * @color: the colors to use for a color representation or 0 for no color.
431  * @description: optional description of the category.
432  *
433  * Initializes a new #GstDebugCategory with the given properties and set to
434  * the default threshold.
435  *
436  * <note>
437  * <para>
438  * This macro expands to nothing if debugging is disabled.
439  * </para>
440  * <para>
441  * When naming your category, please follow the following conventions to ensure
442  * that the pattern matching for categories works as expected. It is not
443  * earth-shattering if you don't follow these conventions, but it would be nice
444  * for everyone.
445  * </para>
446  * <para>
447  * If you define a category for a plugin or a feature of it, name the category
448  * like the feature. So if you wanted to write a "filesrc" element, you would
449  * name the category "filesrc". Use lowercase letters only.
450  * If you define more than one category for the same element, append an
451  * underscore and an identifier to your categories, like this: "filesrc_cache"
452  * </para>
453  * <para>
454  * If you create a library or an application using debugging categories, use a
455  * common prefix followed by an underscore for all your categories. GStreamer
456  * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
457  * to include uppercase letters.
458  * </para>
459  * </note>
460  */
461 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
462   if (cat == NULL)                                                      \
463     cat = _gst_debug_category_new (name,color,description);             \
464 }G_STMT_END
465
466 /**
467  * GST_DEBUG_CATEGORY_GET:
468  * @cat: the category to initialize.
469  * @name: log category name
470  *
471  * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the
472  * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
473  * @cat. Otherwise @cat will be %NULL.
474  *
475  * |[
476  * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
477  * #define GST_CAT_DEFAULT gst_myplugin_debug
478  * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
479  * ...
480  * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
481  * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
482  * ]|
483  */
484 #ifdef GST_CAT_DEFAULT
485 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
486   cat = _gst_debug_get_category (name);                 \
487   if (!cat) {                                           \
488     cat = GST_CAT_DEFAULT;                              \
489   }                                                     \
490 }G_STMT_END
491 #else
492 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
493   cat = _gst_debug_get_category (name);                 \
494 }G_STMT_END
495 #endif
496
497 /**
498  * GST_CAT_DEFAULT:
499  *
500  * Default gstreamer core debug log category. Please define your own.
501  */
502 GST_EXPORT GstDebugCategory *   GST_CAT_DEFAULT;
503 /* this symbol may not be used */
504 GST_EXPORT gboolean                     _gst_debug_enabled;
505
506 /* the min debug level, used for quickly discarding debug
507  * messages that fall under the threshold. */
508 GST_EXPORT GstDebugLevel            _gst_debug_min;
509
510 /**
511  * GST_CAT_LEVEL_LOG:
512  * @cat: category to use
513  * @level: the severity of the message
514  * @object: (allow-none): the #GObject the message belongs to or %NULL if none
515  * @...: A printf-style message to output
516  *
517  * Outputs a debugging message. This is the most general macro for outputting
518  * debugging messages. You will probably want to use one of the ones described
519  * below.
520  */
521 #ifdef G_HAVE_ISO_VARARGS
522 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{           \
523   if (G_UNLIKELY (level <= _gst_debug_min)) {                                           \
524     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,    \
525         (GObject *) (object), __VA_ARGS__);                             \
526   }                                                                     \
527 }G_STMT_END
528 #else /* G_HAVE_GNUC_VARARGS */
529 #ifdef G_HAVE_GNUC_VARARGS
530 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{       \
531   if (G_UNLIKELY (level <= _gst_debug_min)) {                                           \
532     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,    \
533         (GObject *) (object), ##args );                                 \
534   }                                                                     \
535 }G_STMT_END
536 #else /* no variadic macros, use inline */
537 static inline void
538 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
539     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
540 {
541   if (G_UNLIKELY (level <= _gst_debug_min)) {
542     gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
543         varargs);
544   }
545 }
546
547 static inline void
548 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
549     gpointer object, const char *format, ...)
550 {
551   va_list varargs;
552
553   va_start (varargs, format);
554   GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
555   va_end (varargs);
556 }
557 #endif
558 #endif /* G_HAVE_ISO_VARARGS */
559
560 /* This one doesn't have varargs in the macro, so it's different than all the
561  * other macros and hence in a separate block right here. Docs chunks are
562  * with the other doc chunks below though. */
563 #define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{       \
564   if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= _gst_debug_min)) {                    \
565     _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__,             \
566         (GObject *) (object), (msg), (data), (length));                       \
567   }                                                                           \
568 }G_STMT_END
569
570 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length)  \
571     __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
572 #define GST_CAT_MEMDUMP(cat,msg,data,length)             \
573     __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
574 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)          \
575     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
576 #define GST_MEMDUMP(msg,data,length)                     \
577     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
578
579 /**
580  * GST_CAT_ERROR_OBJECT:
581  * @cat: category to use
582  * @obj: the #GObject the message belongs to
583  * @...: printf-style message to output
584  *
585  * Output an error message belonging to the given object in the given category.
586  */
587 /**
588  * GST_CAT_WARNING_OBJECT:
589  * @cat: category to use
590  * @obj: the #GObject the message belongs to
591  * @...: printf-style message to output
592  *
593  * Output a warning message belonging to the given object in the given category.
594  */
595 /**
596  * GST_CAT_INFO_OBJECT:
597  * @cat: category to use
598  * @obj: the #GObject the message belongs to
599  * @...: printf-style message to output
600  *
601  * Output an informational message belonging to the given object in the given
602  * category.
603  */
604 /**
605  * GST_CAT_DEBUG_OBJECT:
606  * @cat: category to use
607  * @obj: the #GObject the message belongs to
608  * @...: printf-style message to output
609  *
610  * Output an debugging message belonging to the given object in the given category.
611  */
612 /**
613  * GST_CAT_LOG_OBJECT:
614  * @cat: category to use
615  * @obj: the #GObject the message belongs to
616  * @...: printf-style message to output
617  *
618  * Output an logging message belonging to the given object in the given category.
619  */
620 /**
621  * GST_CAT_FIXME_OBJECT:
622  * @cat: category to use
623  * @obj: the #GObject the message belongs to
624  * @...: printf-style message to output
625  *
626  * Output a fixme message belonging to the given object in the given category.
627  */
628 /**
629  * GST_CAT_TRACE_OBJECT:
630  * @cat: category to use
631  * @obj: the #GObject the message belongs to
632  * @...: printf-style message to output
633  *
634  * Output a tracing message belonging to the given object in the given
635  * category.
636  */
637 /**
638  * GST_CAT_MEMDUMP_OBJECT:
639  * @cat: category to use
640  * @obj: the #GObject the message belongs to
641  * @msg: message string to log with the data
642  * @data: pointer to the data to output
643  * @length: length of the data to output
644  *
645  * Output a hexdump of @data relating to the given object in the given
646  * category.
647  */
648
649
650 /**
651  * GST_CAT_ERROR:
652  * @cat: category to use
653  * @...: printf-style message to output
654  *
655  * Output an error message in the given category.
656  */
657 /**
658  * GST_CAT_WARNING:
659  * @cat: category to use
660  * @...: printf-style message to output
661  *
662  * Output an warning message in the given category.
663  */
664 /**
665  * GST_CAT_INFO:
666  * @cat: category to use
667  * @...: printf-style message to output
668  *
669  * Output an informational message in the given category.
670  */
671 /**
672  * GST_CAT_DEBUG:
673  * @cat: category to use
674  * @...: printf-style message to output
675  *
676  * Output an debugging message in the given category.
677  */
678 /**
679  * GST_CAT_LOG:
680  * @cat: category to use
681  * @...: printf-style message to output
682  *
683  * Output an logging message in the given category.
684  */
685 /**
686  * GST_CAT_FIXME:
687  * @cat: category to use
688  * @...: printf-style message to output
689  *
690  * Output an fixme message in the given category.
691  */
692 /**
693  * GST_CAT_TRACE:
694  * @cat: category to use
695  * @...: printf-style message to output
696  *
697  * Output a tracing message in the given category.
698  */
699 /**
700  * GST_CAT_MEMDUMP:
701  * @cat: category to use
702  * @msg: message string to log with the data
703  * @data: pointer to the data to output
704  * @length: length of the data to output
705  *
706  * Output a hexdump of @data in the given category.
707  */
708
709
710 /**
711  * GST_ERROR_OBJECT:
712  * @obj: the #GObject the message belongs to
713  * @...: printf-style message to output
714  *
715  * Output an error message belonging to the given object in the default category.
716  */
717 /**
718  * GST_WARNING_OBJECT:
719  * @obj: the #GObject the message belongs to
720  * @...: printf-style message to output
721  *
722  * Output a warning message belonging to the given object in the default category.
723  */
724 /**
725  * GST_INFO_OBJECT:
726  * @obj: the #GObject the message belongs to
727  * @...: printf-style message to output
728  *
729  * Output an informational message belonging to the given object in the default
730  * category.
731  */
732 /**
733  * GST_DEBUG_OBJECT:
734  * @obj: the #GObject the message belongs to
735  * @...: printf-style message to output
736  *
737  * Output a debugging message belonging to the given object in the default
738  * category.
739  */
740 /**
741  * GST_LOG_OBJECT:
742  * @obj: the #GObject the message belongs to
743  * @...: printf-style message to output
744  *
745  * Output a logging message belonging to the given object in the default category.
746  */
747 /**
748  * GST_FIXME_OBJECT:
749  * @obj: the #GObject the message belongs to
750  * @...: printf-style message to output
751  *
752  * Output a fixme message belonging to the given object in the default category.
753  */
754 /**
755  * GST_TRACE_OBJECT:
756  * @obj: the #GObject the message belongs to
757  * @...: printf-style message to output
758  *
759  * Output a tracing message belonging to the given object in the default category.
760  */
761 /**
762  * GST_MEMDUMP_OBJECT:
763  * @obj: the #GObject the message belongs to
764  * @msg: message string to log with the data
765  * @data: pointer to the data to output
766  * @length: length of the data to output
767  *
768  * Output a logging message belonging to the given object in the default category.
769  */
770
771
772 /**
773  * GST_ERROR:
774  * @...: printf-style message to output
775  *
776  * Output an error message in the default category.
777  */
778 /**
779  * GST_WARNING:
780  * @...: printf-style message to output
781  *
782  * Output a warning message in the default category.
783  */
784 /**
785  * GST_INFO:
786  * @...: printf-style message to output
787  *
788  * Output an informational message in the default category.
789  */
790 /**
791  * GST_DEBUG:
792  * @...: printf-style message to output
793  *
794  * Output a debugging message in the default category.
795  */
796 /**
797  * GST_LOG:
798  * @...: printf-style message to output
799  *
800  * Output a logging message in the default category.
801  */
802 /**
803  * GST_FIXME:
804  * @...: printf-style message to output
805  *
806  * Output a fixme message in the default category.
807  */
808 /**
809  * GST_TRACE:
810  * @...: printf-style message to output
811  *
812  * Output a tracing message in the default category.
813  */
814 /**
815  * GST_MEMDUMP:
816  * @msg: message string to log with the data
817  * @data: pointer to the data to output
818  * @length: length of the data to output
819  *
820  * Output a hexdump of @data.
821  */
822
823 #ifdef G_HAVE_ISO_VARARGS
824
825 #define GST_CAT_ERROR_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
826 #define GST_CAT_WARNING_OBJECT(cat,obj,...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
827 #define GST_CAT_INFO_OBJECT(cat,obj,...)        GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
828 #define GST_CAT_DEBUG_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
829 #define GST_CAT_LOG_OBJECT(cat,obj,...)         GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
830 #define GST_CAT_FIXME_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
831 #define GST_CAT_TRACE_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
832
833 #define GST_CAT_ERROR(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
834 #define GST_CAT_WARNING(cat,...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
835 #define GST_CAT_INFO(cat,...)                   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
836 #define GST_CAT_DEBUG(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
837 #define GST_CAT_LOG(cat,...)                    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
838 #define GST_CAT_FIXME(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
839 #define GST_CAT_TRACE(cat,...)          GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
840
841 #define GST_ERROR_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
842 #define GST_WARNING_OBJECT(obj,...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
843 #define GST_INFO_OBJECT(obj,...)        GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
844 #define GST_DEBUG_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
845 #define GST_LOG_OBJECT(obj,...)         GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
846 #define GST_FIXME_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
847 #define GST_TRACE_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
848
849 #define GST_ERROR(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
850 #define GST_WARNING(...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
851 #define GST_INFO(...)                   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
852 #define GST_DEBUG(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
853 #define GST_LOG(...)                    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
854 #define GST_FIXME(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
855 #define GST_TRACE(...)          GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
856
857 #else
858 #ifdef G_HAVE_GNUC_VARARGS
859
860 #define GST_CAT_ERROR_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  ##args )
861 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  ##args )
862 #define GST_CAT_INFO_OBJECT(cat,obj,args...)    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  ##args )
863 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  ##args )
864 #define GST_CAT_LOG_OBJECT(cat,obj,args...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  ##args )
865 #define GST_CAT_FIXME_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  ##args )
866 #define GST_CAT_TRACE_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  ##args )
867
868 #define GST_CAT_ERROR(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, ##args )
869 #define GST_CAT_WARNING(cat,args...)            GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
870 #define GST_CAT_INFO(cat,args...)               GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, ##args )
871 #define GST_CAT_DEBUG(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, ##args )
872 #define GST_CAT_LOG(cat,args...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, ##args )
873 #define GST_CAT_FIXME(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, ##args )
874 #define GST_CAT_TRACE(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, ##args )
875
876 #define GST_ERROR_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  ##args )
877 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  ##args )
878 #define GST_INFO_OBJECT(obj,args...)    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  ##args )
879 #define GST_DEBUG_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  ##args )
880 #define GST_LOG_OBJECT(obj,args...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  ##args )
881 #define GST_FIXME_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  ##args )
882 #define GST_TRACE_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  ##args )
883
884 #define GST_ERROR(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, ##args )
885 #define GST_WARNING(args...)            GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
886 #define GST_INFO(args...)               GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, ##args )
887 #define GST_DEBUG(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, ##args )
888 #define GST_LOG(args...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, ##args )
889 #define GST_FIXME(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, ##args )
890 #define GST_TRACE(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, ##args )
891
892 #else
893 /* no variadic macros, use inline */
894 static inline void
895 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
896     ...)
897 {
898   va_list varargs;
899
900   va_start (varargs, format);
901   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
902   va_end (varargs);
903 }
904
905 static inline void
906 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
907     const char *format, ...)
908 {
909   va_list varargs;
910
911   va_start (varargs, format);
912   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
913   va_end (varargs);
914 }
915
916 static inline void
917 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
918     ...)
919 {
920   va_list varargs;
921
922   va_start (varargs, format);
923   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
924   va_end (varargs);
925 }
926
927 static inline void
928 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
929     ...)
930 {
931   va_list varargs;
932
933   va_start (varargs, format);
934   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
935   va_end (varargs);
936 }
937
938 static inline void
939 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
940     ...)
941 {
942   va_list varargs;
943
944   va_start (varargs, format);
945   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
946   va_end (varargs);
947 }
948
949 static inline void
950 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
951     ...)
952 {
953   va_list varargs;
954
955   va_start (varargs, format);
956   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
957   va_end (varargs);
958 }
959
960 static inline void
961 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
962     ...)
963 {
964   va_list varargs;
965
966   va_start (varargs, format);
967   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
968   va_end (varargs);
969 }
970
971 static inline void
972 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
973 {
974   va_list varargs;
975
976   va_start (varargs, format);
977   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
978   va_end (varargs);
979 }
980
981 static inline void
982 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
983 {
984   va_list varargs;
985
986   va_start (varargs, format);
987   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
988   va_end (varargs);
989 }
990
991 static inline void
992 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
993 {
994   va_list varargs;
995
996   va_start (varargs, format);
997   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
998   va_end (varargs);
999 }
1000
1001 static inline void
1002 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1003 {
1004   va_list varargs;
1005
1006   va_start (varargs, format);
1007   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
1008   va_end (varargs);
1009 }
1010
1011 static inline void
1012 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1013 {
1014   va_list varargs;
1015
1016   va_start (varargs, format);
1017   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
1018   va_end (varargs);
1019 }
1020
1021 static inline void
1022 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1023 {
1024   va_list varargs;
1025
1026   va_start (varargs, format);
1027   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
1028   va_end (varargs);
1029 }
1030
1031 static inline void
1032 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1033 {
1034   va_list varargs;
1035
1036   va_start (varargs, format);
1037   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
1038   va_end (varargs);
1039 }
1040
1041 static inline void
1042 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1043 {
1044   va_list varargs;
1045
1046   va_start (varargs, format);
1047   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
1048       varargs);
1049   va_end (varargs);
1050 }
1051
1052 static inline void
1053 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1054 {
1055   va_list varargs;
1056
1057   va_start (varargs, format);
1058   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
1059       varargs);
1060   va_end (varargs);
1061 }
1062
1063 static inline void
1064 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1065 {
1066   va_list varargs;
1067
1068   va_start (varargs, format);
1069   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
1070       varargs);
1071   va_end (varargs);
1072 }
1073
1074 static inline void
1075 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1076 {
1077   va_list varargs;
1078
1079   va_start (varargs, format);
1080   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
1081       varargs);
1082   va_end (varargs);
1083 }
1084
1085 static inline void
1086 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1087 {
1088   va_list varargs;
1089
1090   va_start (varargs, format);
1091   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
1092       varargs);
1093   va_end (varargs);
1094 }
1095
1096 static inline void
1097 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1098 {
1099   va_list varargs;
1100
1101   va_start (varargs, format);
1102   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
1103       varargs);
1104   va_end (varargs);
1105 }
1106
1107 static inline void
1108 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1109 {
1110   va_list varargs;
1111
1112   va_start (varargs, format);
1113   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
1114       varargs);
1115   va_end (varargs);
1116 }
1117
1118 static inline void
1119 GST_ERROR (const char *format, ...)
1120 {
1121   va_list varargs;
1122
1123   va_start (varargs, format);
1124   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
1125       varargs);
1126   va_end (varargs);
1127 }
1128
1129 static inline void
1130 GST_WARNING (const char *format, ...)
1131 {
1132   va_list varargs;
1133
1134   va_start (varargs, format);
1135   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
1136       varargs);
1137   va_end (varargs);
1138 }
1139
1140 static inline void
1141 GST_INFO (const char *format, ...)
1142 {
1143   va_list varargs;
1144
1145   va_start (varargs, format);
1146   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
1147       varargs);
1148   va_end (varargs);
1149 }
1150
1151 static inline void
1152 GST_DEBUG (const char *format, ...)
1153 {
1154   va_list varargs;
1155
1156   va_start (varargs, format);
1157   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
1158       varargs);
1159   va_end (varargs);
1160 }
1161
1162 static inline void
1163 GST_LOG (const char *format, ...)
1164 {
1165   va_list varargs;
1166
1167   va_start (varargs, format);
1168   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
1169       format, varargs);
1170   va_end (varargs);
1171 }
1172
1173 static inline void
1174 GST_FIXME (const char *format, ...)
1175 {
1176   va_list varargs;
1177
1178   va_start (varargs, format);
1179   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
1180       varargs);
1181   va_end (varargs);
1182 }
1183
1184 static inline void
1185 GST_TRACE (const char *format, ...)
1186 {
1187   va_list varargs;
1188
1189   va_start (varargs, format);
1190   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
1191       varargs);
1192   va_end (varargs);
1193 }
1194 #endif
1195 #endif
1196
1197
1198 /********** function pointer stuff **********/
1199
1200 /**
1201  * GST_DEBUG_REGISTER_FUNCPTR:
1202  * @ptr: pointer to the function to register
1203  *
1204  * Register a pointer to a function with its name, so it can later be used by
1205  * GST_DEBUG_FUNCPTR_NAME().
1206  *
1207  * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr.
1208  */
1209 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
1210   _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
1211 /**
1212  * GST_DEBUG_FUNCPTR:
1213  * @ptr: pointer to the function to register
1214  *
1215  * Register a pointer to a function with its name, so it can later be used by
1216  * GST_DEBUG_FUNCPTR_NAME().
1217  *
1218  * Returns: the value passed to @ptr.
1219  */
1220 #define GST_DEBUG_FUNCPTR(ptr) \
1221   (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1222
1223 /**
1224  * GST_DEBUG_FUNCPTR_NAME:
1225  * @ptr: address of the function of which to look up the name
1226  *
1227  * Retrieves the name of the function, if it was previously registered with
1228  * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
1229  *
1230  * This macro returns a constant string which must not be modified or
1231  * freed by the caller.
1232  */
1233 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
1234   _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1235
1236
1237 #else /* GST_DISABLE_GST_DEBUG */
1238
1239
1240 #ifndef GST_INFO_C
1241
1242 #if defined(__GNUC__) && __GNUC__ >= 3
1243 #  pragma GCC poison gst_debug_log
1244 #  pragma GCC poison gst_debug_log_valist
1245 #  pragma GCC poison _gst_debug_category_new
1246 #endif
1247
1248 #define _gst_debug_min GST_LEVEL_NONE
1249
1250 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1251 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1252
1253 #define gst_debug_level_get_name(level)                         ("NONE")
1254 #define gst_debug_message_get(message)                          ("")
1255 #define gst_debug_add_log_function(func,data,notify)    G_STMT_START{ }G_STMT_END
1256 #define gst_debug_set_active(active)                    G_STMT_START{ }G_STMT_END
1257 #define gst_debug_is_active()                           (FALSE)
1258 #define gst_debug_set_colored(colored)                  G_STMT_START{ }G_STMT_END
1259 #define gst_debug_set_color_mode(mode)                  G_STMT_START{ }G_STMT_END
1260 #define gst_debug_set_color_mode_from_string(mode)      G_STMT_START{ }G_STMT_END
1261 #define gst_debug_is_colored()                          (FALSE)
1262 #define gst_debug_get_color_mode()                      (GST_DEBUG_COLOR_MODE_OFF)
1263 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1264 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1265 #define gst_debug_set_threshold_for_name(name,level)    G_STMT_START{ }G_STMT_END
1266 #define gst_debug_unset_threshold_for_name(name)        G_STMT_START{ }G_STMT_END
1267
1268 /* we are using dummy function prototypes here to eat ';' as these macros are
1269  * used outside of functions */
1270 #define GST_DEBUG_CATEGORY(var)                         void _gst_debug_dummy_##var (void)
1271 #define GST_DEBUG_CATEGORY_EXTERN(var)                  void _gst_debug_dummy_extern_##var (void)
1272 #define GST_DEBUG_CATEGORY_STATIC(var)                  void _gst_debug_dummy_static_##var (void)
1273
1274 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc)    G_STMT_START{ }G_STMT_END
1275 #define GST_DEBUG_CATEGORY_GET(var,name)                G_STMT_START{ }G_STMT_END
1276 #define gst_debug_category_free(category)               G_STMT_START{ }G_STMT_END
1277 #define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END
1278 #define gst_debug_category_reset_threshold(category)    G_STMT_START{ }G_STMT_END
1279 #define gst_debug_category_get_threshold(category)      (GST_LEVEL_NONE)
1280 #define gst_debug_category_get_name(cat)                ("")
1281 #define gst_debug_category_get_color(cat)               (0)
1282 #define gst_debug_category_get_description(cat)         ("")
1283 #define gst_debug_get_all_categories()                  (NULL)
1284 #define gst_debug_construct_term_color(colorinfo)       (g_strdup ("00"))
1285 #define gst_debug_construct_win_color(colorinfo)        (0)
1286
1287 #endif /* !GST_INFO_C */
1288
1289 #ifdef G_HAVE_ISO_VARARGS
1290
1291 #define GST_CAT_LEVEL_LOG(cat,level,...)                G_STMT_START{ }G_STMT_END
1292
1293 #define GST_CAT_ERROR_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1294 #define GST_CAT_WARNING_OBJECT(...)                     G_STMT_START{ }G_STMT_END
1295 #define GST_CAT_INFO_OBJECT(...)                        G_STMT_START{ }G_STMT_END
1296 #define GST_CAT_DEBUG_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1297 #define GST_CAT_LOG_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1298 #define GST_CAT_FIXME_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1299 #define GST_CAT_TRACE_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1300
1301 #define GST_CAT_ERROR(...)                              G_STMT_START{ }G_STMT_END
1302 #define GST_CAT_WARNING(...)                            G_STMT_START{ }G_STMT_END
1303 #define GST_CAT_INFO(...)                               G_STMT_START{ }G_STMT_END
1304 #define GST_CAT_DEBUG(...)                              G_STMT_START{ }G_STMT_END
1305 #define GST_CAT_LOG(...)                                G_STMT_START{ }G_STMT_END
1306 #define GST_CAT_FIXME(...)                              G_STMT_START{ }G_STMT_END
1307 #define GST_CAT_TRACE(...)                              G_STMT_START{ }G_STMT_END
1308
1309 #define GST_ERROR_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1310 #define GST_WARNING_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1311 #define GST_INFO_OBJECT(...)                            G_STMT_START{ }G_STMT_END
1312 #define GST_DEBUG_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1313 #define GST_LOG_OBJECT(...)                             G_STMT_START{ }G_STMT_END
1314 #define GST_FIXME_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1315 #define GST_TRACE_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1316
1317 #define GST_ERROR(...)                                  G_STMT_START{ }G_STMT_END
1318 #define GST_WARNING(...)                                G_STMT_START{ }G_STMT_END
1319 #define GST_INFO(...)                                   G_STMT_START{ }G_STMT_END
1320 #define GST_DEBUG(...)                                  G_STMT_START{ }G_STMT_END
1321 #define GST_LOG(...)                                    G_STMT_START{ }G_STMT_END
1322 #define GST_FIXME(...)                                  G_STMT_START{ }G_STMT_END
1323 #define GST_TRACE(...)                                  G_STMT_START{ }G_STMT_END
1324
1325 #else /* !G_HAVE_ISO_VARARGS */
1326 #ifdef G_HAVE_GNUC_VARARGS
1327
1328 #define GST_CAT_LEVEL_LOG(cat,level,args...)            G_STMT_START{ }G_STMT_END
1329
1330 #define GST_CAT_ERROR_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1331 #define GST_CAT_WARNING_OBJECT(args...)                 G_STMT_START{ }G_STMT_END
1332 #define GST_CAT_INFO_OBJECT(args...)                    G_STMT_START{ }G_STMT_END
1333 #define GST_CAT_DEBUG_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1334 #define GST_CAT_LOG_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1335 #define GST_CAT_FIXME_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1336 #define GST_CAT_TRACE_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1337
1338 #define GST_CAT_ERROR(args...)                          G_STMT_START{ }G_STMT_END
1339 #define GST_CAT_WARNING(args...)                        G_STMT_START{ }G_STMT_END
1340 #define GST_CAT_INFO(args...)                           G_STMT_START{ }G_STMT_END
1341 #define GST_CAT_DEBUG(args...)                          G_STMT_START{ }G_STMT_END
1342 #define GST_CAT_LOG(args...)                            G_STMT_START{ }G_STMT_END
1343 #define GST_CAT_FIXME(args...)                          G_STMT_START{ }G_STMT_END
1344 #define GST_CAT_TRACE(args...)                          G_STMT_START{ }G_STMT_END
1345
1346 #define GST_ERROR_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1347 #define GST_WARNING_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1348 #define GST_INFO_OBJECT(args...)                        G_STMT_START{ }G_STMT_END
1349 #define GST_DEBUG_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1350 #define GST_LOG_OBJECT(args...)                         G_STMT_START{ }G_STMT_END
1351 #define GST_FIXME_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1352 #define GST_TRACE_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1353
1354 #define GST_ERROR(args...)                              G_STMT_START{ }G_STMT_END
1355 #define GST_WARNING(args...)                            G_STMT_START{ }G_STMT_END
1356 #define GST_INFO(args...)                               G_STMT_START{ }G_STMT_END
1357 #define GST_DEBUG(args...)                              G_STMT_START{ }G_STMT_END
1358 #define GST_LOG(args...)                                G_STMT_START{ }G_STMT_END
1359 #define GST_FIXME(args...)                              G_STMT_START{ }G_STMT_END
1360 #define GST_TRACE(args...)                              G_STMT_START{ }G_STMT_END
1361
1362 #else /* !G_HAVE_GNUC_VARARGS */
1363 static inline void
1364 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1365     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1366 {
1367 }
1368
1369 static inline void
1370 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1371     ...)
1372 {
1373 }
1374
1375 static inline void
1376 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1377     const char *format, ...)
1378 {
1379 }
1380
1381 static inline void
1382 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1383     ...)
1384 {
1385 }
1386
1387 static inline void
1388 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1389     ...)
1390 {
1391 }
1392
1393 static inline void
1394 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1395     ...)
1396 {
1397 }
1398
1399 static inline void
1400 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1401     ...)
1402 {
1403 }
1404
1405 static inline void
1406 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1407     ...)
1408 {
1409 }
1410
1411 static inline void
1412 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1413 {
1414 }
1415
1416 static inline void
1417 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1418 {
1419 }
1420
1421 static inline void
1422 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1423 {
1424 }
1425
1426 static inline void
1427 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1428 {
1429 }
1430
1431 static inline void
1432 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1433 {
1434 }
1435
1436 static inline void
1437 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1438 {
1439 }
1440
1441 static inline void
1442 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1443 {
1444 }
1445
1446 static inline void
1447 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1448 {
1449 }
1450
1451 static inline void
1452 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1453 {
1454 }
1455
1456 static inline void
1457 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1458 {
1459 }
1460
1461 static inline void
1462 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1463 {
1464 }
1465
1466 static inline void
1467 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1468 {
1469 }
1470
1471 static inline void
1472 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1473 {
1474 }
1475
1476 static inline void
1477 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1478 {
1479 }
1480
1481 static inline void
1482 GST_ERROR (const char *format, ...)
1483 {
1484 }
1485
1486 static inline void
1487 GST_WARNING (const char *format, ...)
1488 {
1489 }
1490
1491 static inline void
1492 GST_INFO (const char *format, ...)
1493 {
1494 }
1495
1496 static inline void
1497 GST_DEBUG (const char *format, ...)
1498 {
1499 }
1500
1501 static inline void
1502 GST_LOG (const char *format, ...)
1503 {
1504 }
1505
1506 static inline void
1507 GST_FIXME (const char *format, ...)
1508 {
1509 }
1510
1511 static inline void
1512 GST_TRACE (const char *format, ...)
1513 {
1514 }
1515
1516 #endif /* G_HAVE_GNUC_VARARGS */
1517 #endif /* G_HAVE_ISO_VARARGS */
1518
1519 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) G_STMT_START{ }G_STMT_END
1520 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1521 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1522
1523 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
1524 #define GST_CAT_MEMDUMP(cat,msg,data,length)            G_STMT_START{ }G_STMT_END
1525 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)         G_STMT_START{ }G_STMT_END
1526 #define GST_MEMDUMP(msg,data,length)                    G_STMT_START{ }G_STMT_END
1527
1528 #endif /* GST_DISABLE_GST_DEBUG */
1529
1530
1531 void gst_debug_print_stack_trace (void);
1532
1533 G_END_DECLS
1534
1535 #endif /* __GSTINFO_H__ */