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