gstinfo.h 42.7 KB
Newer Older
1
2
3
/* GStreamer
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
 *                    2000 Wim Taymans <wtay@chello.be>
4
 *                    2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
5
 *
6
 * gstinfo.h: debugging functions
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

24
25
#ifndef __GSTINFO_H__
#define __GSTINFO_H__
26

27
28
29
30
#include <glib.h>
#include <glib-object.h>
#include <gst/gstconfig.h>

31
32
33
34
#ifndef M_PI
#define M_PI  3.14159265358979323846
#endif

35
G_BEGIN_DECLS
36

37
38
39
40
/**
 * GstDebugLevel:
 * @GST_LEVEL_NONE: No debugging level specified or desired. Used to deactivate
 *  debugging output.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
41
 * @GST_LEVEL_ERROR: Error messages are to be used only when an error occured
42
43
44
45
 *  that stops the application from keeping working correctly.
 *  An examples is gst_element_error, which outputs a message with this priority.
 *  It does not mean that the application is terminating as with g_errror.
 * @GST_LEVEL_WARNING: Warning messages are to inform about abnormal behaviour
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
46
 *  that could lead to problems or weird behaviour later on. An example of this
47
48
49
50
 *  would be clocking issues ("your computer is pretty slow") or broken input
 *  data ("Can't synchronize to stream.")
 * @GST_LEVEL_INFO: Informational messages should be used to keep the developer
 *  updated about what is happening.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
51
 *  Examples where this should be used are when a typefind function has
52
53
54
 *  successfully determined the type of the stream or when an mp3 plugin detects
 *  the format to be used. ("This file has mono sound.")
 * @GST_LEVEL_DEBUG: Debugging messages should be used when something common
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
55
 *  happens that is not the expected default behavior.
56
57
 *  An example would be notifications about state changes or receiving/sending of
 *  events.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
58
 * @GST_LEVEL_LOG: Log messages are messages that are very common but might be
59
60
61
 *  useful to know. As a rule of thumb a pipeline that is iterating as expected
 *  should never output anzthing else but LOG messages.
 *  Examples for this are referencing/dereferencing of objects or cothread switches.
62
63
64
65
66
67
68
69
 * @GST_LEVEL_FIXME: Fixme messages are messages that indicate that something
 *  in the executed code path is not fully implemented or handled yet. Note
 *  that this does not replace proper error handling in any way, the purpose
 *  of this message is to make it easier to spot incomplete/unfinished pieces
 *  of code when reading the debug log. (Since: 0.10.23)
 * @GST_LEVEL_MEMDUMP: memory dump messages are used to log (small) chunks of
 *  data as memory dumps in the log. They will be displayed as hexdump with
 *  ASCII characters. (Since: 0.10.23)
70
 * @GST_LEVEL_COUNT: The number of defined debugging levels.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
71
72
 *
 * The level defines the importance of a debugging message. The more important a
73
 * message is, the greater the probability that the debugging system outputs it.
74
 */
75
typedef enum {
76
77
78
79
80
81
  GST_LEVEL_NONE = 0,
  GST_LEVEL_ERROR,
  GST_LEVEL_WARNING,
  GST_LEVEL_INFO,
  GST_LEVEL_DEBUG,
  GST_LEVEL_LOG,
82
83
84
  GST_LEVEL_FIXME = 6,
  /* add more */
  GST_LEVEL_MEMDUMP = 9,
85
86
  /* add more */
  GST_LEVEL_COUNT
87
} GstDebugLevel;
88

89
90
91
92
93
94
95
96
97
98
/**
 * GST_LEVEL_DEFAULT:
 *
 * Defines the default debugging level to be used with GStreamer. It is normally
 * set to #GST_LEVEL_NONE so nothing get printed.
 * As it can be configured at compile time, developer builds may chose to
 * override that though.
 * You can use this as an argument to gst_debug_set_default_threshold() to
 * reset the debugging output to default behaviour.
 */
99
#ifndef GST_LEVEL_DEFAULT
100
#define GST_LEVEL_DEFAULT GST_LEVEL_NONE
101
102
#endif

Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
103
104
/* defines for format (colors etc)
 * don't change them around, it uses terminal layout
105
106
107
108
109
110
111
 * Terminal color strings:
 * 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
 * Text color codes:
 * 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
 * Background color codes:
 * 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
 */
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
 * GstDebugColorFlags:
 * @GST_DEBUG_FG_BLACK: Use black as foreground color.
 * @GST_DEBUG_FG_RED: Use red as foreground color.
 * @GST_DEBUG_FG_GREEN: Use green as foreground color.
 * @GST_DEBUG_FG_YELLOW: Use yellow as foreground color.
 * @GST_DEBUG_FG_BLUE: Use blue as foreground color.
 * @GST_DEBUG_FG_MAGENTA: Use magenta as foreground color.
 * @GST_DEBUG_FG_CYAN: Use cyan as foreground color.
 * @GST_DEBUG_FG_WHITE: Use white as foreground color.
 * @GST_DEBUG_BG_BLACK: Use black as background color.
 * @GST_DEBUG_BG_RED: Use red as background color.
 * @GST_DEBUG_BG_GREEN: Use green as background color.
 * @GST_DEBUG_BG_YELLOW: Use yellow as background color.
 * @GST_DEBUG_BG_BLUE: Use blue as background color.
 * @GST_DEBUG_BG_MAGENTA: Use magenta as background color.
 * @GST_DEBUG_BG_CYAN: Use cyan as background color.
 * @GST_DEBUG_BG_WHITE: Use white as background color.
 * @GST_DEBUG_BOLD: Make the output bold.
 * @GST_DEBUG_UNDERLINE: Underline the output.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
