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