uri: fix wrong G_GNUC_MALLOC
[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 const 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 const gchar *   gst_debug_level_get_name (GstDebugLevel level);
336
337 void            gst_debug_add_log_function            (GstLogFunction func,
338                                                        gpointer       data);
339
340 guint           gst_debug_remove_log_function         (GstLogFunction func);
341 guint           gst_debug_remove_log_function_by_data (gpointer       data);
342
343 void            gst_debug_set_active  (gboolean active);
344 gboolean        gst_debug_is_active   (void);
345
346 void            gst_debug_set_colored (gboolean colored);
347 gboolean        gst_debug_is_colored  (void);
348
349 void            gst_debug_set_default_threshold      (GstDebugLevel level);
350 GstDebugLevel   gst_debug_get_default_threshold      (void);
351 void            gst_debug_set_threshold_for_name     (const gchar * name,
352                                                       GstDebugLevel level);
353 void            gst_debug_unset_threshold_for_name   (const gchar * name);
354
355
356 void            gst_debug_category_free              (GstDebugCategory *        category);
357 void                gst_debug_category_set_threshold     (GstDebugCategory *    category,
358                                                       GstDebugLevel             level);
359 void            gst_debug_category_reset_threshold   (GstDebugCategory *        category);
360 GstDebugLevel   gst_debug_category_get_threshold     (GstDebugCategory *        category);
361 const gchar *   gst_debug_category_get_name          (GstDebugCategory *        category);
362 guint           gst_debug_category_get_color         (GstDebugCategory *        category);
363 const gchar *   gst_debug_category_get_description   (GstDebugCategory *        category);
364 GSList *        gst_debug_get_all_categories    (void);
365
366
367 gchar * gst_debug_construct_term_color (guint colorinfo);
368 gint    gst_debug_construct_win_color  (guint colorinfo);
369
370
371 #ifndef GST_DISABLE_GST_DEBUG
372
373 #define gst_debug_add_log_function(func,data) \
374 G_STMT_START{                                 \
375   if (func == gst_debug_log_default) {        \
376     gst_debug_add_log_function(NULL,data);    \
377   } else {                                    \
378     gst_debug_add_log_function(func,data);    \
379   }                                           \
380 }G_STMT_END
381
382 #define gst_debug_remove_log_function(func)   \
383     (func == gst_debug_log_default) ?         \
384         gst_debug_remove_log_function(NULL) : \
385         gst_debug_remove_log_function(func)
386
387 /**
388  * GST_DEBUG_CATEGORY:
389  * @cat: the category
390  *
391  * Defines a GstDebugCategory variable.
392  * This macro expands to nothing if debugging is disabled.
393  */
394 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
395 /**
396  * GST_DEBUG_CATEGORY_EXTERN:
397  * @cat: the category
398  *
399  * Declares a GstDebugCategory variable as extern. Use in header files.
400  * This macro expands to nothing if debugging is disabled.
401  */
402 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
403
404 /**
405  * GST_DEBUG_CATEGORY_STATIC:
406  * @cat: the category
407  *
408  * Defines a static GstDebugCategory variable.
409  * This macro expands to nothing if debugging is disabled.
410  */
411 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
412
413 /**
414  * GST_DEBUG_CATEGORY_INIT:
415  * @cat: the category to initialize.
416  * @name: the name of the category.
417  * @color: the colors to use for a color representation or 0 for no color.
418  * @description: optional description of the category.
419  *
420  * Initializes a new #GstDebugCategory with the given properties and set to
421  * the default threshold.
422  *
423  * <note>
424  * <para>
425  * This macro expands to nothing if debugging is disabled.
426  * </para>
427  * <para>
428  * When naming your category, please follow the following conventions to ensure
429  * that the pattern matching for categories works as expected. It is not
430  * earth-shattering if you don't follow these conventions, but it would be nice
431  * for everyone.
432  * </para>
433  * <para>
434  * If you define a category for a plugin or a feature of it, name the category
435  * like the feature. So if you wanted to write a "filesrc" element, you would
436  * name the category "filesrc". Use lowercase letters only.
437  * If you define more than one category for the same element, append an
438  * underscore and an identifier to your categories, like this: "filesrc_cache"
439  * </para>
440  * <para>
441  * If you create a library or an application using debugging categories, use a
442  * common prefix followed by an underscore for all your categories. GStreamer
443  * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
444  * to include uppercase letters.
445  * </para>
446  * </note>
447  */
448 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
449   if (cat == NULL)                                                      \
450     cat = _gst_debug_category_new (name,color,description);             \
451 }G_STMT_END
452
453 /**
454  * GST_DEBUG_CATEGORY_GET:
455  * @cat: the category to initialize.
456  * @name: log category name
457  *
458  * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the
459  * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
460  * @cat. Otherwise @cat will be NULL.
461  *
462  * |[
463  * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
464  * #define GST_CAT_DEFAULT gst_myplugin_debug
465  * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
466  * ...
467  * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
468  * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
469  * ]|
470  *
471  * Since: 0.10.24
472  */
473 #ifdef GST_CAT_DEFAULT
474 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
475   cat = _gst_debug_get_category (name);                 \
476   if (!cat) {                                           \
477     cat = GST_CAT_DEFAULT;                              \
478   }                                                     \
479 }G_STMT_END
480 #else
481 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
482   cat = _gst_debug_get_category (name);                 \
483 }G_STMT_END
484 #endif
485
486 /**
487  * GST_CAT_DEFAULT:
488  *
489  * Default gstreamer core debug log category. Please define your own.
490  */
491 GST_EXPORT GstDebugCategory *   GST_CAT_DEFAULT;
492 /* this symbol may not be used */
493 extern gboolean                 __gst_debug_enabled;
494
495 /* since 0.10.7, the min debug level, used for quickly discarding debug
496  * messages that fall under the threshold. */
497 GST_EXPORT GstDebugLevel            __gst_debug_min;
498
499 /**
500  * GST_CAT_LEVEL_LOG:
501  * @cat: category to use
502  * @level: the severity of the message
503  * @object: the #GObject the message belongs to or NULL if none
504  * @...: A printf-style message to output
505  *
506  * Outputs a debugging message. This is the most general macro for outputting
507  * debugging messages. You will probably want to use one of the ones described
508  * below.
509  */
510 #ifdef G_HAVE_ISO_VARARGS
511 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{           \
512   if (G_UNLIKELY (level <= __gst_debug_min)) {                                          \
513     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,    \
514         (GObject *) (object), __VA_ARGS__);                             \
515   }                                                                     \
516 }G_STMT_END
517 #else /* G_HAVE_GNUC_VARARGS */
518 #ifdef G_HAVE_GNUC_VARARGS
519 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{       \
520   if (G_UNLIKELY (level <= __gst_debug_min)) {                                          \
521     gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,    \
522         (GObject *) (object), ##args );                                 \
523   }                                                                     \
524 }G_STMT_END
525 #else /* no variadic macros, use inline */
526 static inline void
527 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
528     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
529 {
530   if (G_UNLIKELY (level <= __gst_debug_min)) {
531     gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
532         varargs);
533   }
534 }
535
536 static inline void
537 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
538     gpointer object, const char *format, ...)
539 {
540   va_list varargs;
541
542   va_start (varargs, format);
543   GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
544   va_end (varargs);
545 }
546 #endif
547 #endif /* G_HAVE_ISO_VARARGS */
548
549 /* This one doesn't have varargs in the macro, so it's different than all the
550  * other macros and hence in a separate block right here. Docs chunks are
551  * with the other doc chunks below though. */
552 #define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{       \
553   if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= __gst_debug_min)) {                    \
554     _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__,             \
555         (GObject *) (object), (msg), (data), (length));                       \
556   }                                                                           \
557 }G_STMT_END
558
559 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length)  \
560     __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
561 #define GST_CAT_MEMDUMP(cat,msg,data,length)             \
562     __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
563 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)          \
564     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
565 #define GST_MEMDUMP(msg,data,length)                     \
566     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
567
568 /**
569  * GST_CAT_ERROR_OBJECT:
570  * @cat: category to use
571  * @obj: the #GObject the message belongs to
572  * @...: printf-style message to output
573  *
574  * Output an error message belonging to the given object in the given category.
575  */
576 /**
577  * GST_CAT_WARNING_OBJECT:
578  * @cat: category to use
579  * @obj: the #GObject the message belongs to
580  * @...: printf-style message to output
581  *
582  * Output a warning message belonging to the given object in the given category.
583  */
584 /**
585  * GST_CAT_INFO_OBJECT:
586  * @cat: category to use
587  * @obj: the #GObject the message belongs to
588  * @...: printf-style message to output
589  *
590  * Output an informational message belonging to the given object in the given
591  * category.
592  */
593 /**
594  * GST_CAT_DEBUG_OBJECT:
595  * @cat: category to use
596  * @obj: the #GObject the message belongs to
597  * @...: printf-style message to output
598  *
599  * Output an debugging message belonging to the given object in the given category.
600  */
601 /**
602  * GST_CAT_LOG_OBJECT:
603  * @cat: category to use
604  * @obj: the #GObject the message belongs to
605  * @...: printf-style message to output
606  *
607  * Output an logging message belonging to the given object in the given category.
608  */
609 /**
610  * GST_CAT_FIXME_OBJECT:
611  * @cat: category to use
612  * @obj: the #GObject the message belongs to
613  * @...: printf-style message to output
614  *
615  * Output a fixme message belonging to the given object in the given category.
616  *
617  * Since: 0.10.23
618  */
619 /**
620  * GST_CAT_TRACE_OBJECT:
621  * @cat: category to use
622  * @obj: the #GObject the message belongs to
623  * @...: printf-style message to output
624  *
625  * Output a tracing message belonging to the given object in the given
626  * category.
627  *
628  * Since: 0.10.30
629  */
630 /**
631  * GST_CAT_MEMDUMP_OBJECT:
632  * @cat: category to use
633  * @obj: the #GObject the message belongs to
634  * @msg: message string to log with the data
635  * @data: pointer to the data to output
636  * @length: length of the data to output
637  *
638  * Output a hexdump of @data relating to the given object in the given
639  * category.
640  *
641  * Since: 0.10.23
642  */
643
644
645 /**
646  * GST_CAT_ERROR:
647  * @cat: category to use
648  * @...: printf-style message to output
649  *
650  * Output an error message in the given category.
651  */
652 /**
653  * GST_CAT_WARNING:
654  * @cat: category to use
655  * @...: printf-style message to output
656  *
657  * Output an warning message in the given category.
658  */
659 /**
660  * GST_CAT_INFO:
661  * @cat: category to use
662  * @...: printf-style message to output
663  *
664  * Output an informational message in the given category.
665  */
666 /**
667  * GST_CAT_DEBUG:
668  * @cat: category to use
669  * @...: printf-style message to output
670  *
671  * Output an debugging message in the given category.
672  */
673 /**
674  * GST_CAT_LOG:
675  * @cat: category to use
676  * @...: printf-style message to output
677  *
678  * Output an logging message in the given category.
679  */
680 /**
681  * GST_CAT_FIXME:
682  * @cat: category to use
683  * @...: printf-style message to output
684  *
685  * Output an fixme message in the given category.
686  *
687  * Since: 0.10.23
688  */
689 /**
690  * GST_CAT_TRACE:
691  * @cat: category to use
692  * @...: printf-style message to output
693  *
694  * Output a tracing message in the given category.
695  *
696  * Since: 0.10.30
697  */
698 /**
699  * GST_CAT_MEMDUMP:
700  * @cat: category to use
701  * @msg: message string to log with the data
702  * @data: pointer to the data to output
703  * @length: length of the data to output
704  *
705  * Output a hexdump of @data in the given category.
706  *
707  * Since: 0.10.23
708  */
709
710
711 /**
712  * GST_ERROR_OBJECT:
713  * @obj: the #GObject the message belongs to
714  * @...: printf-style message to output
715  *
716  * Output an error message belonging to the given object in the default category.
717  */
718 /**
719  * GST_WARNING_OBJECT:
720  * @obj: the #GObject the message belongs to
721  * @...: printf-style message to output
722  *
723  * Output a warning message belonging to the given object in the default category.
724  */
725 /**
726  * GST_INFO_OBJECT:
727  * @obj: the #GObject the message belongs to
728  * @...: printf-style message to output
729  *
730  * Output an informational message belonging to the given object in the default
731  * category.
732  */
733 /**
734  * GST_DEBUG_OBJECT:
735  * @obj: the #GObject the message belongs to
736  * @...: printf-style message to output
737  *
738  * Output a debugging message belonging to the given object in the default
739  * category.
740  */
741 /**
742  * GST_LOG_OBJECT:
743  * @obj: the #GObject the message belongs to
744  * @...: printf-style message to output
745  *
746  * Output a logging message belonging to the given object in the default category.
747  */
748 /**
749  * GST_FIXME_OBJECT:
750  * @obj: the #GObject the message belongs to
751  * @...: printf-style message to output
752  *
753  * Output a fixme message belonging to the given object in the default category.
754  *
755  * Since: 0.10.23
756  */
757 /**
758  * GST_TRACE_OBJECT:
759  * @obj: the #GObject the message belongs to
760  * @...: printf-style message to output
761  *
762  * Output a tracing message belonging to the given object in the default category.
763  *
764  * Since: 0.10.30
765  */
766 /**
767  * GST_MEMDUMP_OBJECT:
768  * @obj: the #GObject the message belongs to
769  * @msg: message string to log with the data
770  * @data: pointer to the data to output
771  * @length: length of the data to output
772  *
773  * Output a logging message belonging to the given object in the default category.
774  *
775  * Since: 0.10.23
776  */
777
778
779 /**
780  * GST_ERROR:
781  * @...: printf-style message to output
782  *
783  * Output an error message in the default category.
784  */
785 /**
786  * GST_WARNING:
787  * @...: printf-style message to output
788  *
789  * Output a warning message in the default category.
790  */
791 /**
792  * GST_INFO:
793  * @...: printf-style message to output
794  *
795  * Output an informational message in the default category.
796  */
797 /**
798  * GST_DEBUG:
799  * @...: printf-style message to output
800  *
801  * Output a debugging message in the default category.
802  */
803 /**
804  * GST_LOG:
805  * @...: printf-style message to output
806  *
807  * Output a logging message in the default category.
808  */
809 /**
810  * GST_FIXME:
811  * @...: printf-style message to output
812  *
813  * Output a fixme message in the default category.
814  *
815  * Since: 0.10.23
816  */
817 /**
818  * GST_TRACE:
819  * @...: printf-style message to output
820  *
821  * Output a tracing message in the default category.
822  *
823  * Since: 0.10.30
824  */
825 /**
826  * GST_MEMDUMP:
827  * @msg: message string to log with the data
828  * @data: pointer to the data to output
829  * @length: length of the data to output
830  *
831  * Output a hexdump of @data.
832  *
833  * Since: 0.10.23
834  */
835
836 #ifdef G_HAVE_ISO_VARARGS
837
838 #define GST_CAT_ERROR_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
839 #define GST_CAT_WARNING_OBJECT(cat,obj,...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
840 #define GST_CAT_INFO_OBJECT(cat,obj,...)        GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
841 #define GST_CAT_DEBUG_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
842 #define GST_CAT_LOG_OBJECT(cat,obj,...)         GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
843 #define GST_CAT_FIXME_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
844 #define GST_CAT_TRACE_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
845
846 #define GST_CAT_ERROR(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
847 #define GST_CAT_WARNING(cat,...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
848 #define GST_CAT_INFO(cat,...)                   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
849 #define GST_CAT_DEBUG(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
850 #define GST_CAT_LOG(cat,...)                    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
851 #define GST_CAT_FIXME(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
852 #define GST_CAT_TRACE(cat,...)          GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
853
854 #define GST_ERROR_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
855 #define GST_WARNING_OBJECT(obj,...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
856 #define GST_INFO_OBJECT(obj,...)        GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
857 #define GST_DEBUG_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
858 #define GST_LOG_OBJECT(obj,...)         GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
859 #define GST_FIXME_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
860 #define GST_TRACE_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
861
862 #define GST_ERROR(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
863 #define GST_WARNING(...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
864 #define GST_INFO(...)                   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
865 #define GST_DEBUG(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
866 #define GST_LOG(...)                    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
867 #define GST_FIXME(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
868 #define GST_TRACE(...)          GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
869
870 #else
871 #ifdef G_HAVE_GNUC_VARARGS
872
873 #define GST_CAT_ERROR_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  ##args )
874 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  ##args )
875 #define GST_CAT_INFO_OBJECT(cat,obj,args...)    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  ##args )
876 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  ##args )
877 #define GST_CAT_LOG_OBJECT(cat,obj,args...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  ##args )
878 #define GST_CAT_FIXME_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  ##args )
879 #define GST_CAT_TRACE_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  ##args )
880
881 #define GST_CAT_ERROR(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, ##args )
882 #define GST_CAT_WARNING(cat,args...)            GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
883 #define GST_CAT_INFO(cat,args...)               GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, ##args )
884 #define GST_CAT_DEBUG(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, ##args )
885 #define GST_CAT_LOG(cat,args...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, ##args )
886 #define GST_CAT_FIXME(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, ##args )
887 #define GST_CAT_TRACE(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, ##args )
888
889 #define GST_ERROR_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  ##args )
890 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  ##args )
891 #define GST_INFO_OBJECT(obj,args...)    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  ##args )
892 #define GST_DEBUG_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  ##args )
893 #define GST_LOG_OBJECT(obj,args...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  ##args )
894 #define GST_FIXME_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  ##args )
895 #define GST_TRACE_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  ##args )
896
897 #define GST_ERROR(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, ##args )
898 #define GST_WARNING(args...)            GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
899 #define GST_INFO(args...)               GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, ##args )
900 #define GST_DEBUG(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, ##args )
901 #define GST_LOG(args...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, ##args )
902 #define GST_FIXME(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, ##args )
903 #define GST_TRACE(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, ##args )
904
905 #else
906 /* no variadic macros, use inline */
907 static inline void
908 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
909     ...)
910 {
911   va_list varargs;
912
913   va_start (varargs, format);
914   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
915   va_end (varargs);
916 }
917
918 static inline void
919 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
920     const char *format, ...)
921 {
922   va_list varargs;
923
924   va_start (varargs, format);
925   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
926   va_end (varargs);
927 }
928
929 static inline void
930 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
931     ...)
932 {
933   va_list varargs;
934
935   va_start (varargs, format);
936   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
937   va_end (varargs);
938 }
939
940 static inline void
941 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
942     ...)
943 {
944   va_list varargs;
945
946   va_start (varargs, format);
947   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
948   va_end (varargs);
949 }
950
951 static inline void
952 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
953     ...)
954 {
955   va_list varargs;
956
957   va_start (varargs, format);
958   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
959   va_end (varargs);
960 }
961
962 static inline void
963 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
964     ...)
965 {
966   va_list varargs;
967
968   va_start (varargs, format);
969   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
970   va_end (varargs);
971 }
972
973 static inline void
974 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
975     ...)
976 {
977   va_list varargs;
978
979   va_start (varargs, format);
980   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
981   va_end (varargs);
982 }
983
984 static inline void
985 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
986 {
987   va_list varargs;
988
989   va_start (varargs, format);
990   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
991   va_end (varargs);
992 }
993
994 static inline void
995 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
996 {
997   va_list varargs;
998
999   va_start (varargs, format);
1000   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
1001   va_end (varargs);
1002 }
1003
1004 static inline void
1005 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1006 {
1007   va_list varargs;
1008
1009   va_start (varargs, format);
1010   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
1011   va_end (varargs);
1012 }
1013
1014 static inline void
1015 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1016 {
1017   va_list varargs;
1018
1019   va_start (varargs, format);
1020   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
1021   va_end (varargs);
1022 }
1023
1024 static inline void
1025 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1026 {
1027   va_list varargs;
1028
1029   va_start (varargs, format);
1030   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
1031   va_end (varargs);
1032 }
1033
1034 static inline void
1035 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1036 {
1037   va_list varargs;
1038
1039   va_start (varargs, format);
1040   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
1041   va_end (varargs);
1042 }
1043
1044 static inline void
1045 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1046 {
1047   va_list varargs;
1048
1049   va_start (varargs, format);
1050   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
1051   va_end (varargs);
1052 }
1053
1054 static inline void
1055 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1056 {
1057   va_list varargs;
1058
1059   va_start (varargs, format);
1060   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
1061       varargs);
1062   va_end (varargs);
1063 }
1064
1065 static inline void
1066 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1067 {
1068   va_list varargs;
1069
1070   va_start (varargs, format);
1071   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
1072       varargs);
1073   va_end (varargs);
1074 }
1075
1076 static inline void
1077 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1078 {
1079   va_list varargs;
1080
1081   va_start (varargs, format);
1082   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
1083       varargs);
1084   va_end (varargs);
1085 }
1086
1087 static inline void
1088 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1089 {
1090   va_list varargs;
1091
1092   va_start (varargs, format);
1093   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
1094       varargs);
1095   va_end (varargs);
1096 }
1097
1098 static inline void
1099 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1100 {
1101   va_list varargs;
1102
1103   va_start (varargs, format);
1104   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
1105       varargs);
1106   va_end (varargs);
1107 }
1108
1109 static inline void
1110 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1111 {
1112   va_list varargs;
1113
1114   va_start (varargs, format);
1115   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
1116       varargs);
1117   va_end (varargs);
1118 }
1119
1120 static inline void
1121 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1122 {
1123   va_list varargs;
1124
1125   va_start (varargs, format);
1126   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
1127       varargs);
1128   va_end (varargs);
1129 }
1130
1131 static inline void
1132 GST_ERROR (const char *format, ...)
1133 {
1134   va_list varargs;
1135
1136   va_start (varargs, format);
1137   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
1138       varargs);
1139   va_end (varargs);
1140 }
1141
1142 static inline void
1143 GST_WARNING (const char *format, ...)
1144 {
1145   va_list varargs;
1146
1147   va_start (varargs, format);
1148   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
1149       varargs);
1150   va_end (varargs);
1151 }
1152
1153 static inline void
1154 GST_INFO (const char *format, ...)
1155 {
1156   va_list varargs;
1157
1158   va_start (varargs, format);
1159   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
1160       varargs);
1161   va_end (varargs);
1162 }
1163
1164 static inline void
1165 GST_DEBUG (const char *format, ...)
1166 {
1167   va_list varargs;
1168
1169   va_start (varargs, format);
1170   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
1171       varargs);
1172   va_end (varargs);
1173 }
1174
1175 static inline void
1176 GST_LOG (const char *format, ...)
1177 {
1178   va_list varargs;
1179
1180   va_start (varargs, format);
1181   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
1182       format, varargs);
1183   va_end (varargs);
1184 }
1185
1186 static inline void
1187 GST_FIXME (const char *format, ...)
1188 {
1189   va_list varargs;
1190
1191   va_start (varargs, format);
1192   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
1193       varargs);
1194   va_end (varargs);
1195 }
1196
1197 static inline void
1198 GST_TRACE (const char *format, ...)
1199 {
1200   va_list varargs;
1201
1202   va_start (varargs, format);
1203   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
1204       varargs);
1205   va_end (varargs);
1206 }
1207 #endif
1208 #endif
1209
1210
1211 /********** function pointer stuff **********/
1212
1213 /**
1214  * GST_DEBUG_REGISTER_FUNCPTR:
1215  * @ptr: pointer to the function to register
1216  *
1217  * Register a pointer to a function with its name, so it can later be used by
1218  * GST_DEBUG_FUNCPTR_NAME().
1219  *
1220  * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr.
1221  *
1222  * Since: 0.10.26
1223  */
1224 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
1225   _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
1226 /**
1227  * GST_DEBUG_FUNCPTR:
1228  * @ptr: pointer to the function to register
1229  *
1230  * Register a pointer to a function with its name, so it can later be used by
1231  * GST_DEBUG_FUNCPTR_NAME().
1232  *
1233  * Returns: the value passed to @ptr.
1234  */
1235 #define GST_DEBUG_FUNCPTR(ptr) \
1236   (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1237
1238 /**
1239  * GST_DEBUG_FUNCPTR_NAME:
1240  * @ptr: address of the function of which to look up the name
1241  *
1242  * Retrieves the name of the function, if it was previously registered with
1243  * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
1244  *
1245  * This macro returns a constant string which must not be modified or
1246  * freed by the caller.
1247  */
1248 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
1249   _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1250
1251
1252 #else /* GST_DISABLE_GST_DEBUG */
1253
1254
1255 #ifndef GST_INFO_C
1256
1257 #if defined(__GNUC__) && __GNUC__ >= 3
1258 #  pragma GCC poison gst_debug_log
1259 #  pragma GCC poison gst_debug_log_valist
1260 #  pragma GCC poison _gst_debug_category_new
1261 #endif
1262
1263 #define __gst_debug_min GST_LEVEL_NONE
1264
1265 #define _gst_debug_init()                               G_STMT_START{ }G_STMT_END
1266
1267 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1268 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1269
1270 #define gst_debug_level_get_name(level)                         ("NONE")
1271 #define gst_debug_message_get(message)                          ("")
1272 #define gst_debug_add_log_function(func,data)           G_STMT_START{ }G_STMT_END
1273 #define gst_debug_set_active(active)                    G_STMT_START{ }G_STMT_END
1274 #define gst_debug_is_active()                           (FALSE)
1275 #define gst_debug_set_colored(colored)                  G_STMT_START{ }G_STMT_END
1276 #define gst_debug_is_colored()                          (FALSE)
1277 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1278 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1279 #define gst_debug_set_threshold_for_name(name,level)    G_STMT_START{ }G_STMT_END
1280 #define gst_debug_unset_threshold_for_name(name)        G_STMT_START{ }G_STMT_END
1281
1282 /* we are using dummy function prototypes here to eat ';' as these macros are
1283  * used outside of functions */
1284 #define GST_DEBUG_CATEGORY(var)                         void _gst_debug_dummy_##var (void)
1285 #define GST_DEBUG_CATEGORY_EXTERN(var)                  void _gst_debug_dummy_extern_##var (void)
1286 #define GST_DEBUG_CATEGORY_STATIC(var)                  void _gst_debug_dummy_static_##var (void)
1287
1288 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc)    G_STMT_START{ }G_STMT_END
1289 #define GST_DEBUG_CATEGORY_GET(var,name)                G_STMT_START{ }G_STMT_END
1290 #define gst_debug_category_free(category)               G_STMT_START{ }G_STMT_END
1291 #define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END
1292 #define gst_debug_category_reset_threshold(category)    G_STMT_START{ }G_STMT_END
1293 #define gst_debug_category_get_threshold(category)      (GST_LEVEL_NONE)
1294 #define gst_debug_category_get_name(cat)                ("")
1295 #define gst_debug_category_get_color(cat)               (0)
1296 #define gst_debug_category_get_description(cat)         ("")
1297 #define gst_debug_get_all_categories()                  (NULL)
1298 #define gst_debug_construct_term_color(colorinfo)       (g_strdup ("00"))
1299 #define gst_debug_construct_win_color(colorinfo)        (0)
1300
1301 #endif /* !GST_INFO_C */
1302
1303 #ifdef G_HAVE_ISO_VARARGS
1304
1305 #define GST_CAT_LEVEL_LOG(cat,level,...)                G_STMT_START{ }G_STMT_END
1306
1307 #define GST_CAT_ERROR_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1308 #define GST_CAT_WARNING_OBJECT(...)                     G_STMT_START{ }G_STMT_END
1309 #define GST_CAT_INFO_OBJECT(...)                        G_STMT_START{ }G_STMT_END
1310 #define GST_CAT_DEBUG_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1311 #define GST_CAT_LOG_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1312 #define GST_CAT_FIXME_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1313 #define GST_CAT_TRACE_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1314
1315 #define GST_CAT_ERROR(...)                              G_STMT_START{ }G_STMT_END
1316 #define GST_CAT_WARNING(...)                            G_STMT_START{ }G_STMT_END
1317 #define GST_CAT_INFO(...)                               G_STMT_START{ }G_STMT_END
1318 #define GST_CAT_DEBUG(...)                              G_STMT_START{ }G_STMT_END
1319 #define GST_CAT_LOG(...)                                G_STMT_START{ }G_STMT_END
1320 #define GST_CAT_FIXME(...)                              G_STMT_START{ }G_STMT_END
1321 #define GST_CAT_TRACE(...)                              G_STMT_START{ }G_STMT_END
1322
1323 #define GST_ERROR_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1324 #define GST_WARNING_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1325 #define GST_INFO_OBJECT(...)                            G_STMT_START{ }G_STMT_END
1326 #define GST_DEBUG_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1327 #define GST_LOG_OBJECT(...)                             G_STMT_START{ }G_STMT_END
1328 #define GST_FIXME_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1329 #define GST_TRACE_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1330
1331 #define GST_ERROR(...)                                  G_STMT_START{ }G_STMT_END
1332 #define GST_WARNING(...)                                G_STMT_START{ }G_STMT_END
1333 #define GST_INFO(...)                                   G_STMT_START{ }G_STMT_END
1334 #define GST_DEBUG(...)                                  G_STMT_START{ }G_STMT_END
1335 #define GST_LOG(...)                                    G_STMT_START{ }G_STMT_END
1336 #define GST_FIXME(...)                                  G_STMT_START{ }G_STMT_END
1337 #define GST_TRACE(...)                                  G_STMT_START{ }G_STMT_END
1338
1339 #else /* !G_HAVE_ISO_VARARGS */
1340 #ifdef G_HAVE_GNUC_VARARGS
1341
1342 #define GST_CAT_LEVEL_LOG(cat,level,args...)            G_STMT_START{ }G_STMT_END
1343
1344 #define GST_CAT_ERROR_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1345 #define GST_CAT_WARNING_OBJECT(args...)                 G_STMT_START{ }G_STMT_END
1346 #define GST_CAT_INFO_OBJECT(args...)                    G_STMT_START{ }G_STMT_END
1347 #define GST_CAT_DEBUG_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1348 #define GST_CAT_LOG_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1349 #define GST_CAT_FIXME_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1350 #define GST_CAT_TRACE_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1351
1352 #define GST_CAT_ERROR(args...)                          G_STMT_START{ }G_STMT_END
1353 #define GST_CAT_WARNING(args...)                        G_STMT_START{ }G_STMT_END
1354 #define GST_CAT_INFO(args...)                           G_STMT_START{ }G_STMT_END
1355 #define GST_CAT_DEBUG(args...)                          G_STMT_START{ }G_STMT_END
1356 #define GST_CAT_LOG(args...)                            G_STMT_START{ }G_STMT_END
1357 #define GST_CAT_FIXME(args...)                          G_STMT_START{ }G_STMT_END
1358 #define GST_CAT_TRACE(args...)                          G_STMT_START{ }G_STMT_END
1359
1360 #define GST_ERROR_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1361 #define GST_WARNING_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1362 #define GST_INFO_OBJECT(args...)                        G_STMT_START{ }G_STMT_END
1363 #define GST_DEBUG_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1364 #define GST_LOG_OBJECT(args...)                         G_STMT_START{ }G_STMT_END
1365 #define GST_FIXME_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1366 #define GST_TRACE_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1367
1368 #define GST_ERROR(args...)                              G_STMT_START{ }G_STMT_END
1369 #define GST_WARNING(args...)                            G_STMT_START{ }G_STMT_END
1370 #define GST_INFO(args...)                               G_STMT_START{ }G_STMT_END
1371 #define GST_DEBUG(args...)                              G_STMT_START{ }G_STMT_END
1372 #define GST_LOG(args...)                                G_STMT_START{ }G_STMT_END
1373 #define GST_FIXME(args...)                              G_STMT_START{ }G_STMT_END
1374 #define GST_TRACE(args...)                              G_STMT_START{ }G_STMT_END
1375
1376 #else /* !G_HAVE_GNUC_VARARGS */
1377 static inline void
1378 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1379     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1380 {
1381 }
1382
1383 static inline void
1384 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1385     ...)
1386 {
1387 }
1388
1389 static inline void
1390 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1391     const char *format, ...)
1392 {
1393 }
1394
1395 static inline void
1396 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1397     ...)
1398 {
1399 }
1400
1401 static inline void
1402 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1403     ...)
1404 {
1405 }
1406
1407 static inline void
1408 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1409     ...)
1410 {
1411 }
1412
1413 static inline void
1414 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1415     ...)
1416 {
1417 }
1418
1419 static inline void
1420 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1421     ...)
1422 {
1423 }
1424
1425 static inline void
1426 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1427 {
1428 }
1429
1430 static inline void
1431 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1432 {
1433 }
1434
1435 static inline void
1436 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1437 {
1438 }
1439
1440 static inline void
1441 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1442 {
1443 }
1444
1445 static inline void
1446 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1447 {
1448 }
1449
1450 static inline void
1451 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1452 {
1453 }
1454
1455 static inline void
1456 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1457 {
1458 }
1459
1460 static inline void
1461 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1462 {
1463 }
1464
1465 static inline void
1466 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1467 {
1468 }
1469
1470 static inline void
1471 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1472 {
1473 }
1474
1475 static inline void
1476 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1477 {
1478 }
1479
1480 static inline void
1481 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1482 {
1483 }
1484
1485 static inline void
1486 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1487 {
1488 }
1489
1490 static inline void
1491 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1492 {
1493 }
1494
1495 static inline void
1496 GST_ERROR (const char *format, ...)
1497 {
1498 }
1499
1500 static inline void
1501 GST_WARNING (const char *format, ...)
1502 {
1503 }
1504
1505 static inline void
1506 GST_INFO (const char *format, ...)
1507 {
1508 }
1509
1510 static inline void
1511 GST_DEBUG (const char *format, ...)
1512 {
1513 }
1514
1515 static inline void
1516 GST_LOG (const char *format, ...)
1517 {
1518 }
1519
1520 static inline void
1521 GST_FIXME (const char *format, ...)
1522 {
1523 }
1524
1525 static inline void
1526 GST_TRACE (const char *format, ...)
1527 {
1528 }
1529
1530 #endif /* G_HAVE_GNUC_VARARGS */
1531 #endif /* G_HAVE_ISO_VARARGS */
1532
1533 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) G_STMT_START{ }G_STMT_END
1534 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1535 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1536
1537 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
1538 #define GST_CAT_MEMDUMP(cat,msg,data,length)            G_STMT_START{ }G_STMT_END
1539 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)         G_STMT_START{ }G_STMT_END
1540 #define GST_MEMDUMP(msg,data,length)                    G_STMT_START{ }G_STMT_END
1541
1542 #endif /* GST_DISABLE_GST_DEBUG */
1543
1544
1545 void gst_debug_print_stack_trace (void);
1546
1547 G_END_DECLS
1548
1549 #endif /* __GSTINFO_H__ */