132
 *
133
134
135
 * These are some terminal style flags you can use when creating your
 * debugging categories to make them stand out in debugging output.
 */
136
typedef enum {
137
  /* colors */
138
139
140
141
142
143
144
145
  GST_DEBUG_FG_BLACK		= 0x0000,
  GST_DEBUG_FG_RED		= 0x0001,
  GST_DEBUG_FG_GREEN		= 0x0002,
  GST_DEBUG_FG_YELLOW		= 0x0003,
  GST_DEBUG_FG_BLUE		= 0x0004,
  GST_DEBUG_FG_MAGENTA		= 0x0005,
  GST_DEBUG_FG_CYAN		= 0x0006,
  GST_DEBUG_FG_WHITE		= 0x0007,
146
  /* background colors */
147
148
149
150
151
152
153
154
  GST_DEBUG_BG_BLACK		= 0x0000,
  GST_DEBUG_BG_RED		= 0x0010,
  GST_DEBUG_BG_GREEN		= 0x0020,
  GST_DEBUG_BG_YELLOW		= 0x0030,
  GST_DEBUG_BG_BLUE		= 0x0040,
  GST_DEBUG_BG_MAGENTA		= 0x0050,
  GST_DEBUG_BG_CYAN		= 0x0060,
  GST_DEBUG_BG_WHITE		= 0x0070,
155
  /* other formats */
156
157
158
  GST_DEBUG_BOLD		= 0x0100,
  GST_DEBUG_UNDERLINE		= 0x0200
} GstDebugColorFlags;
159
160
161
162
163
164

#define GST_DEBUG_FG_MASK	(0x000F)
#define GST_DEBUG_BG_MASK	(0x00F0)
#define GST_DEBUG_FORMAT_MASK	(0xFF00)

typedef struct _GstDebugCategory GstDebugCategory;
165
166
167
168
169
170
/**
 * GstDebugCategory:
 *
 * This is the struct that describes the categories. Once initialized with
 * #GST_DEBUG_CATEGORY_INIT, its values can't be changed anymore.
 */
171
172
struct _GstDebugCategory {
  /*< private >*/
173
  gint                  threshold;
174
175
176
177
  guint			color;		/* see defines above */

  const gchar *		name;
  const gchar *		description;
178
179
};

180
/********** some convenience macros for debugging **********/
181

182
183
184
185
186
187
188
189
190
191
/**
 * GST_STR_NULL:
 * @str: The string to check.
 *
 * Macro to use when a string must not be NULL, but may be NULL. If the string
 * is NULL, "(NULL)" is printed instead.
 * In GStreamer printf string arguments may not be NULL, because on some
 * platforms (ie Solaris) the libc crashes in that case. This includes debugging
 * strings.
 */
192
#define GST_STR_NULL(str) ((str) ? (str) : "(NULL)")
193

194
/* FIXME, not MT safe */
195
196
197
198
199
200
201
/**
 * GST_DEBUG_PAD_NAME:
 * @pad: The pad to debug.
 *
 * Evaluates to 2 strings, that describe the pad. Often used in debugging
 * statements.
 */
202
#define GST_DEBUG_PAD_NAME(pad) \
203
204
  (pad != NULL) ?  \
  ((GST_OBJECT_PARENT(pad) != NULL) ? \
205
  GST_STR_NULL (GST_OBJECT_NAME (GST_OBJECT_PARENT(pad))) : \
206
  "''" ) : "''", \
207
  (pad != NULL) ? GST_STR_NULL (GST_OBJECT_NAME (pad)) : "''"
208

209
210
211
212
213
214
215
/**
 * GST_FUNCTION:
 *
 * This macro should evaluate to the name of the current function and be should
 * be defined when configuring your project, as it is compiler dependant. If it
 * is not defined, some default value is used. It is used to provide debugging
 * output with the function name of the message.
216
217
218
 *
 * Note that this is different from G_STRFUNC as we do not want the full
 * function signature in C++ code.
219
 */
220
#ifndef GST_FUNCTION
221
222
223
224
225
226
227
#if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300)
#  define GST_FUNCTION     ((const char*) (__FUNCTION__))
#elif defined (G_HAVE_ISO_VARARGS)
#  define GST_FUNCTION     ((const char*) (__func__))
#else
#  define GST_FUNCTION     ((const char*) ("???"))
#endif
228
229
#endif /* ifndef GST_FUNCTION */

230

231
typedef struct _GstDebugMessage GstDebugMessage;
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

