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