1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
3 * 2000 Wim Taymans <[email protected]>
4 * 2003 Benjamin Otte <[email protected]>
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., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#ifndef __GSTINFO_H__
25#define __GSTINFO_H__
26
27#include <glib.h>
28#include <glib-object.h>
29#include <gst/gstconfig.h>
30
31G_BEGIN_DECLS
32
33/**
34 * GstDebugLevel:
35 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
36 * debugging output.
37 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occurred
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_error.
41 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
42 * that could lead to problems or weird behaviour later on. An example of this
43 * would be clocking issues ("your computer is pretty slow") or broken input
44 * data ("Can't synchronize to stream.")
45 * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
46 * in the executed code path is not fully implemented or handled yet. Note
47 * that this does not replace proper error handling in any way, the purpose
48 * of this message is to make it easier to spot incomplete/unfinished pieces
49 * of code when reading the debug log.
50 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
51 * updated about what is happening.
52 * Examples where this should be used are when a typefind function has
53 * successfully determined the type of the stream or when an mp3 plugin detects
54 * the format to be used. ("This file has mono sound.")
55 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
56 * happens that is not the expected default behavior, or something that's
57 * useful to know but doesn't happen all the time (ie. per loop iteration or
58 * buffer processed or event handled).
59 * An example would be notifications about state changes or receiving/sending
60 * of events.
61 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
62 * useful to know. As a rule of thumb a pipeline that is running as expected
63 * should never output anything else but LOG messages whilst processing data.
64 * Use this log level to log recurring information in chain functions and
65 * loop functions, for example.
66 * @GST_LEVEL_TRACE: Tracing-related messages.
67 * Examples for this are referencing/dereferencing of objects.
68 * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
69 * data as memory dumps in the log. They will be displayed as hexdump with
70 * ASCII characters.
71 * @GST_LEVEL_COUNT: The number of defined debugging levels.
72 *
73 * The level defines the importance of a debugging message. The more important a
74 * message is, the greater the probability that the debugging system outputs it.
75 */
76typedef enum {
77 GST_LEVEL_NONE = 0,
78 GST_LEVEL_ERROR = 1,
79 GST_LEVEL_WARNING = 2,
80 GST_LEVEL_FIXME = 3,
81 GST_LEVEL_INFO = 4,
82 GST_LEVEL_DEBUG = 5,
83 GST_LEVEL_LOG = 6,
84 GST_LEVEL_TRACE = 7,
85 /* add more */
86 GST_LEVEL_MEMDUMP = 9,
87 /* add more */
88 GST_LEVEL_COUNT
89} GstDebugLevel;
90
91/**
92 * GST_LEVEL_DEFAULT:
93 *
94 * Defines the default debugging level to be used with GStreamer. It is normally
95 * set to #GST_LEVEL_NONE so nothing get printed.
96 * As it can be configured at compile time, developer builds may chose to
97 * override that though.
98 * You can use this as an argument to gst_debug_set_default_threshold() to
99 * reset the debugging output to default behaviour.
100 */
101#ifndef GST_LEVEL_DEFAULT
102#define GST_LEVEL_DEFAULT GST_LEVEL_NONE
103#endif
104
105/**
106 * GST_LEVEL_MAX:
107 *
108 * Defines the maximum debugging level to be enabled at compilation time. By default
109 * it is set such that all debugging statements will be enabled.
110 *
111 * If you wish to compile GStreamer and plugins with only some debugging statements
112 * (Such as just warnings and errors), you can define it at compile time to the
113 * maximum debug level. Any debug statements above that level will be compiled out.
114 *
115 * Since: 1.6
116 */
117#ifndef GST_LEVEL_MAX
118#define GST_LEVEL_MAX GST_LEVEL_COUNT
119#endif
120
121/* defines for format (colors etc)
122 * don't change them around, it uses terminal layout
123 * Terminal color strings:
124 * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
125 * Text color codes:
126 * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
127 * Background color codes:
128 * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
129 */
130/**
131 * GstDebugColorFlags:
132 * @GST_DEBUG_FG_BLACK: Use black as foreground color.
133 * @GST_DEBUG_FG_RED: Use red as foreground color.
134 * @GST_DEBUG_FG_GREEN: Use green as foreground color.
135 * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
136 * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
137 * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
138 * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
139 * @GST_DEBUG_FG_WHITE: Use white as foreground color.
140 * @GST_DEBUG_BG_BLACK: Use black as background color.
141 * @GST_DEBUG_BG_RED: Use red as background color.
142 * @GST_DEBUG_BG_GREEN: Use green as background color.
143 * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
144 * @GST_DEBUG_BG_BLUE: Use blue as background color.
145 * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
146 * @GST_DEBUG_BG_CYAN: Use cyan as background color.
147 * @GST_DEBUG_BG_WHITE: Use white as background color.
148 * @GST_DEBUG_BOLD: Make the output bold.
149 * @GST_DEBUG_UNDERLINE: Underline the output.
150 *
151 * These are some terminal style flags you can use when creating your
152 * debugging categories to make them stand out in debugging output.
153 */
154typedef enum { /*< flags >*/
155 /* colors */
156 GST_DEBUG_FG_BLACK = 0x0000,
157 GST_DEBUG_FG_RED = 0x0001,
158 GST_DEBUG_FG_GREEN = 0x0002,
159 GST_DEBUG_FG_YELLOW = 0x0003,
160 GST_DEBUG_FG_BLUE = 0x0004,
161 GST_DEBUG_FG_MAGENTA = 0x0005,
162 GST_DEBUG_FG_CYAN = 0x0006,
163 GST_DEBUG_FG_WHITE = 0x0007,
164 /* background colors */
165 GST_DEBUG_BG_BLACK = 0x0000,
166 GST_DEBUG_BG_RED = 0x0010,
167 GST_DEBUG_BG_GREEN = 0x0020,
168 GST_DEBUG_BG_YELLOW = 0x0030,
169 GST_DEBUG_BG_BLUE = 0x0040,
170 GST_DEBUG_BG_MAGENTA = 0x0050,
171 GST_DEBUG_BG_CYAN = 0x0060,
172 GST_DEBUG_BG_WHITE = 0x0070,
173 /* other formats */
174 GST_DEBUG_BOLD = 0x0100,
175 GST_DEBUG_UNDERLINE = 0x0200
176} GstDebugColorFlags;
177
178/**
179 * GstStackTraceFlags:
180 * @GST_STACK_TRACE_SHOW_FULL: Try to retrieve as much information as
181 * possible when getting the stack trace
182 *
183 * Since: 1.12
184 */
185typedef enum {
186 GST_STACK_TRACE_SHOW_FULL = 1 << 0
187} GstStackTraceFlags;
188
189/**
190 * GstDebugColorMode:
191 * @GST_DEBUG_COLOR_MODE_OFF: Do not use colors in logs.
192 * @GST_DEBUG_COLOR_MODE_ON: Paint logs in a platform-specific way.
193 * @GST_DEBUG_COLOR_MODE_UNIX: Paint logs with UNIX terminal color codes
194 * no matter what platform GStreamer is running on.
195 */
196typedef enum {
197 GST_DEBUG_COLOR_MODE_OFF = 0,
198 GST_DEBUG_COLOR_MODE_ON = 1,
199 GST_DEBUG_COLOR_MODE_UNIX = 2
200} GstDebugColorMode;
201
202
203#define GST_DEBUG_FG_MASK (0x000F)
204#define GST_DEBUG_BG_MASK (0x00F0)
205#define GST_DEBUG_FORMAT_MASK (0xFF00)
206
207typedef struct _GstDebugCategory GstDebugCategory;
208/**
209 * GstDebugCategory:
210 *
211 * This is the struct that describes the categories. Once initialized with
212 * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
213 */
214struct _GstDebugCategory {
215 /*< private >*/
216 gint threshold;
217 guint color; /* see defines above */
218
219 const gchar * name;
220 const gchar * description;
221};
222
223/********** some convenience macros for debugging **********/
224
225/**
226 * GST_STR_NULL:
227 * @str: (allow-none): The string to check.
228 *
229 * Macro to use when a string must not be %NULL, but may be %NULL. If the string
230 * is %NULL, "(NULL)" is printed instead.
231 * In GStreamer printf string arguments may not be %NULL, because on some
232 * platforms (ie Solaris) the libc crashes in that case. This includes debugging
233 * strings.
234 */
235#define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
236
237/* FIXME, not MT safe */
238/**
239 * GST_DEBUG_PAD_NAME:
240 * @pad: The pad to debug.
241 *
242 * Evaluates to 2 strings, that describe the pad. Often used in debugging
243 * statements.
244 */
245#define GST_DEBUG_PAD_NAME(pad) \
246 (pad != NULL) ? \
247 ((GST_OBJECT_PARENT(pad) != NULL) ? \
248 GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
249 "''" ) : "''", \
250 (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
251
252/**
253 * GST_FUNCTION:
254 *
255 * This macro should evaluate to the name of the current function and be should
256 * be defined when configuring your project, as it is compiler dependent. If it
257 * is not defined, some default value is used. It is used to provide debugging
258 * output with the function name of the message.
259 *
260 * Note that this is different from G_STRFUNC as we do not want the full
261 * function signature in C++ code.
262 */
263#ifndef GST_FUNCTION
264#if defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
265# define GST_FUNCTION ((const char*) (__func__))
266#elif defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
267# define GST_FUNCTION ((const char*) (__FUNCTION__))
268#else
269# define GST_FUNCTION ((const char*) ("???"))
270#endif
271#endif /* ifndef GST_FUNCTION */
272
273/**
274 * GST_PTR_FORMAT: (skip):
275 *
276 * printf format type used to debug GStreamer types. You can use this in
277 * combination with GStreamer's debug logging system as well as the functions
278 * gst_info_vasprintf(), gst_info_strdup_vprintf() and gst_info_strdup_printf()
279 * to pretty-print the following types: #GstCaps, #GstStructure,
280 * #GstCapsFeatures, #GstTagList, #GstDateTime, #GstBuffer, #GstBufferList,
281 * #GstMessage, #GstEvent, #GstQuery, #GstContext, #GstPad, #GstObject. All
282 * #GObject types will be printed as typename plus pointer, and everything
283 * else will simply be printed as pointer address.
284 *
285 * This can only be used on types whose size is >= sizeof(gpointer).
286 */
287#define GST_PTR_FORMAT "p\aA"
288
289/**
290 * GST_SEGMENT_FORMAT: (skip):
291 *
292 * printf format type used to debug GStreamer segments. You can use this in
293 * combination with GStreamer's debug logging system as well as the functions
294 * gst_info_vasprintf(), gst_info_strdup_vprintf() and gst_info_strdup_printf()
295 * to pretty-print #GstSegment structures.
296 * This can only be used on pointers to GstSegment structures.
297 */
298#define GST_SEGMENT_FORMAT "p\aB"
299
300typedef struct _GstDebugMessage GstDebugMessage;
301
302/**
303 * GstLogFunction:
304 * @category: a #GstDebugCategory
305 * @level: a #GstDebugLevel
306 * @file: file name
307 * @function: function name
308 * @line: line number
309 * @object: a #GObject
310 * @message: the message
311 * @user_data: user data for the log function
312 *
313 * Function prototype for a logging function that can be registered with
314 * gst_debug_add_log_function().
315 * Use G_GNUC_NO_INSTRUMENT on that function.
316 */
317typedef void (*GstLogFunction) (GstDebugCategory * category,
318 GstDebugLevel level,
319 const gchar * file,
320 const gchar * function,
321 gint line,
322 GObject * object,
323 GstDebugMessage * message,
324 gpointer user_data);
325
326GST_API
327void gst_debug_log (GstDebugCategory * category,
328 GstDebugLevel level,
329 const gchar * file,
330 const gchar * function,
331 gint line,
332 GObject * object,
333 const gchar * format,
334 ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
335GST_API
336void gst_debug_log_valist (GstDebugCategory * category,
337 GstDebugLevel level,
338 const gchar * file,
339 const gchar * function,
340 gint line,
341 GObject * object,
342 const gchar * format,
343 va_list args) G_GNUC_NO_INSTRUMENT;
344
345/* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro */
346
347GST_API
348GstDebugCategory *_gst_debug_category_new (const gchar * name,
349 guint color,
350 const gchar * description);
351
352/* do not use this function, use the GST_DEBUG_CATEGORY_GET macro */
353
354GST_API
355GstDebugCategory *_gst_debug_get_category (const gchar *name);
356
357
358/* do not use this function, use the GST_CAT_MEMDUMP_* macros */
359
360GST_API
361void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
362 const gchar * func, gint line, GObject * obj, const gchar * msg,
363 const guint8 * data, guint length);
364
365/* we define this to avoid a compiler warning regarding a cast from a function
366 * pointer to a void pointer
367 * (see https://bugzilla.gnome.org/show_bug.cgi?id=309253)
368 */
369typedef void (* GstDebugFuncPtr) (void);
370
371/* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
372
373GST_API
374void _gst_debug_register_funcptr (GstDebugFuncPtr func,
375 const gchar * ptrname);
376GST_API
377const gchar *
378 _gst_debug_nameof_funcptr (GstDebugFuncPtr func) G_GNUC_NO_INSTRUMENT;
379
380
381GST_API
382const gchar * gst_debug_message_get (GstDebugMessage * message);
383
384GST_API
385void gst_debug_log_default (GstDebugCategory * category,
386 GstDebugLevel level,
387 const gchar * file,
388 const gchar * function,
389 gint line,
390 GObject * object,
391 GstDebugMessage * message,
392 gpointer user_data) G_GNUC_NO_INSTRUMENT;
393GST_API
394const gchar * gst_debug_level_get_name (GstDebugLevel level);
395
396GST_API
397void gst_debug_add_log_function (GstLogFunction func,
398 gpointer user_data,
399 GDestroyNotify notify);
400GST_API
401guint gst_debug_remove_log_function (GstLogFunction func);
402
403GST_API
404guint gst_debug_remove_log_function_by_data (gpointer data);
405
406GST_API
407void gst_debug_set_active (gboolean active);
408
409GST_API
410gboolean gst_debug_is_active (void);
411
412GST_API
413void gst_debug_set_colored (gboolean colored);
414
415GST_API
416void gst_debug_set_color_mode (GstDebugColorMode mode);
417
418GST_API
419void gst_debug_set_color_mode_from_string (const gchar * mode);
420
421GST_API
422gboolean gst_debug_is_colored (void);
423
424GST_API
425GstDebugColorMode gst_debug_get_color_mode (void);
426
427GST_API
428void gst_debug_set_default_threshold (GstDebugLevel level);
429
430GST_API
431GstDebugLevel gst_debug_get_default_threshold (void);
432
433GST_API
434void gst_debug_set_threshold_for_name (const gchar * name,
435 GstDebugLevel level);
436GST_API
437void gst_debug_set_threshold_from_string (const gchar * list, gboolean reset);
438
439GST_API
440void gst_debug_unset_threshold_for_name (const gchar * name);
441
442
443GST_API
444void gst_debug_category_free (GstDebugCategory * category);
445
446GST_API
447void gst_debug_category_set_threshold (GstDebugCategory * category,
448 GstDebugLevel level);
449
450GST_API
451void gst_debug_category_reset_threshold (GstDebugCategory * category);
452
453GST_API
454GstDebugLevel gst_debug_category_get_threshold (GstDebugCategory * category);
455
456GST_API
457const gchar * gst_debug_category_get_name (GstDebugCategory * category);
458
459GST_API
460guint gst_debug_category_get_color (GstDebugCategory * category);
461
462GST_API
463const gchar * gst_debug_category_get_description (GstDebugCategory * category);
464
465GST_API
466GSList * gst_debug_get_all_categories (void);
467
468
469GST_API
470gchar * gst_debug_construct_term_color (guint colorinfo);
471
472GST_API
473gint gst_debug_construct_win_color (guint colorinfo);
474
475GST_API
476gint gst_info_vasprintf (gchar ** result,
477 const gchar * format,
478 va_list args) G_GNUC_PRINTF (2, 0);
479GST_API
480gchar * gst_info_strdup_vprintf (const gchar *format, va_list args) G_GNUC_PRINTF (1, 0);
481
482GST_API
483gchar * gst_info_strdup_printf (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
484
485GST_API
486void gst_print (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
487
488GST_API
489void gst_println (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
490
491GST_API
492void gst_printerr (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
493
494GST_API
495void gst_printerrln (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
496
497#ifndef GST_DISABLE_GST_DEBUG
498
499/* cast to void * avoids a warning with gcc 6
500 * see https://bugzilla.gnome.org/show_bug.cgi?id=764526 */
501#define gst_debug_add_log_function(func,data,notify) \
502G_STMT_START{ \
503 if ((func) == (void *) gst_debug_log_default) { \
504 gst_debug_add_log_function(NULL,data,notify); \
505 } else { \
506 gst_debug_add_log_function(func,data,notify); \
507 } \
508}G_STMT_END
509
510#define gst_debug_remove_log_function(func) \
511 ((func) == (void *) gst_debug_log_default) ? \
512 gst_debug_remove_log_function(NULL) : \
513 gst_debug_remove_log_function(func)
514
515/**
516 * GST_DEBUG_CATEGORY:
517 * @cat: the category
518 *
519 * Defines a GstDebugCategory variable.
520 * This macro expands to nothing if debugging is disabled.
521 */
522#define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
523/**
524 * GST_DEBUG_CATEGORY_EXTERN:
525 * @cat: the category
526 *
527 * Declares a GstDebugCategory variable as extern. Use in header files.
528 * This macro expands to nothing if debugging is disabled.
529 */
530#define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
531
532/**
533 * GST_DEBUG_CATEGORY_STATIC:
534 * @cat: the category
535 *
536 * Defines a static GstDebugCategory variable.
537 * This macro expands to nothing if debugging is disabled.
538 */
539#define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
540
541/**
542 * GST_DEBUG_CATEGORY_INIT:
543 * @cat: the category to initialize.
544 * @name: the name of the category.
545 * @color: the colors to use for a color representation or 0 for no color.
546 * @description: optional description of the category.
547 *
548 * Initializes a new #GstDebugCategory with the given properties and set to
549 * the default threshold.
550 *
551 * > This macro expands to nothing if debugging is disabled.
552 * >
553 * > When naming your category, please follow the following conventions to ensure
554 * > that the pattern matching for categories works as expected. It is not
555 * > earth-shattering if you don't follow these conventions, but it would be nice
556 * > for everyone.
557 * >
558 * > If you define a category for a plugin or a feature of it, name the category
559 * > like the feature. So if you wanted to write a "filesrc" element, you would
560 * > name the category "filesrc". Use lowercase letters only.
561 * > If you define more than one category for the same element, append an
562 * > underscore and an identifier to your categories, like this: "filesrc_cache"
563 * >
564 * > If you create a library or an application using debugging categories, use a
565 * > common prefix followed by an underscore for all your categories. GStreamer
566 * > uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
567 * > to include uppercase letters.
568 *
569 */
570#define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
571 if (cat == NULL) \
572 cat = _gst_debug_category_new (name,color,description); \
573}G_STMT_END
574
575/**
576 * GST_DEBUG_CATEGORY_GET:
577 * @cat: the category to initialize.
578 * @name: log category name
579 *
580 * Looks up an existing #GstDebugCategory by its @name and sets @cat. If the
581 * category is not found, but GST_CAT_DEFAULT is defined, that is assigned to
582 * @cat. Otherwise @cat will be %NULL.
583 *
584 * |[<!-- language="C" -->
585 * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
586 * #define GST_CAT_DEFAULT gst_myplugin_debug
587 * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
588 * ...
589 * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
590 * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
591 * ]|
592 */
593#ifdef GST_CAT_DEFAULT
594#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
595 cat = _gst_debug_get_category (name); \
596 if (!cat) { \
597 cat = GST_CAT_DEFAULT; \
598 } \
599}G_STMT_END
600#else
601#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
602 cat = _gst_debug_get_category (name); \
603}G_STMT_END
604#endif
605
606/**
607 * GST_CAT_DEFAULT:
608 *
609 * Default gstreamer core debug log category. Please define your own.
610 */
611
612GST_API GstDebugCategory * GST_CAT_DEFAULT;
613/* this symbol may not be used */
614
615GST_API gboolean _gst_debug_enabled;
616
617/* the min debug level, used for quickly discarding debug
618 * messages that fall under the threshold. */
619
620GST_API GstDebugLevel _gst_debug_min;
621
622/**
623 * GST_CAT_LEVEL_LOG:
624 * @cat: category to use
625 * @level: the severity of the message
626 * @object: (allow-none): the #GObject the message belongs to or %NULL if none
627 * @...: A printf-style message to output
628 *
629 * Outputs a debugging message. This is the most general macro for outputting
630 * debugging messages. You will probably want to use one of the ones described
631 * below.
632 *
633 * There is no need to finish the end of the debug message with a newline
634 * character, a newline character will be added automatically.
635 */
636#ifdef G_HAVE_ISO_VARARGS
637#define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \
638 if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
639 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
640 (GObject *) (object), __VA_ARGS__); \
641 } \
642}G_STMT_END
643#else /* G_HAVE_GNUC_VARARGS */
644#ifdef G_HAVE_GNUC_VARARGS
645#define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \
646 if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) { \
647 gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \
648 (GObject *) (object), ##args ); \
649 } \
650}G_STMT_END
651#else /* no variadic macros, use inline */
652static inline void
653GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
654 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
655{
656 if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {
657 gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
658 varargs);
659 }
660}
661
662static inline void
663GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
664 gpointer object, const char *format, ...)
665{
666 va_list varargs;
667
668 va_start (varargs, format);
669 GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
670 va_end (varargs);
671}
672#endif
673#endif /* G_HAVE_ISO_VARARGS */
674
675/* This one doesn't have varargs in the macro, so it's different than all the
676 * other macros and hence in a separate block right here. Docs chunks are
677 * with the other doc chunks below though. */
678#define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{ \
679 if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= GST_LEVEL_MAX && \
680 GST_LEVEL_MEMDUMP <= _gst_debug_min)) { \
681 _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__, \
682 (GObject *) (object), (msg), (data), (length)); \
683 } \
684}G_STMT_END
685
686#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) \
687 __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
688#define GST_CAT_MEMDUMP(cat,msg,data,length) \
689 __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
690#define GST_MEMDUMP_OBJECT(obj,msg,data,length) \
691 __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
692#define GST_MEMDUMP(msg,data,length) \
693 __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
694
695/**
696 * GST_CAT_ERROR_OBJECT:
697 * @cat: category to use
698 * @obj: the #GObject the message belongs to
699 * @...: printf-style message to output
700 *
701 * Output an error message belonging to the given object in the given category.
702 *
703 * There is no need to finish the end of the message string with a newline
704 * character, a newline character will be added automatically.
705 */
706/**
707 * GST_CAT_WARNING_OBJECT:
708 * @cat: category to use
709 * @obj: the #GObject the message belongs to
710 * @...: printf-style message to output
711 *
712 * Output a warning message belonging to the given object in the given category.
713 *
714 * There is no need to finish the end of the message string with a newline
715 * character, a newline character will be added automatically.
716 */
717/**
718 * GST_CAT_INFO_OBJECT:
719 * @cat: category to use
720 * @obj: the #GObject the message belongs to
721 * @...: printf-style message to output
722 *
723 * Output an informational message belonging to the given object in the given
724 * category.
725 *
726 * There is no need to finish the end of the message string with a newline
727 * character, a newline character will be added automatically.
728 */
729/**
730 * GST_CAT_DEBUG_OBJECT:
731 * @cat: category to use
732 * @obj: the #GObject the message belongs to
733 * @...: printf-style message to output
734 *
735 * Output an debugging message belonging to the given object in the given category.
736 *
737 * There is no need to finish the end of the message string with a newline
738 * character, a newline character will be added automatically.
739 */
740/**
741 * GST_CAT_LOG_OBJECT:
742 * @cat: category to use
743 * @obj: the #GObject the message belongs to
744 * @...: printf-style message to output
745 *
746 * Output an logging message belonging to the given object in the given category.
747 *
748 * There is no need to finish the end of the message string with a newline
749 * character, a newline character will be added automatically.
750 */
751/**
752 * GST_CAT_FIXME_OBJECT:
753 * @cat: category to use
754 * @obj: the #GObject the message belongs to
755 * @...: printf-style message to output
756 *
757 * Output a fixme message belonging to the given object in the given category.
758 *
759 * There is no need to finish the end of the message string with a newline
760 * character, a newline character will be added automatically.
761 */
762/**
763 * GST_CAT_TRACE_OBJECT:
764 * @cat: category to use
765 * @obj: the #GObject the message belongs to
766 * @...: printf-style message to output
767 *
768 * Output a tracing message belonging to the given object in the given
769 * category.
770 *
771 * There is no need to finish the end of the message string with a newline
772 * character, a newline character will be added automatically.
773 */
774/**
775 * GST_CAT_MEMDUMP_OBJECT:
776 * @cat: category to use
777 * @obj: the #GObject the message belongs to
778 * @msg: message string to log with the data
779 * @data: pointer to the data to output
780 * @length: length of the data to output
781 *
782 * Output a hexdump of @data relating to the given object in the given
783 * category.
784 *
785 * There is no need to finish the end of the message string with a newline
786 * character, a newline character will be added automatically.
787 */
788
789
790/**
791 * GST_CAT_ERROR:
792 * @cat: category to use
793 * @...: printf-style message to output
794 *
795 * Output an error message in the given category.
796 *
797 * There is no need to finish the end of the message string with a newline
798 * character, a newline character will be added automatically.
799 */
800/**
801 * GST_CAT_WARNING:
802 * @cat: category to use
803 * @...: printf-style message to output
804 *
805 * Output an warning message in the given category.
806 *
807 * There is no need to finish the end of the message string with a newline
808 * character, a newline character will be added automatically.
809 */
810/**
811 * GST_CAT_INFO:
812 * @cat: category to use
813 * @...: printf-style message to output
814 *
815 * Output an informational message in the given category.
816 *
817 * There is no need to finish the end of the message string with a newline
818 * character, a newline character will be added automatically.
819 */
820/**
821 * GST_CAT_DEBUG:
822 * @cat: category to use
823 * @...: printf-style message to output
824 *
825 * Output an debugging message in the given category.
826 *
827 * There is no need to finish the end of the message string with a newline
828 * character, a newline character will be added automatically.
829 */
830/**
831 * GST_CAT_LOG:
832 * @cat: category to use
833 * @...: printf-style message to output
834 *
835 * Output an logging message in the given category.
836 *
837 * There is no need to finish the end of the message string with a newline
838 * character, a newline character will be added automatically.
839 */
840/**
841 * GST_CAT_FIXME:
842 * @cat: category to use
843 * @...: printf-style message to output
844 *
845 * Output an fixme message in the given category.
846 *
847 * There is no need to finish the end of the message string with a newline
848 * character, a newline character will be added automatically.
849 */
850/**
851 * GST_CAT_TRACE:
852 * @cat: category to use
853 * @...: printf-style message to output
854 *
855 * Output a tracing message in the given category.
856 *
857 * There is no need to finish the end of the message string with a newline
858 * character, a newline character will be added automatically.
859 */
860/**
861 * GST_CAT_MEMDUMP:
862 * @cat: category to use
863 * @msg: message string to log with the data
864 * @data: pointer to the data to output
865 * @length: length of the data to output
866 *
867 * Output a hexdump of @data in the given category.
868 *
869 * There is no need to finish the end of the message string with a newline
870 * character, a newline character will be added automatically.
871 */
872
873
874/**
875 * GST_ERROR_OBJECT:
876 * @obj: the #GObject the message belongs to
877 * @...: printf-style message to output
878 *
879 * Output an error message belonging to the given object in the default category.
880 *
881 * There is no need to finish the end of the message string with a newline
882 * character, a newline character will be added automatically.
883 */
884/**
885 * GST_WARNING_OBJECT:
886 * @obj: the #GObject the message belongs to
887 * @...: printf-style message to output
888 *
889 * Output a warning message belonging to the given object in the default category.
890 *
891 * There is no need to finish the end of the message string with a newline
892 * character, a newline character will be added automatically.
893 */
894/**
895 * GST_INFO_OBJECT:
896 * @obj: the #GObject the message belongs to
897 * @...: printf-style message to output
898 *
899 * Output an informational message belonging to the given object in the default
900 * category.
901 *
902 * There is no need to finish the end of the message string with a newline
903 * character, a newline character will be added automatically.
904 */
905/**
906 * GST_DEBUG_OBJECT:
907 * @obj: the #GObject the message belongs to
908 * @...: printf-style message to output
909 *
910 * Output a debugging message belonging to the given object in the default
911 * category.
912 *
913 * There is no need to finish the end of the message string with a newline
914 * character, a newline character will be added automatically.
915 */
916/**
917 * GST_LOG_OBJECT:
918 * @obj: the #GObject the message belongs to
919 * @...: printf-style message to output
920 *
921 * Output a logging message belonging to the given object in the default category.
922 *
923 * There is no need to finish the end of the message string with a newline
924 * character, a newline character will be added automatically.
925 */
926/**
927 * GST_FIXME_OBJECT:
928 * @obj: the #GObject the message belongs to
929 * @...: printf-style message to output
930 *
931 * Output a fixme message belonging to the given object in the default category.
932 *
933 * There is no need to finish the end of the message string with a newline
934 * character, a newline character will be added automatically.
935 */
936/**
937 * GST_TRACE_OBJECT:
938 * @obj: the #GObject the message belongs to
939 * @...: printf-style message to output
940 *
941 * Output a tracing message belonging to the given object in the default category.
942 *
943 * There is no need to finish the end of the message string with a newline
944 * character, a newline character will be added automatically.
945 */
946/**
947 * GST_MEMDUMP_OBJECT:
948 * @obj: the #GObject the message belongs to
949 * @msg: message string to log with the data
950 * @data: pointer to the data to output
951 * @length: length of the data to output
952 *
953 * Output a logging message belonging to the given object in the default category.
954 *
955 * There is no need to finish the end of the message string with a newline
956 * character, a newline character will be added automatically.
957 */
958
959
960/**
961 * GST_ERROR:
962 * @...: printf-style message to output
963 *
964 * Output an error message in the default category.
965 *
966 * There is no need to finish the end of the message string with a newline
967 * character, a newline character will be added automatically.
968 */
969/**
970 * GST_WARNING:
971 * @...: printf-style message to output
972 *
973 * Output a warning message in the default category.
974 *
975 * There is no need to finish the end of the message string with a newline
976 * character, a newline character will be added automatically.
977 */
978/**
979 * GST_INFO:
980 * @...: printf-style message to output
981 *
982 * Output an informational message in the default category.
983 *
984 * There is no need to finish the end of the message string with a newline
985 * character, a newline character will be added automatically.
986 */
987/**
988 * GST_DEBUG:
989 * @...: printf-style message to output
990 *
991 * Output a debugging message in the default category.
992 *
993 * There is no need to finish the end of the message string with a newline
994 * character, a newline character will be added automatically.
995 */
996/**
997 * GST_LOG:
998 * @...: printf-style message to output
999 *
1000 * Output a logging message in the default category.
1001 *
1002 * There is no need to finish the end of the message string with a newline
1003 * character, a newline character will be added automatically.
1004 */
1005/**
1006 * GST_FIXME:
1007 * @...: printf-style message to output
1008 *
1009 * Output a fixme message in the default category.
1010 *
1011 * There is no need to finish the end of the message string with a newline
1012 * character, a newline character will be added automatically.
1013 */
1014/**
1015 * GST_TRACE:
1016 * @...: printf-style message to output
1017 *
1018 * Output a tracing message in the default category.
1019 *
1020 * There is no need to finish the end of the message string with a newline
1021 * character, a newline character will be added automatically.
1022 */
1023/**
1024 * GST_MEMDUMP:
1025 * @msg: message string to log with the data
1026 * @data: pointer to the data to output
1027 * @length: length of the data to output
1028 *
1029 * Output a hexdump of @data.
1030 *
1031 * There is no need to finish the end of the message string with a newline
1032 * character, a newline character will be added automatically.
1033 */
1034
1035#ifdef G_HAVE_ISO_VARARGS
1036
1037#define GST_CAT_ERROR_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, __VA_ARGS__)
1038#define GST_CAT_WARNING_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, __VA_ARGS__)
1039#define GST_CAT_INFO_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, __VA_ARGS__)
1040#define GST_CAT_DEBUG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
1041#define GST_CAT_LOG_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, __VA_ARGS__)
1042#define GST_CAT_FIXME_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, __VA_ARGS__)
1043#define GST_CAT_TRACE_OBJECT(cat,obj,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, __VA_ARGS__)
1044
1045#define GST_CAT_ERROR(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
1046#define GST_CAT_WARNING(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
1047#define GST_CAT_INFO(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, __VA_ARGS__)
1048#define GST_CAT_DEBUG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
1049#define GST_CAT_LOG(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, __VA_ARGS__)
1050#define GST_CAT_FIXME(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
1051#define GST_CAT_TRACE(cat,...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
1052
1053#define GST_ERROR_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, __VA_ARGS__)
1054#define GST_WARNING_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, __VA_ARGS__)
1055#define GST_INFO_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, __VA_ARGS__)
1056#define GST_DEBUG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
1057#define GST_LOG_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, __VA_ARGS__)
1058#define GST_FIXME_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, __VA_ARGS__)
1059#define GST_TRACE_OBJECT(obj,...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, __VA_ARGS__)
1060
1061#define GST_ERROR(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, __VA_ARGS__)
1062#define GST_WARNING(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
1063#define GST_INFO(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, __VA_ARGS__)
1064#define GST_DEBUG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, __VA_ARGS__)
1065#define GST_LOG(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, __VA_ARGS__)
1066#define GST_FIXME(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, __VA_ARGS__)
1067#define GST_TRACE(...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, __VA_ARGS__)
1068
1069#else
1070#ifdef G_HAVE_GNUC_VARARGS
1071
1072#define GST_CAT_ERROR_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, obj, ##args )
1073#define GST_CAT_WARNING_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj, ##args )
1074#define GST_CAT_INFO_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, obj, ##args )
1075#define GST_CAT_DEBUG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, obj, ##args )
1076#define GST_CAT_LOG_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, obj, ##args )
1077#define GST_CAT_FIXME_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, obj, ##args )
1078#define GST_CAT_TRACE_OBJECT(cat,obj,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, obj, ##args )
1079
1080#define GST_CAT_ERROR(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR, NULL, ##args )
1081#define GST_CAT_WARNING(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
1082#define GST_CAT_INFO(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO, NULL, ##args )
1083#define GST_CAT_DEBUG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG, NULL, ##args )
1084#define GST_CAT_LOG(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG, NULL, ##args )
1085#define GST_CAT_FIXME(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME, NULL, ##args )
1086#define GST_CAT_TRACE(cat,args...) GST_CAT_LEVEL_LOG (cat, GST_LEVEL_TRACE, NULL, ##args )
1087
1088#define GST_ERROR_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, ##args )
1089#define GST_WARNING_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, ##args )
1090#define GST_INFO_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, ##args )
1091#define GST_DEBUG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, ##args )
1092#define GST_LOG_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, ##args )
1093#define GST_FIXME_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, ##args )
1094#define GST_TRACE_OBJECT(obj,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, ##args )
1095
1096#define GST_ERROR(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, ##args )
1097#define GST_WARNING(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
1098#define GST_INFO(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, ##args )
1099#define GST_DEBUG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, ##args )
1100#define GST_LOG(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL, ##args )
1101#define GST_FIXME(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, ##args )
1102#define GST_TRACE(args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, ##args )
1103
1104#else
1105/* no variadic macros, use inline */
1106static inline void
1107GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1108 ...)
1109{
1110 va_list varargs;
1111
1112 va_start (varargs, format);
1113 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
1114 va_end (varargs);
1115}
1116
1117static inline void
1118GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1119 const char *format, ...)
1120{
1121 va_list varargs;
1122
1123 va_start (varargs, format);
1124 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
1125 va_end (varargs);
1126}
1127
1128static inline void
1129GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1130 ...)
1131{
1132 va_list varargs;
1133
1134 va_start (varargs, format);
1135 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
1136 va_end (varargs);
1137}
1138
1139static inline void
1140GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1141 ...)
1142{
1143 va_list varargs;
1144
1145 va_start (varargs, format);
1146 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
1147 va_end (varargs);
1148}
1149
1150static inline void
1151GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1152 ...)
1153{
1154 va_list varargs;
1155
1156 va_start (varargs, format);
1157 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
1158 va_end (varargs);
1159}
1160
1161static inline void
1162GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1163 ...)
1164{
1165 va_list varargs;
1166
1167 va_start (varargs, format);
1168 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
1169 va_end (varargs);
1170}
1171
1172static inline void
1173GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1174 ...)
1175{
1176 va_list varargs;
1177
1178 va_start (varargs, format);
1179 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, obj, format, varargs);
1180 va_end (varargs);
1181}
1182
1183static inline void
1184GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1185{
1186 va_list varargs;
1187
1188 va_start (varargs, format);
1189 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
1190 va_end (varargs);
1191}
1192
1193static inline void
1194GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1195{
1196 va_list varargs;
1197
1198 va_start (varargs, format);
1199 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
1200 va_end (varargs);
1201}
1202
1203static inline void
1204GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1205{
1206 va_list varargs;
1207
1208 va_start (varargs, format);
1209 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
1210 va_end (varargs);
1211}
1212
1213static inline void
1214GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1215{
1216 va_list varargs;
1217
1218 va_start (varargs, format);
1219 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
1220 va_end (varargs);
1221}
1222
1223static inline void
1224GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1225{
1226 va_list varargs;
1227
1228 va_start (varargs, format);
1229 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
1230 va_end (varargs);
1231}
1232
1233static inline void
1234GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1235{
1236 va_list varargs;
1237
1238 va_start (varargs, format);
1239 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
1240 va_end (varargs);
1241}
1242
1243static inline void
1244GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1245{
1246 va_list varargs;
1247
1248 va_start (varargs, format);
1249 GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_TRACE, NULL, format, varargs);
1250 va_end (varargs);
1251}
1252
1253static inline void
1254GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1255{
1256 va_list varargs;
1257
1258 va_start (varargs, format);
1259 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
1260 varargs);
1261 va_end (varargs);
1262}
1263
1264static inline void
1265GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1266{
1267 va_list varargs;
1268
1269 va_start (varargs, format);
1270 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
1271 varargs);
1272 va_end (varargs);
1273}
1274
1275static inline void
1276GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1277{
1278 va_list varargs;
1279
1280 va_start (varargs, format);
1281 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
1282 varargs);
1283 va_end (varargs);
1284}
1285
1286static inline void
1287GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1288{
1289 va_list varargs;
1290
1291 va_start (varargs, format);
1292 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
1293 varargs);
1294 va_end (varargs);
1295}
1296
1297static inline void
1298GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1299{
1300 va_list varargs;
1301
1302 va_start (varargs, format);
1303 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
1304 varargs);
1305 va_end (varargs);
1306}
1307
1308static inline void
1309GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1310{
1311 va_list varargs;
1312
1313 va_start (varargs, format);
1314 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
1315 varargs);
1316 va_end (varargs);
1317}
1318
1319static inline void
1320GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1321{
1322 va_list varargs;
1323
1324 va_start (varargs, format);
1325 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, obj, format,
1326 varargs);
1327 va_end (varargs);
1328}
1329
1330static inline void
1331GST_ERROR (const char *format, ...)
1332{
1333 va_list varargs;
1334
1335 va_start (varargs, format);
1336 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
1337 varargs);
1338 va_end (varargs);
1339}
1340
1341static inline void
1342GST_WARNING (const char *format, ...)
1343{
1344 va_list varargs;
1345
1346 va_start (varargs, format);
1347 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
1348 varargs);
1349 va_end (varargs);
1350}
1351
1352static inline void
1353GST_INFO (const char *format, ...)
1354{
1355 va_list varargs;
1356
1357 va_start (varargs, format);
1358 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
1359 varargs);
1360 va_end (varargs);
1361}
1362
1363static inline void
1364GST_DEBUG (const char *format, ...)
1365{
1366 va_list varargs;
1367
1368 va_start (varargs, format);
1369 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
1370 varargs);
1371 va_end (varargs);
1372}
1373
1374static inline void
1375GST_LOG (const char *format, ...)
1376{
1377 va_list varargs;
1378
1379 va_start (varargs, format);
1380 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
1381 format, varargs);
1382 va_end (varargs);
1383}
1384
1385static inline void
1386GST_FIXME (const char *format, ...)
1387{
1388 va_list varargs;
1389
1390 va_start (varargs, format);
1391 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
1392 varargs);
1393 va_end (varargs);
1394}
1395
1396static inline void
1397GST_TRACE (const char *format, ...)
1398{
1399 va_list varargs;
1400
1401 va_start (varargs, format);
1402 GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, NULL, format,
1403 varargs);
1404 va_end (varargs);
1405}
1406#endif
1407#endif
1408
1409
1410/********** function pointer stuff **********/
1411
1412/**
1413 * GST_DEBUG_REGISTER_FUNCPTR:
1414 * @ptr: pointer to the function to register
1415 *
1416 * Register a pointer to a function with its name, so it can later be used by
1417 * GST_DEBUG_FUNCPTR_NAME().
1418 *
1419 * Use this variant of #GST_DEBUG_FUNCPTR if you do not need to use @ptr.
1420 */
1421#define GST_DEBUG_REGISTER_FUNCPTR(ptr) \
1422 _gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr)
1423/**
1424 * GST_DEBUG_FUNCPTR:
1425 * @ptr: pointer to the function to register
1426 *
1427 * Register a pointer to a function with its name, so it can later be used by
1428 * GST_DEBUG_FUNCPTR_NAME().
1429 *
1430 * Returns: the value passed to @ptr.
1431 */
1432#define GST_DEBUG_FUNCPTR(ptr) \
1433 (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1434
1435/**
1436 * GST_DEBUG_FUNCPTR_NAME:
1437 * @ptr: address of the function of which to look up the name
1438 *
1439 * Retrieves the name of the function, if it was previously registered with
1440 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
1441 *
1442 * This macro returns a constant string which must not be modified or
1443 * freed by the caller.
1444 */
1445#define GST_DEBUG_FUNCPTR_NAME(ptr) \
1446 _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1447
1448
1449#else /* GST_DISABLE_GST_DEBUG */
1450
1451
1452#ifndef GST_INFO_C
1453
1454#if defined(__GNUC__) && __GNUC__ >= 3
1455# pragma GCC poison gst_debug_log
1456# pragma GCC poison gst_debug_log_valist
1457# pragma GCC poison _gst_debug_category_new
1458#endif
1459
1460#define _gst_debug_min GST_LEVEL_NONE
1461
1462#define gst_debug_set_default_threshold(level) G_STMT_START{ }G_STMT_END
1463#define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
1464
1465#define gst_debug_level_get_name(level) ("NONE")
1466#define gst_debug_message_get(message) ("")
1467#define gst_debug_add_log_function(func,data,notify) G_STMT_START{ }G_STMT_END
1468#define gst_debug_set_active(active) G_STMT_START{ }G_STMT_END
1469#define gst_debug_is_active() (FALSE)
1470#define gst_debug_set_colored(colored) G_STMT_START{ }G_STMT_END
1471#define gst_debug_set_color_mode(mode) G_STMT_START{ }G_STMT_END
1472#define gst_debug_set_color_mode_from_string(mode) G_STMT_START{ }G_STMT_END
1473#define gst_debug_is_colored() (FALSE)
1474#define gst_debug_get_color_mode() (GST_DEBUG_COLOR_MODE_OFF)
1475#define gst_debug_set_default_threshold(level) G_STMT_START{ }G_STMT_END
1476#define gst_debug_get_default_threshold() (GST_LEVEL_NONE)
1477#define gst_debug_set_threshold_for_name(name,level) G_STMT_START{ }G_STMT_END
1478#define gst_debug_unset_threshold_for_name(name) G_STMT_START{ }G_STMT_END
1479
1480/* we are using dummy function prototypes here to eat ';' as these macros are
1481 * used outside of functions */
1482#define GST_DEBUG_CATEGORY(var) void _gst_debug_dummy_##var (void)
1483#define GST_DEBUG_CATEGORY_EXTERN(var) void _gst_debug_dummy_extern_##var (void)
1484#define GST_DEBUG_CATEGORY_STATIC(var) void _gst_debug_dummy_static_##var (void)
1485
1486#define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) G_STMT_START{ }G_STMT_END
1487#define GST_DEBUG_CATEGORY_GET(var,name) G_STMT_START{ }G_STMT_END
1488#define gst_debug_category_free(category) G_STMT_START{ }G_STMT_END
1489#define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END
1490#define gst_debug_category_reset_threshold(category) G_STMT_START{ }G_STMT_END
1491#define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE)
1492#define gst_debug_category_get_name(cat) ("")
1493#define gst_debug_category_get_color(cat) (0)
1494#define gst_debug_category_get_description(cat) ("")
1495#define gst_debug_get_all_categories() (NULL)
1496#define gst_debug_construct_term_color(colorinfo) (g_strdup ("00"))
1497#define gst_debug_construct_win_color(colorinfo) (0)
1498
1499#endif /* !GST_INFO_C */
1500
1501#ifdef G_HAVE_ISO_VARARGS
1502
1503#define GST_CAT_LEVEL_LOG(cat,level,...) G_STMT_START{ }G_STMT_END
1504
1505#define GST_CAT_ERROR_OBJECT(...) G_STMT_START{ }G_STMT_END
1506#define GST_CAT_WARNING_OBJECT(...) G_STMT_START{ }G_STMT_END
1507#define GST_CAT_INFO_OBJECT(...) G_STMT_START{ }G_STMT_END
1508#define GST_CAT_DEBUG_OBJECT(...) G_STMT_START{ }G_STMT_END
1509#define GST_CAT_LOG_OBJECT(...) G_STMT_START{ }G_STMT_END
1510#define GST_CAT_FIXME_OBJECT(...) G_STMT_START{ }G_STMT_END
1511#define GST_CAT_TRACE_OBJECT(...) G_STMT_START{ }G_STMT_END
1512
1513#define GST_CAT_ERROR(...) G_STMT_START{ }G_STMT_END
1514#define GST_CAT_WARNING(...) G_STMT_START{ }G_STMT_END
1515#define GST_CAT_INFO(...) G_STMT_START{ }G_STMT_END
1516#define GST_CAT_DEBUG(...) G_STMT_START{ }G_STMT_END
1517#define GST_CAT_LOG(...) G_STMT_START{ }G_STMT_END
1518#define GST_CAT_FIXME(...) G_STMT_START{ }G_STMT_END
1519#define GST_CAT_TRACE(...) G_STMT_START{ }G_STMT_END
1520
1521#define GST_ERROR_OBJECT(...) G_STMT_START{ }G_STMT_END
1522#define GST_WARNING_OBJECT(...) G_STMT_START{ }G_STMT_END
1523#define GST_INFO_OBJECT(...) G_STMT_START{ }G_STMT_END
1524#define GST_DEBUG_OBJECT(...) G_STMT_START{ }G_STMT_END
1525#define GST_LOG_OBJECT(...) G_STMT_START{ }G_STMT_END
1526#define GST_FIXME_OBJECT(...) G_STMT_START{ }G_STMT_END
1527#define GST_TRACE_OBJECT(...) G_STMT_START{ }G_STMT_END
1528
1529#define GST_ERROR(...) G_STMT_START{ }G_STMT_END
1530#define GST_WARNING(...) G_STMT_START{ }G_STMT_END
1531#define GST_INFO(...) G_STMT_START{ }G_STMT_END
1532#define GST_DEBUG(...) G_STMT_START{ }G_STMT_END
1533#define GST_LOG(...) G_STMT_START{ }G_STMT_END
1534#define GST_FIXME(...) G_STMT_START{ }G_STMT_END
1535#define GST_TRACE(...) G_STMT_START{ }G_STMT_END
1536
1537#else /* !G_HAVE_ISO_VARARGS */
1538#ifdef G_HAVE_GNUC_VARARGS
1539
1540#define GST_CAT_LEVEL_LOG(cat,level,args...) G_STMT_START{ }G_STMT_END
1541
1542#define GST_CAT_ERROR_OBJECT(args...) G_STMT_START{ }G_STMT_END
1543#define GST_CAT_WARNING_OBJECT(args...) G_STMT_START{ }G_STMT_END
1544#define GST_CAT_INFO_OBJECT(args...) G_STMT_START{ }G_STMT_END
1545#define GST_CAT_DEBUG_OBJECT(args...) G_STMT_START{ }G_STMT_END
1546#define GST_CAT_LOG_OBJECT(args...) G_STMT_START{ }G_STMT_END
1547#define GST_CAT_FIXME_OBJECT(args...) G_STMT_START{ }G_STMT_END
1548#define GST_CAT_TRACE_OBJECT(args...) G_STMT_START{ }G_STMT_END
1549
1550#define GST_CAT_ERROR(args...) G_STMT_START{ }G_STMT_END
1551#define GST_CAT_WARNING(args...) G_STMT_START{ }G_STMT_END
1552#define GST_CAT_INFO(args...) G_STMT_START{ }G_STMT_END
1553#define GST_CAT_DEBUG(args...) G_STMT_START{ }G_STMT_END
1554#define GST_CAT_LOG(args...) G_STMT_START{ }G_STMT_END
1555#define GST_CAT_FIXME(args...) G_STMT_START{ }G_STMT_END
1556#define GST_CAT_TRACE(args...) G_STMT_START{ }G_STMT_END
1557
1558#define GST_ERROR_OBJECT(args...) G_STMT_START{ }G_STMT_END
1559#define GST_WARNING_OBJECT(args...) G_STMT_START{ }G_STMT_END
1560#define GST_INFO_OBJECT(args...) G_STMT_START{ }G_STMT_END
1561#define GST_DEBUG_OBJECT(args...) G_STMT_START{ }G_STMT_END
1562#define GST_LOG_OBJECT(args...) G_STMT_START{ }G_STMT_END
1563#define GST_FIXME_OBJECT(args...) G_STMT_START{ }G_STMT_END
1564#define GST_TRACE_OBJECT(args...) G_STMT_START{ }G_STMT_END
1565
1566#define GST_ERROR(args...) G_STMT_START{ }G_STMT_END
1567#define GST_WARNING(args...) G_STMT_START{ }G_STMT_END
1568#define GST_INFO(args...) G_STMT_START{ }G_STMT_END
1569#define GST_DEBUG(args...) G_STMT_START{ }G_STMT_END
1570#define GST_LOG(args...) G_STMT_START{ }G_STMT_END
1571#define GST_FIXME(args...) G_STMT_START{ }G_STMT_END
1572#define GST_TRACE(args...) G_STMT_START{ }G_STMT_END
1573
1574#else /* !G_HAVE_GNUC_VARARGS */
1575static inline void
1576GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
1577 GstDebugLevel level, gpointer object, const char *format, va_list varargs)
1578{
1579}
1580
1581static inline void
1582GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1583 ...)
1584{
1585}
1586
1587static inline void
1588GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
1589 const char *format, ...)
1590{
1591}
1592
1593static inline void
1594GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1595 ...)
1596{
1597}
1598
1599static inline void
1600GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1601 ...)
1602{
1603}
1604
1605static inline void
1606GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1607 ...)
1608{
1609}
1610
1611static inline void
1612GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1613 ...)
1614{
1615}
1616
1617static inline void
1618GST_CAT_TRACE_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
1619 ...)
1620{
1621}
1622
1623static inline void
1624GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
1625{
1626}
1627
1628static inline void
1629GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
1630{
1631}
1632
1633static inline void
1634GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
1635{
1636}
1637
1638static inline void
1639GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
1640{
1641}
1642
1643static inline void
1644GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
1645{
1646}
1647
1648static inline void
1649GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
1650{
1651}
1652
1653static inline void
1654GST_CAT_TRACE (GstDebugCategory * cat, const char *format, ...)
1655{
1656}
1657
1658static inline void
1659GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
1660{
1661}
1662
1663static inline void
1664GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
1665{
1666}
1667
1668static inline void
1669GST_INFO_OBJECT (gpointer obj, const char *format, ...)
1670{
1671}
1672
1673static inline void
1674GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
1675{
1676}
1677
1678static inline void
1679GST_LOG_OBJECT (gpointer obj, const char *format, ...)
1680{
1681}
1682
1683static inline void
1684GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
1685{
1686}
1687
1688static inline void
1689GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
1690{
1691}
1692
1693static inline void
1694GST_ERROR (const char *format, ...)
1695{
1696}
1697
1698static inline void
1699GST_WARNING (const char *format, ...)
1700{
1701}
1702
1703static inline void
1704GST_INFO (const char *format, ...)
1705{
1706}
1707
1708static inline void
1709GST_DEBUG (const char *format, ...)
1710{
1711}
1712
1713static inline void
1714GST_LOG (const char *format, ...)
1715{
1716}
1717
1718static inline void
1719GST_FIXME (const char *format, ...)
1720{
1721}
1722
1723static inline void
1724GST_TRACE (const char *format, ...)
1725{
1726}
1727
1728#endif /* G_HAVE_GNUC_VARARGS */
1729#endif /* G_HAVE_ISO_VARARGS */
1730
1731#define GST_DEBUG_REGISTER_FUNCPTR(ptr) G_STMT_START{ }G_STMT_END
1732#define GST_DEBUG_FUNCPTR(ptr) (ptr)
1733#define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
1734
1735#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
1736#define GST_CAT_MEMDUMP(cat,msg,data,length) G_STMT_START{ }G_STMT_END
1737#define GST_MEMDUMP_OBJECT(obj,msg,data,length) G_STMT_START{ }G_STMT_END
1738#define GST_MEMDUMP(msg,data,length) G_STMT_START{ }G_STMT_END
1739
1740#endif /* GST_DISABLE_GST_DEBUG */
1741
1742
1743GST_API
1744void gst_debug_print_stack_trace (void);
1745
1746GST_API
1747gchar * gst_debug_get_stack_trace (GstStackTraceFlags flags);
1748
1749GST_API
1750void gst_debug_add_ring_buffer_logger (guint max_size_per_thread, guint thread_timeout);
1751GST_API
1752void gst_debug_remove_ring_buffer_logger (void);
1753GST_API
1754gchar ** gst_debug_ring_buffer_logger_get_logs (void);
1755
1756G_END_DECLS
1757
1758#endif /* __GSTINFO_H__ */
1759