/**
 * GstLogFunction:
 * @category: a #GstDebugCategory
 * @level: a #GstDebugLevel
 * @file: file name
 * @function: function name
 * @line: line number
 * @object: a #GObject
 * @message: the message
 * @data: user data for the log function
 *
 * Function prototype for a logging function that can be registered with
 * gst_debug_add_log_function().
 * Use G_GNUC_NO_INSTRUMENT on that function.
 */
248
249
250
251
252
253
254
255
typedef void (*GstLogFunction)  (GstDebugCategory * category,
                                 GstDebugLevel      level,
                                 const gchar      * file,
                                 const gchar      * function,
                                 gint               line,
                                 GObject          * object,
                                 GstDebugMessage  * message,
                                 gpointer           data);
256

257
#ifndef GST_DISABLE_GST_DEBUG
258

259
/* FIXME 0.11: move this into private headers */
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
void            _gst_debug_init (void);


#ifdef GST_USING_PRINTF_EXTENSION

/* not using G_GNUC_PRINTF, since gcc will choke on GST_PTR_FORMAT being %P */
void		    gst_debug_log            (GstDebugCategory * category,
                                          GstDebugLevel      level,
                                          const gchar      * file,
                                          const gchar      * function,
                                          gint               line,
                                          GObject          * object,
                                          const gchar      * format,
                                          ...) G_GNUC_NO_INSTRUMENT;

#else /* GST_USING_PRINTF_EXTENSION */

void		    gst_debug_log            (GstDebugCategory * category,
                                          GstDebugLevel      level,
                                          const gchar      * file,
                                          const gchar      * function,
                                          gint               line,
                                          GObject          * object,
                                          const gchar      * format,
                                          ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;

#endif /* GST_USING_PRINTF_EXTENSION */

void            gst_debug_log_valist     (GstDebugCategory * category,
                                          GstDebugLevel      level,
                                          const gchar      * file,
                                          const gchar      * function,
                                          gint	              line,
                                          GObject          * object,
                                          const gchar      * format,
                                          va_list            args) G_GNUC_NO_INSTRUMENT;

const gchar   * gst_debug_message_get    (GstDebugMessage  * message);

void            gst_debug_log_default    (GstDebugCategory * category,
                                          GstDebugLevel      level,
                                          const gchar      * file,
                                          const gchar      * function,
                                          gint               line,
                                          GObject          * object,
                                          GstDebugMessage  * message,
                                          gpointer           unused) G_GNUC_NO_INSTRUMENT;
307
308

G_CONST_RETURN gchar *
309
                gst_debug_level_get_name (GstDebugLevel level);
310

311
312
313
314
void            gst_debug_add_log_function            (GstLogFunction func,
                                                       gpointer       data);
guint           gst_debug_remove_log_function         (GstLogFunction func);
guint           gst_debug_remove_log_function_by_data (gpointer       data);
315

316
317
void            gst_debug_set_active  (gboolean active);
gboolean        gst_debug_is_active   (void);
318

319
320
void            gst_debug_set_colored (gboolean colored);
gboolean        gst_debug_is_colored  (void);
321

322
323
324
325
326
void            gst_debug_set_default_threshold	    (GstDebugLevel level);
GstDebugLevel   gst_debug_get_default_threshold	    (void);
void            gst_debug_set_threshold_for_name    (const gchar * name,
                                                     GstDebugLevel level);
void            gst_debug_unset_threshold_for_name  (const gchar * name);
327
328
329
330

/**
 * GST_DEBUG_CATEGORY:
 * @cat: the category
331
332
 *
 * Defines a GstDebugCategory variable.
333
334
335
336
337
338
 * This macro expands to nothing if debugging is disabled.
 */
#define GST_DEBUG_CATEGORY(cat) GstDebugCategory *cat = NULL
/**
 * GST_DEBUG_CATEGORY_EXTERN:
 * @cat: the category
339
340
 *
 * Declares a GstDebugCategory variable as extern. Use in header files.
341
342
343
 * This macro expands to nothing if debugging is disabled.
 */
#define GST_DEBUG_CATEGORY_EXTERN(cat) extern GstDebugCategory *cat
344

345
346
347
/**
 * GST_DEBUG_CATEGORY_STATIC:
 * @cat: the category
348
349
 *
 * Defines a static GstDebugCategory variable.
350
351
352
353
 * This macro expands to nothing if debugging is disabled.
 */
#define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
/* do not use this function, use the macros below */
354
355
356
GstDebugCategory *_gst_debug_category_new (const gchar * name,
                                           guint         color,
                                           const gchar * description);
357
358
/**
 * GST_DEBUG_CATEGORY_INIT:
359
360
361
362
363
 * @cat: the category to initialize.
 * @name: the name of the category.
 * @color: the colors to use for a color representation or 0 for no color.
 * @description: optional description of the category.
 *
364
 * Initializes a new #GstDebugCategory with the given properties and set to
365
 * the default threshold.
366
 *
367
368
 * <note>
 * <para>
369
370
371
372
 * This macro expands to nothing if debugging is disabled.
 * </para>
 * <para>
 * When naming your category, please follow the following conventions to ensure
373
374
375
376
377
 * that the pattern matching for categories works as expected. It is not
 * earth-shattering if you don't follow these conventions, but it would be nice
 * for everyone.
 * </para>
 * <para>
378
379
 * If you define a category for a plugin or a feature of it, name the category
 * like the feature. So if you wanted to write a "filesrc" element, you would
Joshua N. Pritikin's avatar
Joshua N. Pritikin committed
380
 * name the category "filesrc". Use lowercase letters only.
381
 * If you define more than one category for the same element, append an
382
383
384
385
386
387
388
389
390
391
 * underscore and an identifier to your categories, like this: "filesrc_cache"
 * </para>
 * <para>
 * If you create a library or an application using debugging categories, use a
 * common prefix followed by an underscore for all your categories. GStreamer
 * uses the GST prefix so GStreamer categories look like "GST_STATES". Be sure
 * to include uppercase letters.
 * </para>
 * </note>
 */
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
392
393
394
#define GST_DEBUG_CATEGORY_INIT(cat,name,color,description) G_STMT_START{\
  if (cat == NULL)							\
    cat = _gst_debug_category_new (name,color,description);		\
395
}G_STMT_END
396

Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
397
398
399
400
401
402
void	gst_debug_category_free		(GstDebugCategory *	category);
void	gst_debug_category_set_threshold (GstDebugCategory *	category,
					 GstDebugLevel		level);
