]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - gst/gstinfo.h
Changes to make it possible to LD_PRELOAD libttif
[glsdk/gstreamer0-10.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  */
24 #ifndef __GSTINFO_H__
25 #define __GSTINFO_H__
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <gst/gstconfig.h>
31 G_BEGIN_DECLS
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;
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
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;
162 #define GST_DEBUG_FG_MASK       (0x000F)
163 #define GST_DEBUG_BG_MASK       (0x00F0)
164 #define GST_DEBUG_FORMAT_MASK   (0xFF00)
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 */
178   const gchar *         name;
179   const gchar *         description;
181   void *ext;                /**< for use by LD_PRELOADED trace extension */
182 };
184 /********** some convenience macros for debugging **********/
186 /**
187  * GST_STR_NULL:
188  * @str: The string to check.
189  *
190  * Macro to use when a string must not be NULL, but may be NULL. If the string
191  * is NULL, "(NULL)" is printed instead.
192  * In GStreamer printf string arguments may not be NULL, because on some
193  * platforms (ie Solaris) the libc crashes in that case. This includes debugging
194  * strings.
195  */
196 #define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
198 /* FIXME, not MT safe */
199 /**
200  * GST_DEBUG_PAD_NAME:
201  * @pad: The pad to debug.
202  *
203  * Evaluates to 2 strings, that describe the pad. Often used in debugging
204  * statements.
205  */
206 #define GST_DEBUG_PAD_NAME(pad) \
207   (pad != NULL) ?  \
208   ((GST_OBJECT_PARENT(pad) != NULL) ? \
209   GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
210   "''" ) : "''", \
211   (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
213 /**
214  * GST_FUNCTION:
215  *
216  * This macro should evaluate to the name of the current function and be should
217  * be defined when configuring your project, as it is compiler dependant. If it
218  * is not defined, some default value is used. It is used to provide debugging
219  * output with the function name of the message.
220  *
221  * Note that this is different from G_STRFUNC as we do not want the full
222  * function signature in C++ code.
223  */
224 #ifndef GST_FUNCTION
225 #if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
226 #  define GST_FUNCTION     ((const char*) (__FUNCTION__))
227 #elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
228 #  define GST_FUNCTION     ((const char*) (__func__))
229 #else
230 #  define GST_FUNCTION     ((const char*) ("???"))
231 #endif
232 #endif /* ifndef GST_FUNCTION */
235 typedef struct _GstDebugMessage GstDebugMessage;
237 /**
238  * GstLogFunction:
239  * @category: a #GstDebugCategory
240  * @level: a #GstDebugLevel
241  * @file: file name
242  * @function: function name
243  * @line: line number
244  * @object: a #GObject
245  * @message: the message
246  * @data: user data for the log function
247  *
248  * Function prototype for a logging function that can be registered with
249  * gst_debug_add_log_function().
250  * Use G_GNUC_NO_INSTRUMENT on that function.
251  */
252 typedef void (*GstLogFunction)  (GstDebugCategory * category,
253                                  GstDebugLevel      level,
254                                  const gchar      * file,
255                                  const gchar      * function,
256                                  gint               line,
257                                  GObject          * object,
258                                  GstDebugMessage  * message,
259                                  gpointer           data);
262 /* FIXME 0.11: move this into private headers */
263 void            _gst_debug_init (void);
265 typedef struct {
266         const gchar *file;
267         const gchar *function;
268         const gint   line;
269 } GstDebugTraceLocation;
271 #define GST_DEBUG_TRACE_LOCATION() \
272         { __FILE__, GST_FUNCTION, __LINE__ }
274 #ifdef GST_USING_PRINTF_EXTENSION
276 /* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
277 void                gst_debug_log            (GstDebugCategory * category,
278                                           GstDebugLevel      level,
279                                           const gchar      * file,
280                                           const gchar      * function,
281                                           gint               line,
282                                           GObject          * object,
283                                           const gchar      * format,
284                                           ...) G_GNUC_NO_INSTRUMENT;
286 void                gst_debug_log2           (GstDebugCategory * category,
287                                           GstDebugLevel      level,
288                                           const GstDebugTraceLocation *location,
289                                           GObject          * object,
290                                           const gchar      * format,
291                                           ...) G_GNUC_NO_INSTRUMENT;
293 #else /* GST_USING_PRINTF_EXTENSION */
295 void                gst_debug_log            (GstDebugCategory * category,
296                                           GstDebugLevel      level,
297                                           const gchar      * file,
298                                           const gchar      * function,
299                                           gint               line,
300                                           GObject          * object,
301                                           const gchar      * format,
302                                           ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
304 void                gst_debug_log2           (GstDebugCategory * category,
305                                           GstDebugLevel      level,
306                                           const GstDebugTraceLocation *location,
307                                           GObject          * object,
308                                           const gchar      * format,
309                                           ...) G_GNUC_PRINTF (5, 6) G_GNUC_NO_INSTRUMENT;
311 #endif /* GST_USING_PRINTF_EXTENSION */
313 void            gst_debug_log_valist     (GstDebugCategory * category,
314                                           GstDebugLevel      level,
315                                           const gchar      * file,
316                                           const gchar      * function,
317                                           gint                line,
318                                           GObject          * object,
319                                           const gchar      * format,
320                                           va_list            args) G_GNUC_NO_INSTRUMENT;
322 /* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro */
323 GstDebugCategory *_gst_debug_category_new (const gchar * name,
324                                            guint         color,
325                                            const gchar * description);
326 /* do not use this function, use the GST_DEBUG_CATEGORY_GET macro */
327 GstDebugCategory *_gst_debug_get_category (const gchar *name);
330 /* do not use this function, use the GST_CAT_MEMDUMP_* macros */
331 void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
332     const gchar * func, gint line, GObject * obj, const gchar * msg,
333     const guint8 * data, guint length);
335 /* we define this to avoid a compiler warning regarding a cast from a function
336  * pointer to a void pointer
337  * (see https://bugzilla.gnome.org/show_bug.cgi?id=309253)
338  */
339 typedef void (* GstDebugFuncPtr)        (void);
341 /* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
342 void    _gst_debug_register_funcptr     (GstDebugFuncPtr        func,
343                                          const gchar *          ptrname);
344 const gchar *
345         _gst_debug_nameof_funcptr       (GstDebugFuncPtr        func) G_GNUC_NO_INSTRUMENT;
348 void            gst_debug_log_valist2    (GstDebugCategory * category,
349                                           GstDebugLevel      level,
350                                           const GstDebugTraceLocation *location,
351                                           GObject          * object,
352                                           const gchar      * format,
353                                           va_list            args) G_GNUC_NO_INSTRUMENT;
355 const gchar   * gst_debug_message_get    (GstDebugMessage  * message);
357 gchar *         gst_debug_print_object (gpointer ptr);
359 #ifdef HAVE_PRINTF_EXTENSION
360 gchar *         gst_debug_print_segment (gpointer ptr);
361 #endif
363 void            gst_debug_log_default    (GstDebugCategory * category,
364                                           GstDebugLevel      level,
365                                           const gchar      * file,
366                                           const gchar      * function,
367                                           gint               line,
368                                           GObject          * object,
369                                           GstDebugMessage  * message,
370                                           gpointer           unused) G_GNUC_NO_INSTRUMENT;
372 const gchar *   gst_debug_level_get_name (GstDebugLevel level);
374 void            gst_debug_add_log_function            (GstLogFunction func,
375                                                        gpointer       data);
377 guint           gst_debug_remove_log_function         (GstLogFunction func);
378 guint           gst_debug_remove_log_function_by_data (gpointer       data);
380 void            gst_debug_set_active  (gboolean active);
381 gboolean        gst_debug_is_active   (void);
383 void            gst_debug_set_colored (gboolean colored);
384 gboolean        gst_debug_is_colored  (void);
386 void            gst_debug_set_default_threshold      (GstDebugLevel level);
387 GstDebugLevel   gst_debug_get_default_threshold      (void);
388 void            gst_debug_set_threshold_for_name     (const gchar * name,
389                                                       GstDebugLevel level);
390 void            gst_debug_unset_threshold_for_name   (const gchar * name);
393 void            gst_debug_category_free              (GstDebugCategory *        category);
394 void                gst_debug_category_set_threshold     (GstDebugCategory *    category,
395                                                       GstDebugLevel             level);
396 void            gst_debug_category_reset_threshold   (GstDebugCategory *        category);
397 GstDebugLevel   gst_debug_category_get_threshold     (GstDebugCategory *        category);
398 const gchar *   gst_debug_category_get_name          (GstDebugCategory *        category);
399 guint           gst_debug_category_get_color         (GstDebugCategory *        category);
400 const gchar *   gst_debug_category_get_description   (GstDebugCategory *        category);
401 GSList *        gst_debug_get_all_categories    (void);
404 gchar * gst_debug_construct_term_color (guint colorinfo);
405 gint    gst_debug_construct_win_color  (guint colorinfo);
408 #ifndef GST_DISABLE_GST_DEBUG
410 #define gst_debug_add_log_function(func,data) \
411 G_STMT_START{                                 \
412   if (func == gst_debug_log_default) {        \
413     gst_debug_add_log_function(NULL,data);    \
414   } else {                                    \
415     gst_debug_add_log_function(func,data);    \
416   }                                           \
417 }G_STMT_END
419 #define gst_debug_remove_log_function(func)   \
420     (func == gst_debug_log_default) ?         \
421         gst_debug_remove_log_function(NULL) : \
422         gst_debug_remove_log_function(func)
424 /**
425  * GST_DEBUG_CATEGORY:
426  * @cat: the category
427  *
428  * Defines a GstDebugCategory variable.
429  * This macro expands to nothing if debugging is disabled.
430  */
431 #define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
432 /**
433  * GST_DEBUG_CATEGORY_EXTERN:
434  * @cat: the category
435  *
436  * Declares a GstDebugCategory variable as extern. Use in header files.
437  * This macro expands to nothing if debugging is disabled.
438  */
439 #define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
441 /**
442  * GST_DEBUG_CATEGORY_STATIC:
443  * @cat: the category
444  *
445  * Defines a static GstDebugCategory variable.
446  * This macro expands to nothing if debugging is disabled.
447  */
448 #define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
450 /**
451  * GST_DEBUG_CATEGORY_INIT:
452  * @cat: the category to initialize.
453  * @name: the name of the category.
454  * @color: the colors to use for a color representation or 0 for no color.
455  * @description: optional description of the category.
456  *
457  * Initializes a new #GstDebugCategory with the given properties and set to
458  * the default threshold.
459  *
460  * <note>
461  * <para>
462  * This macro expands to nothing if debugging is disabled.
463  * </para>
464  * <para>
465  * When naming your category, please follow the following conventions to ensure
466  * that the pattern matching for categories works as expected. It is not
467  * earth-shattering if you don't follow these conventions, but it would be nice
468  * for everyone.
469  * </para>
470  * <para>
471  * If you define a category for a plugin or a feature of it, name the category
472  * like the feature. So if you wanted to write a "filesrc" element, you would
473  * name the category "filesrc". Use lowercase letters only.
474  * If you define more than one category for the same element, append an
475  * underscore and an identifier to your categories, like this: "filesrc_cache"
476  * </para>
477  * <para>
478  * If you create a library or an application using debugging categories, use a
479  * common prefix followed by an underscore for all your categories. GStreamer
480  * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
481  * to include uppercase letters.
482  * </para>
483  * </note>
484  */
485 #define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
486   if (cat == NULL)                                                      \
487     cat = _gst_debug_category_new (name,color,description);             \
488 }G_STMT_END
490 /**
491  * GST_DEBUG_CATEGORY_GET:
492  * @cat: the category to initialize.
493  * @name: log category name
494  *
495  * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the
496  * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
497  * @cat. Otherwise @cat will be NULL.
498  *
499  * |[
500  * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
501  * #define GST_CAT_DEFAULT gst_myplugin_debug
502  * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
503  * ...
504  * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
505  * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
506  * ]|
507  *
508  * Since: 0.10.24
509  */
510 #ifdef GST_CAT_DEFAULT
511 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
512   cat = _gst_debug_get_category (name);                 \
513   if (!cat) {                                           \
514     cat = GST_CAT_DEFAULT;                              \
515   }                                                     \
516 }G_STMT_END
517 #else
518 #define GST_DEBUG_CATEGORY_GET(cat,name)  G_STMT_START{\
519   cat = _gst_debug_get_category (name);                 \
520 }G_STMT_END
521 #endif
523 /**
524  * GST_CAT_DEFAULT:
525  *
526  * Default gstreamer core debug log category. Please define your own.
527  */
528 GST_EXPORT GstDebugCategory *   GST_CAT_DEFAULT;
529 /* this symbol may not be used */
530 extern gboolean                 __gst_debug_enabled;
532 /* since 0.10.7, the min debug level, used for quickly discarding debug
533  * messages that fall under the threshold. */
534 GST_EXPORT GstDebugLevel            __gst_debug_min;
536 /**
537  * GST_CAT_LEVEL_LOG:
538  * @cat: category to use
539  * @level: the severity of the message
540  * @object: the #GObject the message belongs to or NULL if none
541  * @...: A printf-style message to output
542  *
543  * Outputs a debugging message. This is the most general macro for outputting
544  * debugging messages. You will probably want to use one of the ones described
545  * below.
546  */
547 #if defined(GST_USING_PRINTF_EXTENSION) && defined(G_HAVE_GNUC_VARARGS)
548 #define GST_CAT_LEVEL_LOG_obj(cat,level,object,str,args...) G_STMT_START{  \
549   if (G_UNLIKELY (level <= __gst_debug_min)) {                             \
550     const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();          \
551     gst_debug_log2 ((cat), (level), &loc, NULL, "%"GST_PTR_FORMAT" "str,   \
552         (object), ##args );                                                \
553   }                                                                        \
554 }G_STMT_END
555 #define GST_CAT_LEVEL_LOG_noobj(cat,level,object,str,args...) G_STMT_START{\
556   if (G_UNLIKELY (level <= __gst_debug_min)) {                             \
557     const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();          \
558     gst_debug_log2 ((cat), (level), &loc, NULL, (str), ##args );           \
559   }                                                                        \
560 }G_STMT_END
561 #else
562 #  define GST_CAT_LEVEL_LOG_obj   GST_CAT_LEVEL_LOG
563 #  define GST_CAT_LEVEL_LOG_noobj GST_CAT_LEVEL_LOG
564 #endif
567 #ifdef G_HAVE_ISO_VARARGS
568 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{           \
569   if (G_UNLIKELY (level <= __gst_debug_min)) {  \
570         const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();   \
571     gst_debug_log2 ((cat), (level), &loc, (GObject *) (object),         \
572             __VA_ARGS__);                                                                                       \
573   }                                                                     \
574 }G_STMT_END
575 #else /* G_HAVE_GNUC_VARARGS */
576 #ifdef G_HAVE_GNUC_VARARGS
577 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{       \
578   if (G_UNLIKELY (level <= __gst_debug_min)) {                                          \
579     const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();       \
580     gst_debug_log2 ((cat), (level), &loc, (GObject *) (object),         \
581             ##args );                                                                                       \
582   }                                                                     \
583 }G_STMT_END
584 #else /* no variadic macros, use inline */
585 static inline void
586 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
587     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
589   if (G_UNLIKELY (level <= __gst_debug_min)) {
590     gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
591         varargs);
592   }
595 static inline void
596 GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
597     gpointer object, const char *format, ...)
599   va_list varargs;
601   va_start (varargs, format);
602   GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
603   va_end (varargs);
605 #endif
606 #endif /* G_HAVE_ISO_VARARGS */
608 /* This one doesn't have varargs in the macro, so it's different than all the
609  * other macros and hence in a separate block right here. Docs chunks are
610  * with the other doc chunks below though. */
611 #define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{       \
612   if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= __gst_debug_min)) {                    \
613     _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__,             \
614         (GObject *) (object), (msg), (data), (length));                       \
615   }                                                                           \
616 }G_STMT_END
618 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length)  \
619     __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
620 #define GST_CAT_MEMDUMP(cat,msg,data,length)             \
621     __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
622 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)          \
623     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
624 #define GST_MEMDUMP(msg,data,length)                     \
625     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
627 /**
628  * GST_CAT_ERROR_OBJECT:
629  * @cat: category to use
630  * @obj: the #GObject the message belongs to
631  * @...: printf-style message to output
632  *
633  * Output an error message belonging to the given object in the given category.
634  */
635 /**
636  * GST_CAT_WARNING_OBJECT:
637  * @cat: category to use
638  * @obj: the #GObject the message belongs to
639  * @...: printf-style message to output
640  *
641  * Output a warning message belonging to the given object in the given category.
642  */
643 /**
644  * GST_CAT_INFO_OBJECT:
645  * @cat: category to use
646  * @obj: the #GObject the message belongs to
647  * @...: printf-style message to output
648  *
649  * Output an informational message belonging to the given object in the given
650  * category.
651  */
652 /**
653  * GST_CAT_DEBUG_OBJECT:
654  * @cat: category to use
655  * @obj: the #GObject the message belongs to
656  * @...: printf-style message to output
657  *
658  * Output an debugging message belonging to the given object in the given category.
659  */
660 /**
661  * GST_CAT_LOG_OBJECT:
662  * @cat: category to use
663  * @obj: the #GObject the message belongs to
664  * @...: printf-style message to output
665  *
666  * Output an logging message belonging to the given object in the given category.
667  */
668 /**
669  * GST_CAT_FIXME_OBJECT:
670  * @cat: category to use
671  * @obj: the #GObject the message belongs to
672  * @...: printf-style message to output
673  *
674  * Output a fixme message belonging to the given object in the given category.
675  *
676  * Since: 0.10.23
677  */
678 /**
679  * GST_CAT_TRACE_OBJECT:
680  * @cat: category to use
681  * @obj: the #GObject the message belongs to
682  * @...: printf-style message to output
683  *
684  * Output a tracing message belonging to the given object in the given
685  * category.
686  *
687  * Since: 0.10.30
688  */
689 /**
690  * GST_CAT_MEMDUMP_OBJECT:
691  * @cat: category to use
692  * @obj: the #GObject the message belongs to
693  * @msg: message string to log with the data
694  * @data: pointer to the data to output
695  * @length: length of the data to output
696  *
697  * Output a hexdump of @data relating to the given object in the given
698  * category.
699  *
700  * Since: 0.10.23
701  */
704 /**
705  * GST_CAT_ERROR:
706  * @cat: category to use
707  * @...: printf-style message to output
708  *
709  * Output an error message in the given category.
710  */
711 /**
712  * GST_CAT_WARNING:
713  * @cat: category to use
714  * @...: printf-style message to output
715  *
716  * Output an warning message in the given category.
717  */
718 /**
719  * GST_CAT_INFO:
720  * @cat: category to use
721  * @...: printf-style message to output
722  *
723  * Output an informational message in the given category.
724  */
725 /**
726  * GST_CAT_DEBUG:
727  * @cat: category to use
728  * @...: printf-style message to output
729  *
730  * Output an debugging message in the given category.
731  */
732 /**
733  * GST_CAT_LOG:
734  * @cat: category to use
735  * @...: printf-style message to output
736  *
737  * Output an logging message in the given category.
738  */
739 /**
740  * GST_CAT_FIXME:
741  * @cat: category to use
742  * @...: printf-style message to output
743  *
744  * Output an fixme message in the given category.
745  *
746  * Since: 0.10.23
747  */
748 /**
749  * GST_CAT_TRACE:
750  * @cat: category to use
751  * @...: printf-style message to output
752  *
753  * Output a tracing message in the given category.
754  *
755  * Since: 0.10.30
756  */
757 /**
758  * GST_CAT_MEMDUMP:
759  * @cat: category to use
760  * @msg: message string to log with the data
761  * @data: pointer to the data to output
762  * @length: length of the data to output
763  *
764  * Output a hexdump of @data in the given category.
765  *
766  * Since: 0.10.23
767  */
770 /**
771  * GST_ERROR_OBJECT:
772  * @obj: the #GObject the message belongs to
773  * @...: printf-style message to output
774  *
775  * Output an error message belonging to the given object in the default category.
776  */
777 /**
778  * GST_WARNING_OBJECT:
779  * @obj: the #GObject the message belongs to
780  * @...: printf-style message to output
781  *
782  * Output a warning message belonging to the given object in the default category.
783  */
784 /**
785  * GST_INFO_OBJECT:
786  * @obj: the #GObject the message belongs to
787  * @...: printf-style message to output
788  *
789  * Output an informational message belonging to the given object in the default
790  * category.
791  */
792 /**
793  * GST_DEBUG_OBJECT:
794  * @obj: the #GObject the message belongs to
795  * @...: printf-style message to output
796  *
797  * Output a debugging message belonging to the given object in the default
798  * category.
799  */
800 /**
801  * GST_LOG_OBJECT:
802  * @obj: the #GObject the message belongs to
803  * @...: printf-style message to output
804  *
805  * Output a logging message belonging to the given object in the default category.
806  */
807 /**
808  * GST_FIXME_OBJECT:
809  * @obj: the #GObject the message belongs to
810  * @...: printf-style message to output
811  *
812  * Output a fixme message belonging to the given object in the default category.
813  *
814  * Since: 0.10.23
815  */
816 /**
817  * GST_TRACE_OBJECT:
818  * @obj: the #GObject the message belongs to
819  * @...: printf-style message to output
820  *
821  * Output a tracing message belonging to the given object in the default category.
822  *
823  * Since: 0.10.30
824  */
825 /**
826  * GST_MEMDUMP_OBJECT:
827  * @obj: the #GObject the message belongs to
828  * @msg: message string to log with the data
829  * @data: pointer to the data to output
830  * @length: length of the data to output
831  *
832  * Output a logging message belonging to the given object in the default category.
833  *
834  * Since: 0.10.23
835  */
838 /**
839  * GST_ERROR:
840  * @...: printf-style message to output
841  *
842  * Output an error message in the default category.
843  */
844 /**
845  * GST_WARNING:
846  * @...: printf-style message to output
847  *
848  * Output a warning message in the default category.
849  */
850 /**
851  * GST_INFO:
852  * @...: printf-style message to output
853  *
854  * Output an informational message in the default category.
855  */
856 /**
857  * GST_DEBUG:
858  * @...: printf-style message to output
859  *
860  * Output a debugging message in the default category.
861  */
862 /**
863  * GST_LOG:
864  * @...: printf-style message to output
865  *
866  * Output a logging message in the default category.
867  */
868 /**
869  * GST_FIXME:
870  * @...: printf-style message to output
871  *
872  * Output a fixme message in the default category.
873  *
874  * Since: 0.10.23
875  */
876 /**
877  * GST_TRACE:
878  * @...: printf-style message to output
879  *
880  * Output a tracing message in the default category.
881  *
882  * Since: 0.10.30
883  */
884 /**
885  * GST_MEMDUMP:
886  * @msg: message string to log with the data
887  * @data: pointer to the data to output
888  * @length: length of the data to output
889  *
890  * Output a hexdump of @data.
891  *
892  * Since: 0.10.23
893  */
895 #ifdef G_HAVE_ISO_VARARGS
897 #define GST_CAT_ERROR_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
898 #define GST_CAT_WARNING_OBJECT(cat,obj,...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
899 #define GST_CAT_INFO_OBJECT(cat,obj,...)        GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
900 #define GST_CAT_DEBUG_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
901 #define GST_CAT_LOG_OBJECT(cat,obj,...)         GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
902 #define GST_CAT_FIXME_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
903 #define GST_CAT_TRACE_OBJECT(cat,obj,...)       GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
905 #define GST_CAT_ERROR(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
906 #define GST_CAT_WARNING(cat,...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
907 #define GST_CAT_INFO(cat,...)                   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
908 #define GST_CAT_DEBUG(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
909 #define GST_CAT_LOG(cat,...)                    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
910 #define GST_CAT_FIXME(cat,...)                  GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
911 #define GST_CAT_TRACE(cat,...)          GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
913 #define GST_ERROR_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
914 #define GST_WARNING_OBJECT(obj,...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
915 #define GST_INFO_OBJECT(obj,...)        GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
916 #define GST_DEBUG_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
917 #define GST_LOG_OBJECT(obj,...)         GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
918 #define GST_FIXME_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
919 #define GST_TRACE_OBJECT(obj,...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
921 #define GST_ERROR(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
922 #define GST_WARNING(...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
923 #define GST_INFO(...)                   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
924 #define GST_DEBUG(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
925 #define GST_LOG(...)                    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
926 #define GST_FIXME(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
927 #define GST_TRACE(...)          GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, __VA_ARGS__)
929 #else
930 #ifdef G_HAVE_GNUC_VARARGS
932 #define GST_CAT_ERROR_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  ##args )
933 #define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  ##args )
934 #define GST_CAT_INFO_OBJECT(cat,obj,args...)    GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  ##args )
935 #define GST_CAT_DEBUG_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  ##args )
936 #define GST_CAT_LOG_OBJECT(cat,obj,args...)     GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  ##args )
937 #define GST_CAT_FIXME_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  ##args )
938 #define GST_CAT_TRACE_OBJECT(cat,obj,args...)   GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   obj,  ##args )
940 #define GST_CAT_ERROR(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, ##args )
941 #define GST_CAT_WARNING(cat,args...)            GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
942 #define GST_CAT_INFO(cat,args...)               GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, ##args )
943 #define GST_CAT_DEBUG(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, ##args )
944 #define GST_CAT_LOG(cat,args...)                GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, ##args )
945 #define GST_CAT_FIXME(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, ##args )
946 #define GST_CAT_TRACE(cat,args...)              GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE,   NULL, ##args )
948 #define GST_ERROR_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  ##args )
949 #define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  ##args )
950 #define GST_INFO_OBJECT(obj,args...)    GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  ##args )
951 #define GST_DEBUG_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  ##args )
952 #define GST_LOG_OBJECT(obj,args...)     GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  ##args )
953 #define GST_FIXME_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  ##args )
954 #define GST_TRACE_OBJECT(obj,args...)   GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  ##args )
956 #define GST_ERROR(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, ##args )
957 #define GST_WARNING(args...)            GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
958 #define GST_INFO(args...)               GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, ##args )
959 #define GST_DEBUG(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, ##args )
960 #define GST_LOG(args...)                GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, ##args )
961 #define GST_FIXME(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, ##args )
962 #define GST_TRACE(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   NULL, ##args )
964 #else
965 /* no variadic macros, use inline */
966 static inline void
967 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
968     ...)
970   va_list varargs;
972   va_start (varargs, format);
973   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
974   va_end (varargs);
977 static inline void
978 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
979     const char *format, ...)
981   va_list varargs;
983   va_start (varargs, format);
984   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
985   va_end (varargs);
988 static inline void
989 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
990     ...)
992   va_list varargs;
994   va_start (varargs, format);
995   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
996   va_end (varargs);
999 static inline void
1000 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1001     ...)
1003   va_list varargs;
1005   va_start (varargs, format);
1006   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
1007   va_end (varargs);
1010 static inline void
1011 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1012     ...)
1014   va_list varargs;
1016   va_start (varargs, format);
1017   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
1018   va_end (varargs);
1021 static inline void
1022 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1023     ...)
1025   va_list varargs;
1027   va_start (varargs, format);
1028   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
1029   va_end (varargs);
1032 static inline void
1033 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1034     ...)
1036   va_list varargs;
1038   va_start (varargs, format);
1039   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
1040   va_end (varargs);
1043 static inline void
1044 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1046   va_list varargs;
1048   va_start (varargs, format);
1049   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
1050   va_end (varargs);
1053 static inline void
1054 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1056   va_list varargs;
1058   va_start (varargs, format);
1059   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
1060   va_end (varargs);
1063 static inline void
1064 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1066   va_list varargs;
1068   va_start (varargs, format);
1069   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
1070   va_end (varargs);
1073 static inline void
1074 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1076   va_list varargs;
1078   va_start (varargs, format);
1079   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
1080   va_end (varargs);
1083 static inline void
1084 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1086   va_list varargs;
1088   va_start (varargs, format);
1089   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
1090   va_end (varargs);
1093 static inline void
1094 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1096   va_list varargs;
1098   va_start (varargs, format);
1099   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
1100   va_end (varargs);
1103 static inline void
1104 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1106   va_list varargs;
1108   va_start (varargs, format);
1109   GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
1110   va_end (varargs);
1113 static inline void
1114 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1116   va_list varargs;
1118   va_start (varargs, format);
1119   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
1120       varargs);
1121   va_end (varargs);
1124 static inline void
1125 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1127   va_list varargs;
1129   va_start (varargs, format);
1130   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
1131       varargs);
1132   va_end (varargs);
1135 static inline void
1136 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1138   va_list varargs;
1140   va_start (varargs, format);
1141   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
1142       varargs);
1143   va_end (varargs);
1146 static inline void
1147 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1149   va_list varargs;
1151   va_start (varargs, format);
1152   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
1153       varargs);
1154   va_end (varargs);
1157 static inline void
1158 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1160   va_list varargs;
1162   va_start (varargs, format);
1163   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
1164       varargs);
1165   va_end (varargs);
1168 static inline void
1169 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1171   va_list varargs;
1173   va_start (varargs, format);
1174   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
1175       varargs);
1176   va_end (varargs);
1179 static inline void
1180 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1182   va_list varargs;
1184   va_start (varargs, format);
1185   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
1186       varargs);
1187   va_end (varargs);
1190 static inline void
1191 GST_ERROR (const char *format, ...)
1193   va_list varargs;
1195   va_start (varargs, format);
1196   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
1197       varargs);
1198   va_end (varargs);
1201 static inline void
1202 GST_WARNING (const char *format, ...)
1204   va_list varargs;
1206   va_start (varargs, format);
1207   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
1208       varargs);
1209   va_end (varargs);
1212 static inline void
1213 GST_INFO (const char *format, ...)
1215   va_list varargs;
1217   va_start (varargs, format);
1218   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
1219       varargs);
1220   va_end (varargs);
1223 static inline void
1224 GST_DEBUG (const char *format, ...)
1226   va_list varargs;
1228   va_start (varargs, format);
1229   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
1230       varargs);
1231   va_end (varargs);
1234 static inline void
1235 GST_LOG (const char *format, ...)
1237   va_list varargs;
1239   va_start (varargs, format);
1240   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
1241       format, varargs);
1242   va_end (varargs);
1245 static inline void
1246 GST_FIXME (const char *format, ...)
1248   va_list varargs;
1250   va_start (varargs, format);
1251   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
1252       varargs);
1253   va_end (varargs);
1256 static inline void
1257 GST_TRACE (const char *format, ...)
1259   va_list varargs;
1261   va_start (varargs, format);
1262   GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
1263       varargs);
1264   va_end (varargs);
1266 #endif
1267 #endif
1270 /********** function pointer stuff **********/
1272 /**
1273  * GST_DEBUG_REGISTER_FUNCPTR:
1274  * @ptr: pointer to the function to register
1275  *
1276  * Register a pointer to a function with its name, so it can later be used by
1277  * GST_DEBUG_FUNCPTR_NAME().
1278  *
1279  * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr.
1280  *
1281  * Since: 0.10.26
1282  */
1283 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
1284   _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
1285 /**
1286  * GST_DEBUG_FUNCPTR:
1287  * @ptr: pointer to the function to register
1288  *
1289  * Register a pointer to a function with its name, so it can later be used by
1290  * GST_DEBUG_FUNCPTR_NAME().
1291  *
1292  * Returns: the value passed to @ptr.
1293  */
1294 #define GST_DEBUG_FUNCPTR(ptr) \
1295   (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1297 /**
1298  * GST_DEBUG_FUNCPTR_NAME:
1299  * @ptr: address of the function of which to look up the name
1300  *
1301  * Retrieves the name of the function, if it was previously registered with
1302  * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
1303  *
1304  * This macro returns a constant string which must not be modified or
1305  * freed by the caller.
1306  */
1307 #define GST_DEBUG_FUNCPTR_NAME(ptr) \
1308   _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1311 #else /* GST_DISABLE_GST_DEBUG */
1314 #ifndef GST_INFO_C
1316 #if defined(__GNUC__) && __GNUC__ >= 3
1317 #  pragma GCC poison gst_debug_log
1318 #  pragma GCC poison gst_debug_log2
1319 #  pragma GCC poison gst_debug_log_valist
1320 #  pragma GCC poison _gst_debug_category_new
1321 #endif
1323 #define __gst_debug_min GST_LEVEL_NONE
1325 #define _gst_debug_init()                               G_STMT_START{ }G_STMT_END
1327 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1328 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1330 #define gst_debug_level_get_name(level)                         ("NONE")
1331 #define gst_debug_message_get(message)                          ("")
1332 #define gst_debug_add_log_function(func,data)           G_STMT_START{ }G_STMT_END
1333 #define gst_debug_set_active(active)                    G_STMT_START{ }G_STMT_END
1334 #define gst_debug_is_active()                           (FALSE)
1335 #define gst_debug_set_colored(colored)                  G_STMT_START{ }G_STMT_END
1336 #define gst_debug_is_colored()                          (FALSE)
1337 #define gst_debug_set_default_threshold(level)          G_STMT_START{ }G_STMT_END
1338 #define gst_debug_get_default_threshold()               (GST_LEVEL_NONE)
1339 #define gst_debug_set_threshold_for_name(name,level)    G_STMT_START{ }G_STMT_END
1340 #define gst_debug_unset_threshold_for_name(name)        G_STMT_START{ }G_STMT_END
1342 /* we are using dummy function prototypes here to eat ';' as these macros are
1343  * used outside of functions */
1344 #define GST_DEBUG_CATEGORY(var)                         void _gst_debug_dummy_##var (void)
1345 #define GST_DEBUG_CATEGORY_EXTERN(var)                  void _gst_debug_dummy_extern_##var (void)
1346 #define GST_DEBUG_CATEGORY_STATIC(var)                  void _gst_debug_dummy_static_##var (void)
1348 #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc)    G_STMT_START{ }G_STMT_END
1349 #define GST_DEBUG_CATEGORY_GET(var,name)                G_STMT_START{ }G_STMT_END
1350 #define gst_debug_category_free(category)               G_STMT_START{ }G_STMT_END
1351 #define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END
1352 #define gst_debug_category_reset_threshold(category)    G_STMT_START{ }G_STMT_END
1353 #define gst_debug_category_get_threshold(category)      (GST_LEVEL_NONE)
1354 #define gst_debug_category_get_name(cat)                ("")
1355 #define gst_debug_category_get_color(cat)               (0)
1356 #define gst_debug_category_get_description(cat)         ("")
1357 #define gst_debug_get_all_categories()                  (NULL)
1358 #define gst_debug_construct_term_color(colorinfo)       (g_strdup ("00"))
1359 #define gst_debug_construct_win_color(colorinfo)        (0)
1361 #endif /* !GST_INFO_C */
1363 #ifdef G_HAVE_ISO_VARARGS
1365 #define GST_CAT_LEVEL_LOG(cat,level,...)                G_STMT_START{ }G_STMT_END
1367 #define GST_CAT_ERROR_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1368 #define GST_CAT_WARNING_OBJECT(...)                     G_STMT_START{ }G_STMT_END
1369 #define GST_CAT_INFO_OBJECT(...)                        G_STMT_START{ }G_STMT_END
1370 #define GST_CAT_DEBUG_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1371 #define GST_CAT_LOG_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1372 #define GST_CAT_FIXME_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1373 #define GST_CAT_TRACE_OBJECT(...)                       G_STMT_START{ }G_STMT_END
1375 #define GST_CAT_ERROR(...)                              G_STMT_START{ }G_STMT_END
1376 #define GST_CAT_WARNING(...)                            G_STMT_START{ }G_STMT_END
1377 #define GST_CAT_INFO(...)                               G_STMT_START{ }G_STMT_END
1378 #define GST_CAT_DEBUG(...)                              G_STMT_START{ }G_STMT_END
1379 #define GST_CAT_LOG(...)                                G_STMT_START{ }G_STMT_END
1380 #define GST_CAT_FIXME(...)                              G_STMT_START{ }G_STMT_END
1381 #define GST_CAT_TRACE(...)                              G_STMT_START{ }G_STMT_END
1383 #define GST_ERROR_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1384 #define GST_WARNING_OBJECT(...)                         G_STMT_START{ }G_STMT_END
1385 #define GST_INFO_OBJECT(...)                            G_STMT_START{ }G_STMT_END
1386 #define GST_DEBUG_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1387 #define GST_LOG_OBJECT(...)                             G_STMT_START{ }G_STMT_END
1388 #define GST_FIXME_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1389 #define GST_TRACE_OBJECT(...)                           G_STMT_START{ }G_STMT_END
1391 #define GST_ERROR(...)                                  G_STMT_START{ }G_STMT_END
1392 #define GST_WARNING(...)                                G_STMT_START{ }G_STMT_END
1393 #define GST_INFO(...)                                   G_STMT_START{ }G_STMT_END
1394 #define GST_DEBUG(...)                                  G_STMT_START{ }G_STMT_END
1395 #define GST_LOG(...)                                    G_STMT_START{ }G_STMT_END
1396 #define GST_FIXME(...)                                  G_STMT_START{ }G_STMT_END
1397 #define GST_TRACE(...)                                  G_STMT_START{ }G_STMT_END
1399 #else /* !G_HAVE_ISO_VARARGS */
1400 #ifdef G_HAVE_GNUC_VARARGS
1402 #define GST_CAT_LEVEL_LOG(cat,level,args...)            G_STMT_START{ }G_STMT_END
1404 #define GST_CAT_ERROR_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1405 #define GST_CAT_WARNING_OBJECT(args...)                 G_STMT_START{ }G_STMT_END
1406 #define GST_CAT_INFO_OBJECT(args...)                    G_STMT_START{ }G_STMT_END
1407 #define GST_CAT_DEBUG_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1408 #define GST_CAT_LOG_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1409 #define GST_CAT_FIXME_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1410 #define GST_CAT_TRACE_OBJECT(args...)                   G_STMT_START{ }G_STMT_END
1412 #define GST_CAT_ERROR(args...)                          G_STMT_START{ }G_STMT_END
1413 #define GST_CAT_WARNING(args...)                        G_STMT_START{ }G_STMT_END
1414 #define GST_CAT_INFO(args...)                           G_STMT_START{ }G_STMT_END
1415 #define GST_CAT_DEBUG(args...)                          G_STMT_START{ }G_STMT_END
1416 #define GST_CAT_LOG(args...)                            G_STMT_START{ }G_STMT_END
1417 #define GST_CAT_FIXME(args...)                          G_STMT_START{ }G_STMT_END
1418 #define GST_CAT_TRACE(args...)                          G_STMT_START{ }G_STMT_END
1420 #define GST_ERROR_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1421 #define GST_WARNING_OBJECT(args...)                     G_STMT_START{ }G_STMT_END
1422 #define GST_INFO_OBJECT(args...)                        G_STMT_START{ }G_STMT_END
1423 #define GST_DEBUG_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1424 #define GST_LOG_OBJECT(args...)                         G_STMT_START{ }G_STMT_END
1425 #define GST_FIXME_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1426 #define GST_TRACE_OBJECT(args...)                       G_STMT_START{ }G_STMT_END
1428 #define GST_ERROR(args...)                              G_STMT_START{ }G_STMT_END
1429 #define GST_WARNING(args...)                            G_STMT_START{ }G_STMT_END
1430 #define GST_INFO(args...)                               G_STMT_START{ }G_STMT_END
1431 #define GST_DEBUG(args...)                              G_STMT_START{ }G_STMT_END
1432 #define GST_LOG(args...)                                G_STMT_START{ }G_STMT_END
1433 #define GST_FIXME(args...)                              G_STMT_START{ }G_STMT_END
1434 #define GST_TRACE(args...)                              G_STMT_START{ }G_STMT_END
1436 #else /* !G_HAVE_GNUC_VARARGS */
1437 static inline void
1438 GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1439     GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1443 static inline void
1444 GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1445     ...)
1449 static inline void
1450 GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1451     const char *format, ...)
1455 static inline void
1456 GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1457     ...)
1461 static inline void
1462 GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1463     ...)
1467 static inline void
1468 GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1469     ...)
1473 static inline void
1474 GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1475     ...)
1479 static inline void
1480 GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1481     ...)
1485 static inline void
1486 GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1490 static inline void
1491 GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1495 static inline void
1496 GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1500 static inline void
1501 GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1505 static inline void
1506 GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1510 static inline void
1511 GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1515 static inline void
1516 GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1520 static inline void
1521 GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1525 static inline void
1526 GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1530 static inline void
1531 GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1535 static inline void
1536 GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1540 static inline void
1541 GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1545 static inline void
1546 GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1550 static inline void
1551 GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1555 static inline void
1556 GST_ERROR (const char *format, ...)
1560 static inline void
1561 GST_WARNING (const char *format, ...)
1565 static inline void
1566 GST_INFO (const char *format, ...)
1570 static inline void
1571 GST_DEBUG (const char *format, ...)
1575 static inline void
1576 GST_LOG (const char *format, ...)
1580 static inline void
1581 GST_FIXME (const char *format, ...)
1585 static inline void
1586 GST_TRACE (const char *format, ...)
1590 #endif /* G_HAVE_GNUC_VARARGS */
1591 #endif /* G_HAVE_ISO_VARARGS */
1593 #define GST_DEBUG_REGISTER_FUNCPTR(ptr) G_STMT_START{ }G_STMT_END
1594 #define GST_DEBUG_FUNCPTR(ptr) (ptr)
1595 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1597 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
1598 #define GST_CAT_MEMDUMP(cat,msg,data,length)            G_STMT_START{ }G_STMT_END
1599 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)         G_STMT_START{ }G_STMT_END
1600 #define GST_MEMDUMP(msg,data,length)                    G_STMT_START{ }G_STMT_END
1602 #endif /* GST_DISABLE_GST_DEBUG */
1605 void gst_debug_print_stack_trace (void);
1607 G_END_DECLS
1609 #endif /* __GSTINFO_H__ */