void	gst_debug_category_reset_threshold(GstDebugCategory *	category);
GstDebugLevel
	gst_debug_category_get_threshold (GstDebugCategory *	category);
403
G_CONST_RETURN gchar *
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
404
405
	gst_debug_category_get_name	(GstDebugCategory *	category);
guint	gst_debug_category_get_color	(GstDebugCategory *	category);
406
G_CONST_RETURN gchar *
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
407
408
409
	gst_debug_category_get_description (GstDebugCategory *	category);
GSList *
        gst_debug_get_all_categories	(void);
410

Damien Lespiau's avatar
Damien Lespiau committed
411
gchar * gst_debug_construct_term_color	(guint colorinfo);
Wim Taymans's avatar
Wim Taymans committed
412
gint    gst_debug_construct_win_color (guint colorinfo);
413
414


415
416
417
418
419
/**
 * GST_CAT_DEFAULT:
 *
 * Default gstreamer core debug log category. Please define your own.
 */
420
GST_EXPORT GstDebugCategory *	GST_CAT_DEFAULT;
Benjamin Otte's avatar
Benjamin Otte committed
421
/* this symbol may not be used */
422
extern gboolean			__gst_debug_enabled;
423

424
425
/* since 0.10.7, the min debug level, used for quickly discarding debug
 * messages that fall under the threshold. */
426
GST_EXPORT GstDebugLevel            __gst_debug_min; 
427

428
429
430
431
432
433
434
435
436
437
438
/**
 * GST_CAT_LEVEL_LOG:
 * @cat: category to use
 * @level: the severity of the message
 * @object: the #GObject the message belongs to or NULL if none
 * @...: A printf-style message to output
 *
 * Outputs a debugging message. This is the most general macro for outputting
 * debugging messages. You will probably want to use one of the ones described
 * below.
 */
439
#ifdef G_HAVE_ISO_VARARGS
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
440
#define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{		\
441
  if (G_UNLIKELY (level <= __gst_debug_min)) {						\
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
442
443
444
    gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,	\
        (GObject *) (object), __VA_ARGS__);				\
  }									\
445
446
}G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
447
#ifdef G_HAVE_GNUC_VARARGS
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
448
#define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{	\
449
  if (G_UNLIKELY (level <= __gst_debug_min)) {						\
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
450
451
452
    gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,	\
        (GObject *) (object), ##args );					\
  }									\
453
}G_STMT_END
454
455
456
457
458
#else /* no variadic macros, use inline */
static inline void
GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
    GstDebugLevel level, gpointer object, const char *format, va_list varargs)
{
459
460
461
462
  if (G_UNLIKELY (level <= __gst_debug_min)) {
    gst_debug_log_valist (cat, level, "", "", 0, (GObject *) object, format,
        varargs);
  }
463
464
465
466
467
468
}

static inline void
GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
    gpointer object, const char *format, ...)
{
469
  va_list varargs;
470

471
472
473
  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, level, object, format, varargs);
  va_end (varargs);
474
475
}
#endif
476
#endif /* G_HAVE_ISO_VARARGS */
477

478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
/* private helper function */
void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
    const gchar * func, gint line, GObject * obj, const gchar * msg,
    const guint8 * data, guint length);

/* This one doesn't have varargs in the macro, so it's different than all the
 * other macros and hence in a separate block right here. Docs chunks are
 * with the other doc chunks below though. */
#define __GST_CAT_MEMDUMP_LOG(cat,object,msg,data,length) G_STMT_START{       \
  if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= __gst_debug_min)) {                    \
    _gst_debug_dump_mem ((cat), __FILE__, GST_FUNCTION, __LINE__,             \
        (GObject *) (object), (msg), (data), (length));                       \
  }                                                                           \
}G_STMT_END

#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length)  \
    __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
#define GST_CAT_MEMDUMP(cat,msg,data,length)             \
    __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
#define GST_MEMDUMP_OBJECT(obj,msg,data,length)          \
    __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
#define GST_MEMDUMP(msg,data,length)                     \
    __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)

502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
/**
 * GST_CAT_ERROR_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output an error message belonging to the given object in the given category.
 */
/**
 * GST_CAT_WARNING_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output a warning message belonging to the given object in the given category.
 */
/**
 * GST_CAT_INFO_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output an informational message belonging to the given object in the given
 * category.
 */
/**
 * GST_CAT_DEBUG_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output an debugging message belonging to the given object in the given category.
 */
/**
 * GST_CAT_LOG_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output an logging message belonging to the given object in the given category.
 */
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/**
 * GST_CAT_FIXME_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output a fixme message belonging to the given object in the given category.
 *
 * Since: 0.10.23
 */
/**
 * GST_CAT_MEMDUMP_OBJECT:
 * @cat: category to use
 * @obj: the #GObject the message belongs to
 * @msg: message string to log with the data
 * @data: pointer to the data to output
 * @length: length of the data to output
 *
 * Output a hexdump of @data relating to the given object in the given
 * category.
 *
 * Since: 0.10.23
 */
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602


/**
 * GST_CAT_ERROR:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an error message in the given category.
 */
/**
 * GST_CAT_WARNING:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an warning message in the given category.
 */
/**
 * GST_CAT_INFO:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an informational message in the given category.
 */
/**
 * GST_CAT_DEBUG:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an debugging message in the given category.
 */
/**
 * GST_CAT_LOG:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an logging message in the given category.
 */
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
/**
 * GST_CAT_FIXME:
 * @cat: category to use
 * @...: printf-style message to output
 *
 * Output an fixme message in the given category.
 *
 * Since: 0.10.23
 */
/**
 * GST_CAT_MEMDUMP:
 * @cat: category to use
 * @msg: message string to log with the data
 * @data: pointer to the data to output
 * @length: length of the data to output
 *
 * Output a hexdump of @data in the given category.
 *
 * Since: 0.10.23
 */
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643


/**
 * GST_ERROR_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output an error message belonging to the given object in the default category.
 */
/**
 * GST_WARNING_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output a warning message belonging to the given object in the default category.
 */
/**
 * GST_INFO_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
644
 * Output an informational message belonging to the given object in the default
645
646
647
648
649
650
651
 * category.
 */
/**
 * GST_DEBUG_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
652
 * Output a debugging message belonging to the given object in the default
653
654
655
656
657
658
659
660
661
 * category.
 */
/**
 * GST_LOG_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output a logging message belonging to the given object in the default category.
 */
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
/**
 * GST_FIXME_OBJECT:
 * @obj: the #GObject the message belongs to
 * @...: printf-style message to output
 *
 * Output a logging message belonging to the given object in the default category.
 *
 * Since: 0.10.23
 */
/**
 * GST_MEMDUMP_OBJECT:
 * @obj: the #GObject the message belongs to
 * @msg: message string to log with the data
 * @data: pointer to the data to output
 * @length: length of the data to output
 *
 * Output a logging message belonging to the given object in the default category.
 *
 * Since: 0.10.23
 */
682

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
683

684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
/**
 * GST_ERROR:
 * @...: printf-style message to output
 *
 * Output an error message in the default category.
 */
/**
 * GST_WARNING:
 * @...: printf-style message to output
 *
 * Output a warning message in the default category.
 */
/**
 * GST_INFO:
 * @...: printf-style message to output
 *
 * Output an informational message in the default category.
 */
/**
 * GST_DEBUG:
 * @...: printf-style message to output
 *
 * Output a debugging message in the default category.
 */
/**
 * GST_LOG:
 * @...: printf-style message to output
 *
 * Output a logging message in the default category.
 */
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
/**
 * GST_FIXME:
 * @...: printf-style message to output
 *
 * Output a fixme message in the default category.
 *
 * Since: 0.10.23
 */
/**
 * GST_MEMDUMP:
 * @msg: message string to log with the data
 * @data: pointer to the data to output
 * @length: length of the data to output
 *
 * Output a hexdump of @data.
 *
 * Since: 0.10.23
 */
732

733
734
#ifdef G_HAVE_ISO_VARARGS

735
736
737
738
739
#define GST_CAT_ERROR_OBJECT(cat,obj,...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
#define GST_CAT_WARNING_OBJECT(cat,obj,...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
#define GST_CAT_INFO_OBJECT(cat,obj,...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
#define GST_CAT_DEBUG_OBJECT(cat,obj,...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
#define GST_CAT_LOG_OBJECT(cat,obj,...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
740
#define GST_CAT_FIXME_OBJECT(cat,obj,...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
741
742
743
744
745
746

#define GST_CAT_ERROR(cat,...)			GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
#define GST_CAT_WARNING(cat,...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
#define GST_CAT_INFO(cat,...)			GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
#define GST_CAT_DEBUG(cat,...)			GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
#define GST_CAT_LOG(cat,...)			GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
747
#define GST_CAT_FIXME(cat,...)			GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
748
749
750
751
752
753

#define GST_ERROR_OBJECT(obj,...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  __VA_ARGS__)
#define GST_WARNING_OBJECT(obj,...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  __VA_ARGS__)
#define GST_INFO_OBJECT(obj,...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  __VA_ARGS__)
#define GST_DEBUG_OBJECT(obj,...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  __VA_ARGS__)
#define GST_LOG_OBJECT(obj,...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  __VA_ARGS__)
754
#define GST_FIXME_OBJECT(obj,...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
755
756
757
758
759
760

#define GST_ERROR(...)			GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
#define GST_WARNING(...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
#define GST_INFO(...)			GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
#define GST_DEBUG(...)			GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, __VA_ARGS__)
#define GST_LOG(...)			GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, __VA_ARGS__)
761
#define GST_FIXME(...)			GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, __VA_ARGS__)
762

763
764
#else
#ifdef G_HAVE_GNUC_VARARGS
765
766
767
768
769
770

#define GST_CAT_ERROR_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   obj,  ##args )
#define GST_CAT_WARNING_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, obj,  ##args )
#define GST_CAT_INFO_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    obj,  ##args )
#define GST_CAT_DEBUG_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   obj,  ##args )
#define GST_CAT_LOG_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     obj,  ##args )
771
#define GST_CAT_FIXME_OBJECT(cat,obj,args...)	GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   obj,  ##args )
772
773
774
775
776
777

#define GST_CAT_ERROR(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_ERROR,   NULL, ##args )
#define GST_CAT_WARNING(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_WARNING, NULL, ##args )
#define GST_CAT_INFO(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_INFO,    NULL, ##args )
#define GST_CAT_DEBUG(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_DEBUG,   NULL, ##args )
#define GST_CAT_LOG(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_LOG,     NULL, ##args )
778
#define GST_CAT_FIXME(cat,args...)		GST_CAT_LEVEL_LOG (cat, GST_LEVEL_FIXME,   NULL, ##args )
779
780
781
782
783
784

#define GST_ERROR_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   obj,  ##args )
#define GST_WARNING_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj,  ##args )
#define GST_INFO_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    obj,  ##args )
#define GST_DEBUG_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   obj,  ##args )
#define GST_LOG_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     obj,  ##args )
785
#define GST_FIXME_OBJECT(obj,args...)	GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  ##args )
786
787
788
789
790
791

#define GST_ERROR(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, ##args )
#define GST_WARNING(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
#define GST_INFO(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, ##args )
#define GST_DEBUG(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   NULL, ##args )
#define GST_LOG(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     NULL, ##args )
792
#define GST_FIXME(args...)		GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   NULL, ##args )
793

794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
#else
/* no variadic macros, use inline */
static inline void
GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, obj, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
    const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, obj, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, obj, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, obj, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, obj, format, varargs);
  va_end (varargs);
}

851
852
853
854
855
856
857
858
859
860
861
static inline void
GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, obj, format, varargs);
  va_end (varargs);
}

862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
static inline void
GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_ERROR, NULL, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_WARNING, NULL, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_INFO, NULL, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_DEBUG, NULL, format, varargs);
  va_end (varargs);
}

static inline void
GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_LOG, NULL, format, varargs);
  va_end (varargs);
}

912
913
914
915
916
917
918
919
920
921
static inline void
GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (cat, GST_LEVEL_FIXME, NULL, format, varargs);
  va_end (varargs);
}

922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
static inline void
GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, obj, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, obj, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_INFO_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, obj, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, obj, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_LOG_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, obj, format,
      varargs);
  va_end (varargs);
}

977
978
979
980
981
982
983
984
985
986
987
static inline void
GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, obj, format,
      varargs);
  va_end (varargs);
}

988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
static inline void
GST_ERROR (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, NULL, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_WARNING (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_INFO (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, NULL, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_DEBUG (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, NULL, format,
      varargs);
  va_end (varargs);
}

static inline void
GST_LOG (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, NULL,
      format, varargs);
  va_end (varargs);
}
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052

static inline void
GST_FIXME (const char *format, ...)
{
  va_list varargs;

  va_start (varargs, format);
  GST_CAT_LEVEL_LOG_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, NULL, format,
      varargs);
  va_end (varargs);
}
1053
1054
#endif
#endif
1055
1056


1057
/********** function pointer stuff **********/
1058

1059
1060
typedef	void (* GstDebugFuncPtr)	(void);
void	_gst_debug_register_funcptr	(GstDebugFuncPtr	func,
1061
					 const gchar *		ptrname);
Thomas Vander Stichele's avatar
cleanup    
Thomas Vander Stichele committed
1062
G_CONST_RETURN gchar *
1063
	_gst_debug_nameof_funcptr	(GstDebugFuncPtr	func);
1064

1065
1066
1067
1068
1069
1070
1071
/**
 * GST_DEBUG_FUNCPTR:
 * @ptr: pointer to the function to register
 *
 * Register a pointer to a function with its name, so it can later be used by
 * GST_DEBUG_FUNCPTR_NAME().
 */
1072
1073
#define GST_DEBUG_FUNCPTR(ptr) \
  (_gst_debug_register_funcptr((GstDebugFuncPtr)(ptr), #ptr) , ptr)
1074
1075
1076

/**
 * GST_DEBUG_FUNCPTR_NAME:
1077
 * @ptr: address of the function of which to look up the name
1078
1079
1080
1081
 *
 * Retrieves the name of the function, if it was previously registered with
 * GST_DEBUG_FUNCPTR(). If not, it returns a description of the pointer.
 *
1082
1083
 * This macro returns a constant string which must not be modified or
 * freed by the caller.
1084
 */
1085
1086
#define GST_DEBUG_FUNCPTR_NAME(ptr) \
  _gst_debug_nameof_funcptr((GstDebugFuncPtr)ptr)
1087

1088

1089
#else /* GST_DISABLE_GST_DEBUG */
1090

1091

1092
#if !defined(GST_INFO_C) && defined(__GNUC__) && __GNUC__ >= 3
1093
#  pragma GCC poison gst_debug_log
Benjamin Otte's avatar
Benjamin Otte committed
1094
#  pragma GCC poison gst_debug_log_valist
1095
#  pragma GCC poison _gst_debug_category_new
1096
1097
#endif

1098
#define _gst_debug_init()				/* NOP */
1099

1100
#define gst_debug_set_default_threshold(level)		/* NOP */
1101
1102
#define gst_debug_get_default_threshold()		(GST_LEVEL_NONE)

1103
1104
#define gst_debug_level_get_name(level)				("NONE")
#define gst_debug_message_get(message)  			("NONE")
1105
#define gst_debug_add_log_function(func,data)		/* NOP */
1106
1107
guint gst_debug_remove_log_function (GstLogFunction func);
guint gst_debug_remove_log_function_by_data (gpointer data);
1108
#define gst_debug_set_active(active)			/* NOP */
1109
#define gst_debug_is_active()				(FALSE)
1110
#define gst_debug_set_colored(colored)			/* NOP */
1111
#define gst_debug_is_colored()				(FALSE)
1112
#define gst_debug_set_default_threshold(level)		/* NOP */
1113
1114
1115
1116
#define gst_debug_get_default_threshold()		(GST_LEVEL_NONE)
#define gst_debug_set_threshold_for_name(name,level)	/* NOP */
#define gst_debug_unset_threshold_for_name(name)	/* NOP */

1117
1118
#define GST_DEBUG_CATEGORY(var)				/* NOP */
#define GST_DEBUG_CATEGORY_EXTERN(var)			/* NOP */
1119
1120
1121
#if !defined(G_HAVE_GNUC_VARARGS) && !defined(G_HAVE_ISO_VARARGS)
#define GST_DEBUG_CATEGORY_STATIC(var)			static GstDebugCategory *var = NULL
#else
1122
#define GST_DEBUG_CATEGORY_STATIC(var)			/* NOP */
1123
#endif
1124
#define GST_DEBUG_CATEGORY_INIT(var,name,color,desc)	/* NOP */
1125
1126
#define gst_debug_category_free(category)		/* NOP */
#define gst_debug_category_set_threshold(category,level) /* NOP */
1127
1128
1129
1130
1131
1132
1133
#define gst_debug_category_reset_threshold(category)	/* NOP */
#define gst_debug_category_get_threshold(category)	(GST_LEVEL_NONE)
#define gst_debug_category_get_name(cat)		("")
#define gst_debug_category_get_color(cat)		(0)
#define gst_debug_category_get_description(cat)		("")
#define gst_debug_get_all_categories()			(NULL)
#define gst_debug_construct_term_color(colorinfo)	(g_strdup ("00"))
1134
#define gst_debug_construct_win_color(colorinfo)	(0)
1135

1136
1137
#ifdef G_HAVE_ISO_VARARGS

1138
#define GST_CAT_LEVEL_LOG(cat,level,...)		/* NOP */
1139

1140
1141
1142
1143
1144
#define GST_CAT_ERROR_OBJECT(...)			/* NOP */
#define GST_CAT_WARNING_OBJECT(...)			/* NOP */
#define GST_CAT_INFO_OBJECT(...)			/* NOP */
#define GST_CAT_DEBUG_OBJECT(...)			/* NOP */
#define GST_CAT_LOG_OBJECT(...)				/* NOP */
1145
#define GST_CAT_FIXME_OBJECT(...)			/* NOP */
1146

1147
1148
1149
1150
1151
#define GST_CAT_ERROR(...)				/* NOP */
#define GST_CAT_WARNING(...)				/* NOP */
#define GST_CAT_INFO(...)				/* NOP */
#define GST_CAT_DEBUG(...)				/* NOP */
#define GST_CAT_LOG(...)				/* NOP */
1152
#define GST_CAT_FIXME(...)				/* NOP */
1153

1154
1155
1156
1157
1158
#define GST_ERROR_OBJECT(...)				/* NOP */
#define GST_WARNING_OBJECT(...)				/* NOP */
#define GST_INFO_OBJECT(...)				/* NOP */
#define GST_DEBUG_OBJECT(...)				/* NOP */
#define GST_LOG_OBJECT(...)				/* NOP */
1159
#define GST_FIXME_OBJECT(...)				/* NOP */
1160

1161
1162
1163
1164
1165
#define GST_ERROR(...)					/* NOP */
#define GST_WARNING(...)				/* NOP */
#define GST_INFO(...)					/* NOP */
#define GST_DEBUG(...)					/* NOP */
#define GST_LOG(...)					/* NOP */
1166
#define GST_FIXME(...)					/* NOP */
1167

1168
1169
#else
#ifdef G_HAVE_GNUC_VARARGS
1170

1171
#define GST_CAT_LEVEL_LOG(cat,level,args...)		/* NOP */
1172

1173
1174
1175
1176
1177
#define GST_CAT_ERROR_OBJECT(args...)			/* NOP */
#define GST_CAT_WARNING_OBJECT(args...)			/* NOP */
#define GST_CAT_INFO_OBJECT(args...)			/* NOP */
#define GST_CAT_DEBUG_OBJECT(args...)			/* NOP */
#define GST_CAT_LOG_OBJECT(args...)			/* NOP */
1178
#define GST_CAT_FIXME_OBJECT(args...)			/* NOP */
1179

1180
1181
1182
1183
1184
#define GST_CAT_ERROR(args...)				/* NOP */
#define GST_CAT_WARNING(args...)			/* NOP */
#define GST_CAT_INFO(args...)				/* NOP */
#define GST_CAT_DEBUG(args...)				/* NOP */
#define GST_CAT_LOG(args...)				/* NOP */
1185
#define GST_CAT_FIXME(args...)				/* NOP */
1186

1187
1188
1189
1190
1191
#define GST_ERROR_OBJECT(args...)			/* NOP */
#define GST_WARNING_OBJECT(args...)			/* NOP */
#define GST_INFO_OBJECT(args...)			/* NOP */
#define GST_DEBUG_OBJECT(args...)			/* NOP */
#define GST_LOG_OBJECT(args...)				/* NOP */
1192
#define GST_FIXME_OBJECT(args...)			/* NOP */
1193

1194
1195
1196
1197
1198
#define GST_ERROR(args...)				/* NOP */
#define GST_WARNING(args...)				/* NOP */
#define GST_INFO(args...)				/* NOP */
#define GST_DEBUG(args...)				/* NOP */
#define GST_LOG(args...)				/* NOP */
1199
#define GST_FIXME(args...)				/* NOP */
1200

1201
#else
1202
1203
1204
1205
1206
1207
static inline void
GST_CAT_LEVEL_LOG_valist (GstDebugCategory * cat,
    GstDebugLevel level, gpointer object, const char *format, va_list varargs)
{
}

1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
static inline void
GST_CAT_ERROR_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
}

static inline void
GST_CAT_WARNING_OBJECT (GstDebugCategory * cat, gpointer obj,
    const char *format, ...)
{
}

static inline void
GST_CAT_INFO_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
}

static inline void
GST_CAT_DEBUG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
}

static inline void
GST_CAT_LOG_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
}

1238
1239
1240
1241
1242
1243
static inline void
GST_CAT_FIXME_OBJECT (GstDebugCategory * cat, gpointer obj, const char *format,
    ...)
{
}

1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
static inline void
GST_CAT_ERROR (GstDebugCategory * cat, const char *format, ...)
{
}

static inline void
GST_CAT_WARNING (GstDebugCategory * cat, const char *format, ...)
{
}

static inline void
GST_CAT_INFO (GstDebugCategory * cat, const char *format, ...)
{
}

static inline void
GST_CAT_DEBUG (GstDebugCategory * cat, const char *format, ...)
{
}

static inline void
GST_CAT_LOG (GstDebugCategory * cat, const char *format, ...)
{
}

1269
1270
1271
1272
1273
static inline void
GST_CAT_FIXME (GstDebugCategory * cat, const char *format, ...)
{
}

1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
static inline void
GST_ERROR_OBJECT (gpointer obj, const char *format, ...)
{
}

static inline void
GST_WARNING_OBJECT (gpointer obj, const char *format, ...)
{
}

static inline void
GST_INFO_OBJECT (gpointer obj, const char *format, ...)
{
}

static inline void
GST_DEBUG_OBJECT (gpointer obj, const char *format, ...)
{
}

static inline void
GST_LOG_OBJECT (gpointer obj, const char *format, ...)
{
}

1299
1300
1301
1302
1303
static inline void
GST_FIXME_OBJECT (gpointer obj, const char *format, ...)
{
}

1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
static inline void
GST_ERROR (const char *format, ...)
{
}

static inline void
GST_WARNING (const char *format, ...)
{
}

static inline void
GST_INFO (const char *format, ...)
{
}

static inline void
GST_DEBUG (const char *format, ...)
{
}

static inline void
GST_LOG (const char *format, ...)
{
}
1328
1329
1330
1331
1332
1333

static inline void
GST_FIXME (const char *format, ...)
{
}

1334
1335
#endif
#endif
1336

1337
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
1338
1339
#define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))

1340
1341
1342
1343
1344
#define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) /* NOP */
#define GST_CAT_MEMDUMP(cat,msg,data,length)            /* NOP */
#define GST_MEMDUMP_OBJECT(obj,msg,data,length)         /* NOP */
#define GST_MEMDUMP(msg,data,length)                    /* NOP */

1345
#endif /* GST_DISABLE_GST_DEBUG */
1346

1347

1348
1349
void gst_debug_print_stack_trace (void);

1350
G_END_DECLS
1351

1352
#endif /* __GSTINFO_H__ */