2000-12-29 10:02:17 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
2003-06-29 14:05:49 +00:00
|
|
|
* 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
2000-12-29 10:02:17 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* gstinfo.c: debugging functions
|
2000-12-29 10:02:17 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-09-23 14:31:21 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstinfo
|
|
|
|
* @short_description: Debugging and logging facillities
|
|
|
|
* @see_also: #GstConfig, #Gst for command line parameters
|
|
|
|
* and environment variables that affect the debugging output.
|
|
|
|
*
|
|
|
|
* GStreamer's debugging subsystem is an easy way to get information about what
|
2005-10-15 16:01:57 +00:00
|
|
|
* the application is doing. It is not meant for programming errors. Use GLib
|
|
|
|
* methods (g_warning and friends) for that.
|
2005-09-23 14:31:21 +00:00
|
|
|
*
|
2005-10-06 09:49:42 +00:00
|
|
|
* The debugging subsystem works only after GStreamer has been initialized
|
2005-09-23 14:31:21 +00:00
|
|
|
* - for example by calling gst_init().
|
|
|
|
*
|
|
|
|
* The debugging subsystem is used to log informational messages while the
|
2005-10-15 16:01:57 +00:00
|
|
|
* application runs. Each messages has some properties attached to it. Among
|
|
|
|
* these properties are the debugging category, the severity (called "level"
|
|
|
|
* here) and an optional #GObject it belongs to. Each of these messages is sent
|
|
|
|
* to all registered debugging handlers, which then handle the messages.
|
|
|
|
* GStreamer attaches a default handler on startup, which outputs requested
|
|
|
|
* messages to stderr.
|
2005-09-23 14:31:21 +00:00
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* Messages are output by using shortcut macros like #GST_DEBUG,
|
2005-09-23 14:31:21 +00:00
|
|
|
* #GST_CAT_ERROR_OBJECT or similar. These all expand to calling gst_debug_log()
|
|
|
|
* with the right parameters.
|
2005-10-15 15:30:24 +00:00
|
|
|
* The only thing a developer will probably want to do is define his own
|
2005-10-06 09:49:42 +00:00
|
|
|
* categories. This is easily done with 3 lines. At the top of your code,
|
|
|
|
* declare
|
2005-09-23 14:31:21 +00:00
|
|
|
* the variables and set the default category.
|
|
|
|
* <informalexample>
|
|
|
|
* <programlisting>
|
2006-06-23 13:16:46 +00:00
|
|
|
* GST_DEBUG_CATEGORY_STATIC (my_category); // define category (statically)
|
2005-09-23 14:31:21 +00:00
|
|
|
* &hash;define GST_CAT_DEFAULT my_category // set as default
|
|
|
|
* </programlisting>
|
|
|
|
* </informalexample>
|
|
|
|
* After that you only need to initialize the category.
|
|
|
|
* <informalexample>
|
|
|
|
* <programlisting>
|
2005-10-06 09:49:42 +00:00
|
|
|
* GST_DEBUG_CATEGORY_INIT (my_category, "my category",
|
|
|
|
* 0, "This is my very own");
|
2005-09-23 14:31:21 +00:00
|
|
|
* </programlisting>
|
|
|
|
* </informalexample>
|
2005-10-06 09:49:42 +00:00
|
|
|
* Initialization must be done before the category is used first.
|
2005-10-15 15:30:24 +00:00
|
|
|
* Plugins do this
|
2005-09-23 14:31:21 +00:00
|
|
|
* in their plugin_init function, libraries and applications should do that
|
|
|
|
* during their initialization.
|
|
|
|
*
|
|
|
|
* The whole debugging subsystem can be disabled at build time with passing the
|
2005-10-06 09:49:42 +00:00
|
|
|
* --disable-gst-debug switch to configure. If this is done, every function,
|
2005-11-04 20:12:01 +00:00
|
|
|
* macro and even structs described in this file evaluate to default values or
|
|
|
|
* nothing at all.
|
|
|
|
* So don't take addresses of these functions or use other tricks.
|
2005-10-06 09:49:42 +00:00
|
|
|
* If you must do that for some reason, there is still an option.
|
|
|
|
* If the debugging
|
|
|
|
* subsystem was compiled out, #GST_DISABLE_GST_DEBUG is defined in
|
|
|
|
* <gst/gst.h>,
|
2005-09-23 14:31:21 +00:00
|
|
|
* so you can check that before doing your trick.
|
2005-10-15 15:30:24 +00:00
|
|
|
* Disabling the debugging subsystem will give you a slight (read: unnoticable)
|
|
|
|
* speed increase and will reduce the size of your compiled code. The GStreamer
|
2005-09-23 14:31:21 +00:00
|
|
|
* library itself becomes around 10% smaller.
|
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* Please note that there are naming conventions for the names of debugging
|
2005-09-23 14:31:21 +00:00
|
|
|
* categories. These are explained at GST_DEBUG_CATEGORY_INIT().
|
|
|
|
*/
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gst_private.h"
|
|
|
|
#include "gstinfo.h"
|
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
|
2003-08-06 03:00:21 +00:00
|
|
|
#ifdef HAVE_DLFCN_H
|
2005-10-16 10:38:02 +00:00
|
|
|
# include <dlfcn.h>
|
2003-08-06 03:00:21 +00:00
|
|
|
#endif
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#ifdef HAVE_PRINTF_EXTENSION
|
2005-10-16 10:38:02 +00:00
|
|
|
# include <printf.h>
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#endif
|
2004-03-15 19:27:17 +00:00
|
|
|
#include <stdio.h> /* fprintf */
|
2004-04-28 23:26:06 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2005-10-16 10:38:02 +00:00
|
|
|
# include <unistd.h> /* getpid on UNIX */
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PROCESS_H
|
|
|
|
# include <process.h> /* getpid on win32 */
|
2004-04-28 23:26:06 +00:00
|
|
|
#endif
|
2004-03-15 19:27:17 +00:00
|
|
|
#include <string.h> /* G_VA_COPY */
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gst_private.h"
|
2005-04-24 22:49:45 +00:00
|
|
|
#include "gstutils.h"
|
2006-08-09 15:13:14 +00:00
|
|
|
#include "gstsegment.h"
|
2004-04-05 21:42:07 +00:00
|
|
|
#ifdef HAVE_VALGRIND
|
2005-10-16 10:38:02 +00:00
|
|
|
# include <valgrind/valgrind.h>
|
2004-04-05 21:42:07 +00:00
|
|
|
#endif
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
#include <glib/gprintf.h> /* g_sprintf */
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2004-04-15 23:25:39 +00:00
|
|
|
/* underscore is to prevent conflict with GST_CAT_DEBUG define */
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (_GST_CAT_DEBUG);
|
2005-02-19 12:59:45 +00:00
|
|
|
/* time of initialization, so we get useful debugging output times */
|
2005-10-15 19:57:03 +00:00
|
|
|
static GstClockTime start_time;
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-08-06 03:00:21 +00:00
|
|
|
#if 0
|
2001-12-18 17:02:02 +00:00
|
|
|
#if defined __sgi__
|
|
|
|
#include <rld_interface.h>
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct DL_INFO
|
|
|
|
{
|
|
|
|
const char *dli_fname;
|
|
|
|
void *dli_fbase;
|
|
|
|
const char *dli_sname;
|
|
|
|
void *dli_saddr;
|
|
|
|
int dli_version;
|
|
|
|
int dli_reserved1;
|
|
|
|
long dli_reserved[4];
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
Dl_info;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-18 17:02:02 +00:00
|
|
|
#define _RLD_DLADDR 14
|
2004-03-13 15:27:01 +00:00
|
|
|
int dladdr (void *address, Dl_info * dl);
|
2001-12-18 17:02:02 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
int
|
|
|
|
dladdr (void *address, Dl_info * dl)
|
2001-12-18 17:02:02 +00:00
|
|
|
{
|
|
|
|
void *v;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
v = _rld_new_interface (_RLD_DLADDR, address, dl);
|
|
|
|
return (int) v;
|
2001-12-18 17:02:02 +00:00
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
#endif /* __sgi__ */
|
2003-08-06 03:00:21 +00:00
|
|
|
#endif
|
2001-12-18 17:02:02 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_debug_reset_threshold (gpointer category, gpointer unused);
|
|
|
|
static void gst_debug_reset_all_thresholds (void);
|
2003-06-29 14:05:49 +00:00
|
|
|
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#ifdef HAVE_PRINTF_EXTENSION
|
2006-08-09 15:13:14 +00:00
|
|
|
static int _gst_info_printf_extension_ptr (FILE * stream,
|
|
|
|
const struct printf_info *info, const void *const *args);
|
|
|
|
static int _gst_info_printf_extension_segment (FILE * stream,
|
2004-03-13 15:27:01 +00:00
|
|
|
const struct printf_info *info, const void *const *args);
|
|
|
|
static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
|
|
|
|
size_t n, int *argtypes);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
struct _GstDebugMessage
|
|
|
|
{
|
|
|
|
gchar *message;
|
|
|
|
const gchar *format;
|
|
|
|
va_list arguments;
|
2004-01-10 01:49:00 +00:00
|
|
|
};
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/* list of all name/level pairs from --gst-debug and GST_DEBUG */
|
|
|
|
static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
static GSList *__level_name = NULL;
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GPatternSpec *pat;
|
|
|
|
GstDebugLevel level;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
LevelNameEntry;
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
/* list of all categories */
|
|
|
|
static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
static GSList *__categories = NULL;
|
|
|
|
|
|
|
|
/* all registered debug handlers */
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstLogFunction func;
|
|
|
|
gpointer user_data;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
LogFuncEntry;
|
2003-06-29 14:05:49 +00:00
|
|
|
static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
static GSList *__log_functions = NULL;
|
|
|
|
|
2005-04-24 22:49:45 +00:00
|
|
|
static gint __default_level;
|
|
|
|
static gint __use_color;
|
2006-03-13 11:08:28 +00:00
|
|
|
|
2006-03-22 18:25:04 +00:00
|
|
|
/* disabled by default, as soon as some threshold is set > NONE,
|
|
|
|
* it becomes enabled. */
|
|
|
|
gboolean __gst_debug_enabled = FALSE;
|
2006-06-12 08:47:16 +00:00
|
|
|
GstDebugLevel __gst_debug_min = GST_LEVEL_NONE;
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
GstDebugCategory *GST_CAT_DEFAULT = NULL;
|
|
|
|
|
|
|
|
GstDebugCategory *GST_CAT_GST_INIT = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_AUTOPLUG = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_AUTOPLUG_ATTEMPT = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PARENTAGE = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_STATES = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_SCHEDULING = NULL;
|
2004-06-05 12:19:27 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
GstDebugCategory *GST_CAT_BUFFER = NULL;
|
2005-10-06 09:49:42 +00:00
|
|
|
GstDebugCategory *GST_CAT_BUS = NULL;
|
2003-06-29 14:05:49 +00:00
|
|
|
GstDebugCategory *GST_CAT_CAPS = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_CLOCK = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_ELEMENT_PADS = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PADS = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PIPELINE = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PLUGIN_LOADING = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PLUGIN_INFO = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_PROPERTIES = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_TYPES = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_XML = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_NEGOTIATION = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_REFCOUNTING = NULL;
|
2004-01-18 21:36:20 +00:00
|
|
|
GstDebugCategory *GST_CAT_ERROR_SYSTEM = NULL;
|
2003-06-29 14:05:49 +00:00
|
|
|
GstDebugCategory *GST_CAT_EVENT = NULL;
|
Bump version number, we're now 0.9.0
Original commit message from CVS:
* configure.ac:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove),
(gst_bin_get_by_name_recurse_up):
* gst/gstclock.c: (gst_clock_id_ref), (gst_clock_id_unref),
(gst_clock_id_compare_func), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_init),
(gst_clock_adjust_unlocked), (gst_clock_get_time):
* gst/gstelement.h:
* gst/gstinfo.c: (_gst_debug_init):
* gst/gstobject.h:
* gst/gstpad.c: (_gst_pad_default_fixate_foreach),
(gst_pad_collectv), (gst_pad_collect_valist), (gst_pad_query):
* gst/gstpad.h:
Bump version number, we're now 0.9.0
Add future debugging category.
Fix NULL _unref() in _get_by_name_recurse_up
Rearrange gstpad.h.
Update some docs.
2005-03-09 11:08:18 +00:00
|
|
|
GstDebugCategory *GST_CAT_MESSAGE = NULL;
|
2003-06-29 14:05:49 +00:00
|
|
|
GstDebugCategory *GST_CAT_PARAMS = NULL;
|
|
|
|
GstDebugCategory *GST_CAT_CALL_TRACE = NULL;
|
2005-01-10 17:23:42 +00:00
|
|
|
GstDebugCategory *GST_CAT_SIGNAL = NULL;
|
2005-01-13 16:50:49 +00:00
|
|
|
GstDebugCategory *GST_CAT_PROBE = NULL;
|
2005-09-15 00:13:26 +00:00
|
|
|
GstDebugCategory *GST_CAT_REGISTRY = NULL;
|
2006-03-13 11:08:28 +00:00
|
|
|
GstDebugCategory *GST_CAT_QOS = NULL;
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2004-04-05 21:42:07 +00:00
|
|
|
/* FIXME: export this? */
|
|
|
|
gboolean
|
|
|
|
__gst_in_valgrind (void)
|
|
|
|
{
|
|
|
|
static enum
|
|
|
|
{
|
|
|
|
GST_VG_UNCHECKED,
|
|
|
|
GST_VG_NO_VALGRIND,
|
|
|
|
GST_VG_INSIDE
|
|
|
|
}
|
|
|
|
in_valgrind = GST_VG_UNCHECKED;
|
|
|
|
|
|
|
|
if (in_valgrind == GST_VG_UNCHECKED) {
|
|
|
|
#ifdef HAVE_VALGRIND
|
|
|
|
if (RUNNING_ON_VALGRIND) {
|
|
|
|
GST_CAT_INFO (GST_CAT_GST_INIT, "we're running inside valgrind");
|
2006-04-06 11:27:24 +00:00
|
|
|
printf ("GStreamer has detected that it is running inside valgrind.\n");
|
|
|
|
printf ("It might now take different code paths to ease debugging.\n");
|
|
|
|
printf ("Of course, this may also lead to different bugs.\n");
|
2004-04-05 21:42:07 +00:00
|
|
|
in_valgrind = GST_VG_INSIDE;
|
|
|
|
} else {
|
|
|
|
GST_CAT_LOG (GST_CAT_GST_INIT, "not doing extra valgrind stuff");
|
|
|
|
in_valgrind = GST_VG_NO_VALGRIND;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
in_valgrind = GST_VG_NO_VALGRIND;
|
|
|
|
#endif
|
|
|
|
g_assert (in_valgrind == GST_VG_NO_VALGRIND ||
|
|
|
|
in_valgrind == GST_VG_INSIDE);
|
|
|
|
}
|
|
|
|
return (in_valgrind == GST_VG_INSIDE) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* _gst_debug_init:
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Initializes the debugging system.
|
2005-11-04 20:12:01 +00:00
|
|
|
* Normally you don't want to call this, because gst_init() does it for you.
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
_gst_debug_init (void)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
2005-02-19 12:59:45 +00:00
|
|
|
GTimeVal current;
|
|
|
|
|
2005-04-24 22:49:45 +00:00
|
|
|
gst_atomic_int_set (&__default_level, GST_LEVEL_DEFAULT);
|
|
|
|
gst_atomic_int_set (&__use_color, 1);
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2005-02-19 12:59:45 +00:00
|
|
|
/* get time we started for debugging messages */
|
|
|
|
g_get_current_time (¤t);
|
|
|
|
start_time = GST_TIMEVAL_TO_TIME (current);
|
|
|
|
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#ifdef HAVE_PRINTF_EXTENSION
|
2006-08-09 15:13:14 +00:00
|
|
|
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
_gst_info_printf_extension_arginfo);
|
2006-08-09 15:13:14 +00:00
|
|
|
register_printf_function (GST_SEGMENT_FORMAT[0],
|
|
|
|
_gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#endif
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/* do NOT use a single debug function before this line has been run */
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_DEFAULT = _gst_debug_category_new ("default",
|
|
|
|
GST_DEBUG_UNDERLINE, NULL);
|
2004-04-15 23:25:39 +00:00
|
|
|
_GST_CAT_DEBUG = _gst_debug_category_new ("GST_DEBUG",
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, "debugging subsystem");
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
gst_debug_add_log_function (gst_debug_log_default, NULL);
|
|
|
|
|
|
|
|
/* FIXME: add descriptions here */
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_GST_INIT = _gst_debug_category_new ("GST_INIT",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
|
|
|
|
GST_CAT_AUTOPLUG = _gst_debug_category_new ("GST_AUTOPLUG",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_CAT_AUTOPLUG_ATTEMPT = _gst_debug_category_new ("GST_AUTOPLUG_ATTEMPT",
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN | GST_DEBUG_BG_BLUE, NULL);
|
|
|
|
GST_CAT_PARENTAGE = _gst_debug_category_new ("GST_PARENTAGE",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_STATES = _gst_debug_category_new ("GST_STATES",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
|
|
|
|
GST_CAT_SCHEDULING = _gst_debug_category_new ("GST_SCHEDULING",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL);
|
|
|
|
GST_CAT_BUFFER = _gst_debug_category_new ("GST_BUFFER",
|
2005-10-06 09:49:42 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_BG_GREEN, NULL);
|
|
|
|
GST_CAT_BUS = _gst_debug_category_new ("GST_BUS", GST_DEBUG_BG_YELLOW, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_CAPS = _gst_debug_category_new ("GST_CAPS",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
|
|
|
|
GST_CAT_CLOCK = _gst_debug_category_new ("GST_CLOCK",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, NULL);
|
|
|
|
GST_CAT_ELEMENT_PADS = _gst_debug_category_new ("GST_ELEMENT_PADS",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_PADS = _gst_debug_category_new ("GST_PADS",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_PIPELINE = _gst_debug_category_new ("GST_PIPELINE",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_CAT_PLUGIN_LOADING = _gst_debug_category_new ("GST_PLUGIN_LOADING",
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, NULL);
|
|
|
|
GST_CAT_PLUGIN_INFO = _gst_debug_category_new ("GST_PLUGIN_INFO",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, NULL);
|
|
|
|
GST_CAT_PROPERTIES = _gst_debug_category_new ("GST_PROPERTIES",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_BLUE, NULL);
|
|
|
|
GST_CAT_TYPES = _gst_debug_category_new ("GST_TYPES",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_XML = _gst_debug_category_new ("GST_XML",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_NEGOTIATION = _gst_debug_category_new ("GST_NEGOTIATION",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
|
|
|
|
GST_CAT_REFCOUNTING = _gst_debug_category_new ("GST_REFCOUNTING",
|
2005-09-28 15:45:21 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_RED | GST_DEBUG_BG_BLUE, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_ERROR_SYSTEM = _gst_debug_category_new ("GST_ERROR_SYSTEM",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_RED | GST_DEBUG_BG_WHITE, NULL);
|
|
|
|
|
|
|
|
GST_CAT_EVENT = _gst_debug_category_new ("GST_EVENT",
|
2005-01-10 17:23:42 +00:00
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
|
Bump version number, we're now 0.9.0
Original commit message from CVS:
* configure.ac:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove),
(gst_bin_get_by_name_recurse_up):
* gst/gstclock.c: (gst_clock_id_ref), (gst_clock_id_unref),
(gst_clock_id_compare_func), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_init),
(gst_clock_adjust_unlocked), (gst_clock_get_time):
* gst/gstelement.h:
* gst/gstinfo.c: (_gst_debug_init):
* gst/gstobject.h:
* gst/gstpad.c: (_gst_pad_default_fixate_foreach),
(gst_pad_collectv), (gst_pad_collect_valist), (gst_pad_query):
* gst/gstpad.h:
Bump version number, we're now 0.9.0
Add future debugging category.
Fix NULL _unref() in _get_by_name_recurse_up
Rearrange gstpad.h.
Update some docs.
2005-03-09 11:08:18 +00:00
|
|
|
GST_CAT_MESSAGE = _gst_debug_category_new ("GST_MESSAGE",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_PARAMS = _gst_debug_category_new ("GST_PARAMS",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_BLACK | GST_DEBUG_BG_YELLOW, NULL);
|
|
|
|
GST_CAT_CALL_TRACE = _gst_debug_category_new ("GST_CALL_TRACE",
|
|
|
|
GST_DEBUG_BOLD, NULL);
|
2005-01-13 16:50:49 +00:00
|
|
|
GST_CAT_SIGNAL = _gst_debug_category_new ("GST_SIGNAL",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
|
|
|
|
GST_CAT_PROBE = _gst_debug_category_new ("GST_PROBE",
|
|
|
|
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "pad probes");
|
2005-09-15 00:13:26 +00:00
|
|
|
GST_CAT_REGISTRY = _gst_debug_category_new ("GST_REGISTRY", 0, "registry");
|
2006-03-13 11:08:28 +00:00
|
|
|
GST_CAT_QOS = _gst_debug_category_new ("GST_QOS", 0, "QoS");
|
2005-01-13 16:50:49 +00:00
|
|
|
|
2004-04-05 21:42:07 +00:00
|
|
|
|
|
|
|
/* print out the valgrind message if we're in valgrind */
|
|
|
|
__gst_in_valgrind ();
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/* we can't do this further above, because we initialize the GST_CAT_DEFAULT struct */
|
2004-04-15 23:25:39 +00:00
|
|
|
#define GST_CAT_DEFAULT _GST_CAT_DEBUG
|
2001-04-27 20:31:22 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_log:
|
|
|
|
* @category: category to log
|
|
|
|
* @level: level of the message is in
|
|
|
|
* @file: the file that emitted the message, usually the __FILE__ identifier
|
|
|
|
* @function: the function that emitted the message
|
|
|
|
* @line: the line from that the message was emitted, usually __LINE__
|
|
|
|
* @object: the object this message relates to or NULL if none
|
|
|
|
* @format: a printf style format string
|
|
|
|
* @...: optional arguments for the format
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Logs the given message using the currently registered debugging handlers.
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
gst_debug_log (GstDebugCategory * category, GstDebugLevel level,
|
|
|
|
const gchar * file, const gchar * function, gint line,
|
|
|
|
GObject * object, const gchar * format, ...)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
va_list var_args;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
va_start (var_args, format);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_log_valist (category, level, file, function, line, object, format,
|
|
|
|
var_args);
|
2003-06-29 14:05:49 +00:00
|
|
|
va_end (var_args);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
2003-11-24 02:09:23 +00:00
|
|
|
* gst_debug_log_valist:
|
2003-06-29 14:05:49 +00:00
|
|
|
* @category: category to log
|
|
|
|
* @level: level of the message is in
|
|
|
|
* @file: the file that emitted the message, usually the __FILE__ identifier
|
|
|
|
* @function: the function that emitted the message
|
|
|
|
* @line: the line from that the message was emitted, usually __LINE__
|
|
|
|
* @object: the object this message relates to or NULL if none
|
|
|
|
* @format: a printf style format string
|
|
|
|
* @args: optional arguments for the format
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Logs the given message using the currently registered debugging handlers.
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
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)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
2004-01-10 01:49:00 +00:00
|
|
|
GstDebugMessage message;
|
2003-06-29 14:05:49 +00:00
|
|
|
LogFuncEntry *entry;
|
|
|
|
GSList *handler;
|
|
|
|
|
|
|
|
g_return_if_fail (category != NULL);
|
|
|
|
g_return_if_fail (file != NULL);
|
|
|
|
g_return_if_fail (function != NULL);
|
|
|
|
g_return_if_fail (format != NULL);
|
|
|
|
|
2004-01-10 01:49:00 +00:00
|
|
|
message.message = NULL;
|
|
|
|
message.format = format;
|
2004-01-12 22:33:11 +00:00
|
|
|
G_VA_COPY (message.arguments, args);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-01-06 21:41:05 +00:00
|
|
|
handler = __log_functions;
|
|
|
|
while (handler) {
|
|
|
|
entry = handler->data;
|
|
|
|
handler = g_slist_next (handler);
|
2004-03-13 15:27:01 +00:00
|
|
|
entry->func (category, level, file, function, line, object, &message,
|
2004-03-15 19:27:17 +00:00
|
|
|
entry->user_data);
|
2004-01-10 01:49:00 +00:00
|
|
|
}
|
|
|
|
g_free (message.message);
|
2004-01-12 22:44:38 +00:00
|
|
|
va_end (message.arguments);
|
2004-01-10 01:49:00 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-01-10 01:49:00 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_message_get:
|
|
|
|
* @message: a debug message
|
|
|
|
*
|
2004-03-30 09:15:47 +00:00
|
|
|
* Gets the string representation of a #GstDebugMessage. This function is used
|
2004-01-10 01:49:00 +00:00
|
|
|
* in debug handlers to extract the message.
|
2004-03-30 07:36:19 +00:00
|
|
|
*
|
2004-03-30 09:15:47 +00:00
|
|
|
* Returns: the string representation of a #GstDebugMessage.
|
2004-01-10 01:49:00 +00:00
|
|
|
*/
|
|
|
|
const gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_message_get (GstDebugMessage * message)
|
2004-01-10 01:49:00 +00:00
|
|
|
{
|
|
|
|
if (message->message == NULL) {
|
|
|
|
message->message = g_strdup_vprintf (message->format, message->arguments);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-01-10 01:49:00 +00:00
|
|
|
return message->message;
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-01-10 01:49:00 +00:00
|
|
|
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_debug_print_object (gpointer ptr)
|
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GObject *object = (GObject *) ptr;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
|
|
|
#ifdef unused
|
|
|
|
/* This is a cute trick to detect unmapped memory, but is unportable,
|
|
|
|
* slow, screws around with madvise, and not actually that useful. */
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
ret = madvise ((void *) ((unsigned long) ptr & (~0xfff)), 4096, 0);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
if (ret == -1 && errno == ENOMEM) {
|
|
|
|
buffer = g_strdup_printf ("%p (unmapped memory)", ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* nicely printed object */
|
|
|
|
if (object == NULL) {
|
2004-02-20 13:18:32 +00:00
|
|
|
return g_strdup ("(NULL)");
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if (*(GType *) ptr == GST_TYPE_CAPS) {
|
|
|
|
return gst_caps_to_string ((GstCaps *) ptr);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if (*(GType *) ptr == GST_TYPE_STRUCTURE) {
|
|
|
|
return gst_structure_to_string ((GstStructure *) ptr);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
|
|
|
#ifdef USE_POISONING
|
2004-03-13 15:27:01 +00:00
|
|
|
if (*(guint32 *) ptr == 0xffffffff) {
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
return g_strdup_printf ("<poisoned@%p>", ptr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) {
|
|
|
|
return g_strdup_printf ("<%s:%s>", GST_DEBUG_PAD_NAME (object));
|
|
|
|
}
|
|
|
|
if (GST_IS_OBJECT (object) && GST_OBJECT_NAME (object)) {
|
|
|
|
return g_strdup_printf ("<%s>", GST_OBJECT_NAME (object));
|
|
|
|
}
|
|
|
|
if (G_IS_OBJECT (object)) {
|
2004-03-13 15:27:01 +00:00
|
|
|
return g_strdup_printf ("<%s@%p>", G_OBJECT_TYPE_NAME (object), object);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return g_strdup_printf ("%p", ptr);
|
|
|
|
}
|
|
|
|
|
2006-08-09 15:13:14 +00:00
|
|
|
static gchar *
|
|
|
|
gst_debug_print_segment (gpointer ptr)
|
|
|
|
{
|
|
|
|
GstSegment *segment = (GstSegment *) ptr;
|
|
|
|
|
|
|
|
/* nicely printed segment */
|
|
|
|
if (segment == NULL) {
|
|
|
|
return g_strdup ("(NULL)");
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (segment->format) {
|
|
|
|
case GST_FORMAT_UNDEFINED:{
|
|
|
|
return g_strdup_printf ("UNDEFINED segment");
|
|
|
|
}
|
|
|
|
case GST_FORMAT_TIME:{
|
|
|
|
return g_strdup_printf ("time segment start=%" GST_TIME_FORMAT
|
|
|
|
", stop=%" GST_TIME_FORMAT ", last_stop=%" GST_TIME_FORMAT
|
|
|
|
", duration=%" GST_TIME_FORMAT ", rate=%f, applied_rate=%f"
|
|
|
|
", flags=0x%02x, time=%" GST_TIME_FORMAT ", accum=%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop),
|
|
|
|
GST_TIME_ARGS (segment->last_stop), GST_TIME_ARGS (segment->duration),
|
|
|
|
segment->rate, segment->applied_rate, (guint) segment->flags,
|
|
|
|
GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->accum));
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
const gchar *format_name;
|
|
|
|
|
|
|
|
format_name = gst_format_get_name (segment->format);
|
|
|
|
if (G_UNLIKELY (format_name == NULL))
|
|
|
|
format_name = "(UNKNOWN FORMAT)";
|
|
|
|
return g_strdup_printf ("%s segment start=%" G_GINT64_FORMAT
|
|
|
|
", stop=%" G_GINT64_FORMAT ", last_stop=%" G_GINT64_FORMAT
|
|
|
|
", duration=%" G_GINT64_FORMAT ", rate=%f, applied_rate=%f"
|
|
|
|
", flags=0x%02x, time=%" GST_TIME_FORMAT ", accum=%" GST_TIME_FORMAT,
|
|
|
|
format_name, segment->start, segment->stop, segment->last_stop,
|
|
|
|
segment->duration, segment->rate, segment->applied_rate,
|
|
|
|
(guint) segment->flags, GST_TIME_ARGS (segment->time),
|
|
|
|
GST_TIME_ARGS (segment->accum));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_construct_term_color:
|
|
|
|
* @colorinfo: the color info
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Constructs a string that can be used for getting the desired color in color
|
|
|
|
* terminals.
|
|
|
|
* You need to free the string after use.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: a string containing the color definition
|
|
|
|
*/
|
|
|
|
gchar *
|
|
|
|
gst_debug_construct_term_color (guint colorinfo)
|
|
|
|
{
|
|
|
|
GString *color;
|
|
|
|
gchar *ret;
|
2001-09-10 19:46:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
color = g_string_new ("\033[00");
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
if (colorinfo & GST_DEBUG_BOLD) {
|
|
|
|
g_string_append (color, ";01");
|
|
|
|
}
|
|
|
|
if (colorinfo & GST_DEBUG_UNDERLINE) {
|
|
|
|
g_string_append (color, ";04");
|
|
|
|
}
|
|
|
|
if (colorinfo & GST_DEBUG_FG_MASK) {
|
|
|
|
g_string_append_printf (color, ";3%1d", colorinfo & GST_DEBUG_FG_MASK);
|
|
|
|
}
|
|
|
|
if (colorinfo & GST_DEBUG_BG_MASK) {
|
2004-03-13 15:27:01 +00:00
|
|
|
g_string_append_printf (color, ";4%1d",
|
2004-03-15 19:27:17 +00:00
|
|
|
(colorinfo & GST_DEBUG_BG_MASK) >> 4);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
|
|
|
g_string_append (color, "m");
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
ret = color->str;
|
|
|
|
g_string_free (color, FALSE);
|
|
|
|
return ret;
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_log_default:
|
|
|
|
* @category: category to log
|
|
|
|
* @level: level of the message
|
|
|
|
* @file: the file that emitted the message, usually the __FILE__ identifier
|
|
|
|
* @function: the function that emitted the message
|
|
|
|
* @line: the line from that the message was emitted, usually __LINE__
|
|
|
|
* @message: the actual message
|
|
|
|
* @object: the object this message relates to or NULL if none
|
|
|
|
* @unused: an unused variable, reserved for some user_data.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* The default logging handler used by GStreamer. Logging functions get called
|
|
|
|
* whenever a macro like GST_DEBUG or similar is used. This function outputs the
|
|
|
|
* message and additional info using the glib error handler.
|
2006-01-27 22:34:51 +00:00
|
|
|
* You can add other handlers by using gst_debug_add_log_function().
|
2003-06-29 14:05:49 +00:00
|
|
|
* And you can remove this handler by calling
|
2006-01-27 22:34:51 +00:00
|
|
|
* gst_debug_remove_log_function(gst_debug_log_default);
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|
|
|
const gchar * file, const gchar * function, gint line,
|
|
|
|
GObject * object, GstDebugMessage * message, gpointer unused)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
gchar *color = NULL;
|
2003-06-29 14:05:49 +00:00
|
|
|
gchar *clear;
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
gchar *obj = NULL;
|
|
|
|
gchar pidcolor[10];
|
2003-06-29 14:05:49 +00:00
|
|
|
gint pid;
|
2004-05-13 10:10:31 +00:00
|
|
|
GTimeVal now;
|
2005-02-19 12:59:45 +00:00
|
|
|
GstClockTime elapsed;
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
gboolean free_color = TRUE;
|
|
|
|
gboolean free_obj = TRUE;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
if (level > gst_debug_category_get_threshold (category))
|
|
|
|
return;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
pid = getpid ();
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
/* color info */
|
|
|
|
if (gst_debug_is_colored ()) {
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
color = gst_debug_construct_term_color (gst_debug_category_get_color
|
2004-03-15 19:27:17 +00:00
|
|
|
(category));
|
2003-06-29 14:05:49 +00:00
|
|
|
clear = "\033[00m";
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
|
2003-06-29 14:05:49 +00:00
|
|
|
} else {
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
color = "\0";
|
|
|
|
free_color = FALSE;
|
2003-06-29 14:05:49 +00:00
|
|
|
clear = "";
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
pidcolor[0] = '\0';
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2001-05-25 21:00:07 +00:00
|
|
|
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
if (object) {
|
|
|
|
obj = gst_debug_print_object (object);
|
|
|
|
} else {
|
|
|
|
obj = "\0";
|
|
|
|
free_obj = FALSE;
|
|
|
|
}
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
2004-05-13 10:10:31 +00:00
|
|
|
g_get_current_time (&now);
|
2005-02-19 12:59:45 +00:00
|
|
|
elapsed = GST_TIMEVAL_TO_TIME (now) - start_time;
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
g_printerr ("%s (%p - %" GST_TIME_FORMAT
|
2005-10-06 09:49:42 +00:00
|
|
|
") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
gst_debug_level_get_name (level), g_thread_self (),
|
2005-02-19 12:59:45 +00:00
|
|
|
GST_TIME_ARGS (elapsed), color,
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
|
2004-03-13 15:27:01 +00:00
|
|
|
color, file, line, function, obj, clear, gst_debug_message_get (message));
|
2001-05-25 21:00:07 +00:00
|
|
|
|
gst/gstinfo.c: don't do dummy g_strdup()s
Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 17:30:13 +00:00
|
|
|
if (free_color)
|
|
|
|
g_free (color);
|
|
|
|
if (free_obj)
|
|
|
|
g_free (obj);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_level_get_name:
|
|
|
|
* @level: the level to get the name for
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Get the string trepresentation of a debugging level
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: the name
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
2003-06-29 14:05:49 +00:00
|
|
|
const gchar *
|
|
|
|
gst_debug_level_get_name (GstDebugLevel level)
|
|
|
|
{
|
|
|
|
switch (level) {
|
2004-03-13 15:27:01 +00:00
|
|
|
case GST_LEVEL_NONE:
|
|
|
|
return "";
|
|
|
|
case GST_LEVEL_ERROR:
|
|
|
|
return "ERROR";
|
|
|
|
case GST_LEVEL_WARNING:
|
|
|
|
return "WARN ";
|
|
|
|
case GST_LEVEL_INFO:
|
|
|
|
return "INFO ";
|
|
|
|
case GST_LEVEL_DEBUG:
|
|
|
|
return "DEBUG";
|
|
|
|
case GST_LEVEL_LOG:
|
|
|
|
return "LOG ";
|
2003-06-29 14:05:49 +00:00
|
|
|
default:
|
|
|
|
g_warning ("invalid level specified for gst_debug_level_get_name");
|
|
|
|
return "";
|
|
|
|
}
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_add_log_function:
|
|
|
|
* @func: the function to use
|
|
|
|
* @data: user data
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Adds the logging function to the list of logging functions.
|
|
|
|
* Be sure to use G_GNUC_NO_INSTRUMENT on that function, it is needed.
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
|
|
|
void
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_add_log_function (GstLogFunction func, gpointer data)
|
|
|
|
{
|
|
|
|
LogFuncEntry *entry;
|
2003-08-03 17:18:40 +00:00
|
|
|
GSList *list;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_return_if_fail (func != NULL);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
entry = g_new (LogFuncEntry, 1);
|
|
|
|
entry->func = func;
|
|
|
|
entry->user_data = data;
|
2003-08-03 17:18:40 +00:00
|
|
|
/* FIXME: we leak the old list here - other threads might access it right now
|
|
|
|
* in gst_debug_logv. Another solution is to lock the mutex in gst_debug_logv,
|
|
|
|
* but that is waaay costly.
|
2005-10-15 15:30:24 +00:00
|
|
|
* It'd probably be clever to use some kind of RCU here, but I don't know
|
2003-08-03 17:18:40 +00:00
|
|
|
* anything about that.
|
|
|
|
*/
|
2003-06-29 14:05:49 +00:00
|
|
|
g_static_mutex_lock (&__log_func_mutex);
|
2003-08-03 17:18:40 +00:00
|
|
|
list = g_slist_copy (__log_functions);
|
|
|
|
__log_functions = g_slist_prepend (list, entry);
|
2003-06-29 14:05:49 +00:00
|
|
|
g_static_mutex_unlock (&__log_func_mutex);
|
|
|
|
|
|
|
|
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
2004-03-13 15:27:01 +00:00
|
|
|
func, data);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
static gint
|
|
|
|
gst_debug_compare_log_function_by_func (gconstpointer entry, gconstpointer func)
|
|
|
|
{
|
|
|
|
gpointer entryfunc = ((LogFuncEntry *) entry)->func;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return (entryfunc < func) ? -1 : (entryfunc > func) ? 1 : 0;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
static gint
|
|
|
|
gst_debug_compare_log_function_by_data (gconstpointer entry, gconstpointer data)
|
|
|
|
{
|
|
|
|
gpointer entrydata = ((LogFuncEntry *) entry)->user_data;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return (entrydata < data) ? -1 : (entrydata > data) ? 1 : 0;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-03 17:18:40 +00:00
|
|
|
static guint
|
|
|
|
gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
|
|
|
|
{
|
|
|
|
GSList *found;
|
|
|
|
GSList *new;
|
|
|
|
guint removals = 0;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-03 17:18:40 +00:00
|
|
|
g_static_mutex_lock (&__log_func_mutex);
|
|
|
|
new = __log_functions;
|
2003-08-17 16:45:09 +00:00
|
|
|
while ((found = g_slist_find_custom (new, data, func))) {
|
|
|
|
if (new == __log_functions) {
|
2003-08-03 17:18:40 +00:00
|
|
|
new = g_slist_copy (new);
|
2003-08-17 16:45:09 +00:00
|
|
|
continue;
|
2003-08-03 17:18:40 +00:00
|
|
|
}
|
2003-08-17 16:45:09 +00:00
|
|
|
g_free (found->data);
|
2003-08-17 20:18:58 +00:00
|
|
|
new = g_slist_delete_link (new, found);
|
2003-08-03 17:18:40 +00:00
|
|
|
removals++;
|
|
|
|
}
|
|
|
|
/* FIXME: We leak the old list here. See _add_log_function for why. */
|
|
|
|
__log_functions = new;
|
|
|
|
g_static_mutex_unlock (&__log_func_mutex);
|
|
|
|
|
|
|
|
return removals;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_remove_log_function:
|
|
|
|
* @func: the log function to remove
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Removes all registrered instances of the given logging functions.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: How many instances of the function were removed
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2003-06-29 14:05:49 +00:00
|
|
|
guint
|
|
|
|
gst_debug_remove_log_function (GstLogFunction func)
|
|
|
|
{
|
2003-08-03 17:18:40 +00:00
|
|
|
guint removals;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
2001-01-01 00:17:21 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
removals =
|
|
|
|
gst_debug_remove_with_compare_func
|
|
|
|
(gst_debug_compare_log_function_by_func, func);
|
|
|
|
GST_DEBUG ("removed log function %p %d times from log function list", func,
|
|
|
|
removals);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return removals;
|
2000-12-29 10:02:17 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_remove_log_function_by_data:
|
|
|
|
* @data: user data of the log function to remove
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Removes all registrered instances of log functions with the given user data.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: How many instances of the function were removed
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_debug_remove_log_function_by_data (gpointer data)
|
|
|
|
{
|
2003-08-03 17:18:40 +00:00
|
|
|
guint removals;
|
2003-06-29 14:05:49 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
removals =
|
|
|
|
gst_debug_remove_with_compare_func
|
|
|
|
(gst_debug_compare_log_function_by_data, data);
|
|
|
|
GST_DEBUG
|
|
|
|
("removed %d log functions with user data %p from log function list",
|
|
|
|
removals, data);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return removals;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_set_colored:
|
|
|
|
* @colored: Whether to use colored output or not
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Sets or unsets the use of coloured debugging output.
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2001-01-01 00:17:21 +00:00
|
|
|
void
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_set_colored (gboolean colored)
|
|
|
|
{
|
|
|
|
gst_atomic_int_set (&__use_color, colored ? 1 : 0);
|
2001-01-01 00:17:21 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_is_colored:
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Checks if the debugging output should be colored.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: TRUE, if the debug output should be colored.
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2003-06-29 14:05:49 +00:00
|
|
|
gboolean
|
|
|
|
gst_debug_is_colored (void)
|
|
|
|
{
|
2005-04-24 22:49:45 +00:00
|
|
|
return g_atomic_int_get (&__use_color) == 0 ? FALSE : TRUE;
|
2001-01-01 00:17:21 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_set_active:
|
|
|
|
* @active: Whether to use debugging output or not
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* If activated, debugging messages are sent to the debugging
|
|
|
|
* handlers.
|
|
|
|
* It makes sense to deactivate it for speed issues.
|
2003-08-03 17:18:40 +00:00
|
|
|
* <note><para>This function is not threadsafe. It makes sense to only call it
|
|
|
|
* during initialization.</para></note>
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2001-01-01 00:17:21 +00:00
|
|
|
void
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_set_active (gboolean active)
|
|
|
|
{
|
2003-08-03 17:18:40 +00:00
|
|
|
__gst_debug_enabled = active;
|
2006-03-22 18:25:04 +00:00
|
|
|
if (active)
|
|
|
|
__gst_debug_min = GST_LEVEL_COUNT;
|
2006-06-12 08:47:16 +00:00
|
|
|
else
|
|
|
|
__gst_debug_min = GST_LEVEL_NONE;
|
2001-01-01 00:17:21 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_is_active:
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Checks if debugging output is activated.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: TRUE, if debugging is activated
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_debug_is_active (void)
|
|
|
|
{
|
2003-08-03 17:18:40 +00:00
|
|
|
return __gst_debug_enabled;
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_set_default_threshold:
|
|
|
|
* @level: level to set
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Sets the default threshold to the given level and updates all categories to
|
|
|
|
* use this threshold.
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2001-01-01 00:17:21 +00:00
|
|
|
void
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_set_default_threshold (GstDebugLevel level)
|
|
|
|
{
|
|
|
|
gst_atomic_int_set (&__default_level, level);
|
|
|
|
gst_debug_reset_all_thresholds ();
|
2001-01-01 00:17:21 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_get_default_threshold:
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns the default threshold that is used for new categories.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: the default threshold level
|
|
|
|
*/
|
|
|
|
GstDebugLevel
|
|
|
|
gst_debug_get_default_threshold (void)
|
2004-03-13 15:27:01 +00:00
|
|
|
{
|
2005-04-24 22:49:45 +00:00
|
|
|
return (GstDebugLevel) g_atomic_int_get (&__default_level);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
gst_debug_reset_threshold (gpointer category, gpointer unused)
|
|
|
|
{
|
|
|
|
GstDebugCategory *cat = (GstDebugCategory *) category;
|
|
|
|
GSList *walk;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_static_mutex_lock (&__level_name_mutex);
|
|
|
|
walk = __level_name;
|
|
|
|
while (walk) {
|
|
|
|
LevelNameEntry *entry = walk->data;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
walk = g_slist_next (walk);
|
|
|
|
if (g_pattern_match_string (entry->pat, cat->name)) {
|
|
|
|
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
2004-03-15 19:27:17 +00:00
|
|
|
cat->name, entry->pat, entry->level);
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_category_set_threshold (cat, entry->level);
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
|
2001-01-01 00:17:21 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
exit:
|
|
|
|
g_static_mutex_unlock (&__level_name_mutex);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
gst_debug_reset_all_thresholds (void)
|
|
|
|
{
|
|
|
|
g_static_mutex_lock (&__cat_mutex);
|
|
|
|
g_slist_foreach (__categories, gst_debug_reset_threshold, NULL);
|
|
|
|
g_static_mutex_unlock (&__cat_mutex);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
for_each_threshold_by_entry (gpointer data, gpointer user_data)
|
|
|
|
{
|
|
|
|
GstDebugCategory *cat = (GstDebugCategory *) data;
|
|
|
|
LevelNameEntry *entry = (LevelNameEntry *) user_data;
|
2001-01-01 05:18:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
if (g_pattern_match_string (entry->pat, cat->name)) {
|
|
|
|
GST_LOG ("category %s matches pattern %p - gets set to level %d",
|
2004-03-15 19:27:17 +00:00
|
|
|
cat->name, entry->pat, entry->level);
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_category_set_threshold (cat, entry->level);
|
|
|
|
}
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-04 22:16:06 +00:00
|
|
|
/**
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_set_threshold_for_name:
|
|
|
|
* @name: name of the categories to set
|
|
|
|
* @level: level to set them to
|
2004-11-11 15:40:00 +00:00
|
|
|
*
|
|
|
|
* Sets all categories which match the given glob style pattern to the given
|
2003-06-29 14:05:49 +00:00
|
|
|
* level.
|
2001-01-04 22:16:06 +00:00
|
|
|
*/
|
2000-12-29 10:02:17 +00:00
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_set_threshold_for_name (const gchar * name, GstDebugLevel level)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
GPatternSpec *pat;
|
|
|
|
LevelNameEntry *entry;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_return_if_fail (name != NULL);
|
|
|
|
|
|
|
|
pat = g_pattern_spec_new (name);
|
|
|
|
entry = g_new (LevelNameEntry, 1);
|
|
|
|
entry->pat = pat;
|
|
|
|
entry->level = level;
|
|
|
|
g_static_mutex_lock (&__level_name_mutex);
|
|
|
|
__level_name = g_slist_prepend (__level_name, entry);
|
|
|
|
g_static_mutex_unlock (&__level_name_mutex);
|
|
|
|
g_static_mutex_lock (&__cat_mutex);
|
|
|
|
g_slist_foreach (__categories, for_each_threshold_by_entry, entry);
|
|
|
|
g_static_mutex_unlock (&__cat_mutex);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_unset_threshold_for_name:
|
|
|
|
* @name: name of the categories to set
|
2004-11-11 15:40:00 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Resets all categories with the given name back to the default level.
|
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_unset_threshold_for_name (const gchar * name)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
GPatternSpec *pat;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_return_if_fail (name != NULL);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
pat = g_pattern_spec_new (name);
|
|
|
|
g_static_mutex_lock (&__level_name_mutex);
|
|
|
|
walk = __level_name;
|
|
|
|
/* improve this if you want, it's mighty slow */
|
|
|
|
while (walk) {
|
|
|
|
LevelNameEntry *entry = walk->data;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
if (g_pattern_spec_equal (entry->pat, pat)) {
|
|
|
|
__level_name = g_slist_remove_link (__level_name, walk);
|
|
|
|
g_pattern_spec_free (entry->pat);
|
|
|
|
g_free (entry);
|
|
|
|
g_slist_free_1 (walk);
|
|
|
|
walk = __level_name;
|
2000-12-29 10:02:17 +00:00
|
|
|
}
|
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
g_static_mutex_unlock (&__level_name_mutex);
|
|
|
|
g_pattern_spec_free (pat);
|
|
|
|
gst_debug_reset_all_thresholds ();
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
GstDebugCategory *
|
2004-03-13 15:27:01 +00:00
|
|
|
_gst_debug_category_new (gchar * name, guint color, gchar * description)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
GstDebugCategory *cat;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
cat = g_new (GstDebugCategory, 1);
|
|
|
|
cat->name = g_strdup (name);
|
|
|
|
cat->color = color;
|
|
|
|
if (description != NULL) {
|
|
|
|
cat->description = g_strdup (description);
|
|
|
|
} else {
|
|
|
|
cat->description = g_strdup ("no description");
|
|
|
|
}
|
2005-04-24 22:49:45 +00:00
|
|
|
gst_atomic_int_set (&cat->threshold, 0);
|
2003-06-29 14:05:49 +00:00
|
|
|
gst_debug_reset_threshold (cat, NULL);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/* add to category list */
|
|
|
|
g_static_mutex_lock (&__cat_mutex);
|
|
|
|
__categories = g_slist_prepend (__categories, cat);
|
|
|
|
g_static_mutex_unlock (&__cat_mutex);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return cat;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_free:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: #GstDebugCategory to free.
|
|
|
|
*
|
|
|
|
* Removes and frees the category and all associated resources.
|
2003-06-29 14:05:49 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_free (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
if (category == NULL)
|
|
|
|
return;
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
/* remove from category list */
|
|
|
|
g_static_mutex_lock (&__cat_mutex);
|
|
|
|
__categories = g_slist_remove (__categories, category);
|
|
|
|
g_static_mutex_unlock (&__cat_mutex);
|
|
|
|
|
2003-12-22 10:51:03 +00:00
|
|
|
g_free ((gpointer) category->name);
|
|
|
|
g_free ((gpointer) category->description);
|
2003-06-29 14:05:49 +00:00
|
|
|
g_free (category);
|
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_set_threshold:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to set threshold of.
|
|
|
|
* @level: the #GstDebugLevel threshold to set.
|
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Sets the threshold of the category to the given level. Debug information will
|
2003-12-22 10:51:03 +00:00
|
|
|
* only be output if the threshold is lower or equal to the level of the
|
2003-06-29 14:05:49 +00:00
|
|
|
* debugging message.
|
|
|
|
* <note><para>
|
2003-12-22 10:51:03 +00:00
|
|
|
* Do not use this function in production code, because other functions may
|
|
|
|
* change the threshold of categories as side effect. It is however a nice
|
2003-06-29 14:05:49 +00:00
|
|
|
* function to use when debugging (even from gdb).
|
|
|
|
* </para></note>
|
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_set_threshold (GstDebugCategory * category,
|
|
|
|
GstDebugLevel level)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (category != NULL);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2006-06-12 08:47:16 +00:00
|
|
|
if (level > __gst_debug_min) {
|
2006-03-22 18:25:04 +00:00
|
|
|
__gst_debug_enabled = TRUE;
|
2006-06-12 08:47:16 +00:00
|
|
|
__gst_debug_min = level;
|
|
|
|
}
|
2006-03-22 18:25:04 +00:00
|
|
|
|
2005-04-24 22:49:45 +00:00
|
|
|
gst_atomic_int_set (&category->threshold, level);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_reset_threshold:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to reset threshold of.
|
|
|
|
*
|
|
|
|
* Resets the threshold of the category to the default level. Debug information
|
|
|
|
* will only be output if the threshold is lower or equal to the level of the
|
2003-06-29 14:05:49 +00:00
|
|
|
* debugging message.
|
2003-12-22 10:51:03 +00:00
|
|
|
* Use this function to set the threshold back to where it was after using
|
2003-06-29 14:05:49 +00:00
|
|
|
* gst_debug_category_set_threshold().
|
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_reset_threshold (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
gst_debug_reset_threshold (category, NULL);
|
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_get_threshold:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to get threshold of.
|
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns the threshold of a #GstCategory.
|
2003-12-22 10:51:03 +00:00
|
|
|
*
|
|
|
|
* Returns: the #GstDebugLevel that is used as threshold.
|
2003-06-29 14:05:49 +00:00
|
|
|
*/
|
|
|
|
GstDebugLevel
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_get_threshold (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
2005-04-24 22:49:45 +00:00
|
|
|
return g_atomic_int_get (&category->threshold);
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_get_name:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to get name of.
|
|
|
|
*
|
|
|
|
* Returns the name of a debug category.
|
|
|
|
*
|
|
|
|
* Returns: the name of the category.
|
2003-06-29 14:05:49 +00:00
|
|
|
*/
|
|
|
|
const gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_get_name (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
return category->name;
|
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_get_color:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to get the color of.
|
|
|
|
*
|
|
|
|
* Returns the color of a debug category used when printing output in this
|
|
|
|
* category.
|
|
|
|
*
|
|
|
|
* Returns: the color of the category.
|
2003-06-29 14:05:49 +00:00
|
|
|
*/
|
|
|
|
guint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_get_color (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
return category->color;
|
|
|
|
}
|
2003-12-22 10:51:03 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_category_get_description:
|
2003-12-22 10:51:03 +00:00
|
|
|
* @category: a #GstDebugCategory to get the description of.
|
|
|
|
*
|
|
|
|
* Returns the description of a debug category.
|
|
|
|
*
|
|
|
|
* Returns: the description of the category.
|
2003-06-29 14:05:49 +00:00
|
|
|
*/
|
|
|
|
const gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_debug_category_get_description (GstDebugCategory * category)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
return category->description;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_get_all_categories:
|
|
|
|
*
|
|
|
|
* Returns a snapshot of a all categories that are currently in use . This list
|
|
|
|
* may change anytime.
|
|
|
|
* The caller has to free the list after use.
|
2003-12-22 10:51:03 +00:00
|
|
|
*
|
2003-06-29 14:05:49 +00:00
|
|
|
* Returns: the list of categories
|
|
|
|
*/
|
|
|
|
GSList *
|
|
|
|
gst_debug_get_all_categories (void)
|
|
|
|
{
|
|
|
|
GSList *ret;
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
g_static_mutex_lock (&__cat_mutex);
|
|
|
|
ret = g_slist_copy (__categories);
|
|
|
|
g_static_mutex_unlock (&__cat_mutex);
|
2000-12-29 10:02:17 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
return ret;
|
2000-12-29 10:02:17 +00:00
|
|
|
}
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
/*** FUNCTION POINTERS ********************************************************/
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-09-21 21:39:06 +00:00
|
|
|
static GHashTable *__gst_function_pointers; /* NULL */
|
|
|
|
static GStaticMutex __dbg_functions_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
|
2003-08-07 12:45:31 +00:00
|
|
|
const gchar *
|
2005-07-20 16:20:39 +00:00
|
|
|
_gst_debug_nameof_funcptr (GstDebugFuncPtr ptr)
|
2004-03-13 15:27:01 +00:00
|
|
|
G_GNUC_NO_INSTRUMENT;
|
|
|
|
|
|
|
|
/* This function MUST NOT return NULL */
|
2005-07-20 16:20:39 +00:00
|
|
|
const gchar *_gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
2001-05-25 21:00:07 +00:00
|
|
|
{
|
2005-07-20 16:20:39 +00:00
|
|
|
gpointer ptr = (gpointer) func;
|
2001-05-25 21:00:07 +00:00
|
|
|
gchar *ptrname;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-06 03:00:21 +00:00
|
|
|
#ifdef HAVE_DLADDR
|
2001-05-25 21:00:07 +00:00
|
|
|
Dl_info dlinfo;
|
2003-08-06 03:00:21 +00:00
|
|
|
#endif
|
|
|
|
|
2006-06-12 08:47:16 +00:00
|
|
|
if (G_LIKELY (__gst_function_pointers)) {
|
2005-09-21 21:39:06 +00:00
|
|
|
g_static_mutex_lock (&__dbg_functions_mutex);
|
|
|
|
ptrname = g_hash_table_lookup (__gst_function_pointers, ptr);
|
|
|
|
g_static_mutex_unlock (&__dbg_functions_mutex);
|
2006-06-12 08:47:16 +00:00
|
|
|
if (G_LIKELY (ptrname))
|
2005-09-21 21:39:06 +00:00
|
|
|
return ptrname;
|
2003-08-07 12:45:31 +00:00
|
|
|
}
|
|
|
|
/* we need to create an entry in the hash table for this one so we don't leak
|
|
|
|
* the name */
|
2003-08-06 03:00:21 +00:00
|
|
|
#ifdef HAVE_DLADDR
|
2004-03-13 15:27:01 +00:00
|
|
|
if (dladdr (ptr, &dlinfo) && dlinfo.dli_sname) {
|
2003-08-07 12:45:31 +00:00
|
|
|
gchar *name = g_strdup (dlinfo.dli_sname);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-07 12:45:31 +00:00
|
|
|
_gst_debug_register_funcptr (ptr, name);
|
|
|
|
return name;
|
2003-08-06 03:00:21 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2003-08-07 12:45:31 +00:00
|
|
|
gchar *name = g_strdup_printf ("%p", ptr);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-08-07 12:45:31 +00:00
|
|
|
_gst_debug_register_funcptr (ptr, name);
|
|
|
|
return name;
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-06 03:00:21 +00:00
|
|
|
|
2005-07-20 16:20:39 +00:00
|
|
|
void
|
|
|
|
_gst_debug_register_funcptr (GstDebugFuncPtr func, gchar * ptrname)
|
2003-03-14 18:31:47 +00:00
|
|
|
{
|
2005-07-20 16:20:39 +00:00
|
|
|
gpointer ptr = (gpointer) func;
|
|
|
|
|
2005-09-21 21:39:06 +00:00
|
|
|
g_static_mutex_lock (&__dbg_functions_mutex);
|
|
|
|
|
2003-03-14 18:31:47 +00:00
|
|
|
if (!__gst_function_pointers)
|
|
|
|
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
|
|
|
|
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
|
|
|
|
g_hash_table_insert (__gst_function_pointers, ptr, ptrname);
|
2005-09-21 21:39:06 +00:00
|
|
|
|
|
|
|
g_static_mutex_unlock (&__dbg_functions_mutex);
|
2003-03-14 18:31:47 +00:00
|
|
|
}
|
2001-09-10 19:46:01 +00:00
|
|
|
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
#ifdef HAVE_PRINTF_EXTENSION
|
|
|
|
static int
|
2006-08-09 15:13:14 +00:00
|
|
|
_gst_info_printf_extension_ptr (FILE * stream, const struct printf_info *info,
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
const void *const *args)
|
|
|
|
{
|
|
|
|
char *buffer;
|
|
|
|
int len;
|
|
|
|
void *ptr;
|
|
|
|
|
|
|
|
buffer = NULL;
|
2004-03-13 15:27:01 +00:00
|
|
|
ptr = *(void **) args[0];
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
|
|
|
buffer = gst_debug_print_object (ptr);
|
|
|
|
len = fprintf (stream, "%*s", (info->left ? -info->width : info->width),
|
|
|
|
buffer);
|
|
|
|
|
2006-08-09 15:13:14 +00:00
|
|
|
g_free (buffer);
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_gst_info_printf_extension_segment (FILE * stream,
|
|
|
|
const struct printf_info *info, const void *const *args)
|
|
|
|
{
|
|
|
|
char *buffer;
|
|
|
|
int len;
|
|
|
|
void *ptr;
|
|
|
|
|
|
|
|
buffer = NULL;
|
|
|
|
ptr = *(void **) args[0];
|
|
|
|
|
|
|
|
buffer = gst_debug_print_segment (ptr);
|
|
|
|
len = fprintf (stream, "%*s", (info->left ? -info->width : info->width),
|
|
|
|
buffer);
|
|
|
|
|
|
|
|
g_free (buffer);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
|
|
|
|
int *argtypes)
|
|
|
|
{
|
|
|
|
if (n > 0)
|
|
|
|
argtypes[0] = PA_POINTER;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_PRINTF_EXTENSION */
|
|
|
|
|
2004-08-03 12:40:47 +00:00
|
|
|
#else /* !GST_DISABLE_GST_DEBUG */
|
2005-02-25 00:10:05 +00:00
|
|
|
guint
|
|
|
|
gst_debug_remove_log_function (GstLogFunction func)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
|
|
|
gst_debug_remove_log_function_by_data (gpointer data)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2004-08-03 12:40:47 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
__gst_in_valgrind (void)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#endif /* GST_DISABLE_GST_DEBUG */
|
2001-09-10 19:46:01 +00:00
|
|
|
|
2004-08-03 12:40:47 +00:00
|
|
|
|
2001-09-10 19:46:01 +00:00
|
|
|
#ifdef GST_ENABLE_FUNC_INSTRUMENTATION
|
2003-03-14 18:31:47 +00:00
|
|
|
/* FIXME make this thread specific */
|
|
|
|
static GSList *stack_trace = NULL;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
__cyg_profile_func_enter (void *this_fn, void *call_site)
|
|
|
|
G_GNUC_NO_INSTRUMENT;
|
|
|
|
void __cyg_profile_func_enter (void *this_fn, void *call_site)
|
2001-10-17 10:21:27 +00:00
|
|
|
{
|
|
|
|
gchar *name = _gst_debug_nameof_funcptr (this_fn);
|
|
|
|
gchar *site = _gst_debug_nameof_funcptr (call_site);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_CALL_TRACE, "entering function %s from %s", name,
|
|
|
|
site);
|
|
|
|
stack_trace =
|
|
|
|
g_slist_prepend (stack_trace, g_strdup_printf ("%8p in %s from %p (%s)",
|
2004-03-15 19:27:17 +00:00
|
|
|
this_fn, name, call_site, site));
|
2001-10-17 10:21:27 +00:00
|
|
|
|
|
|
|
g_free (name);
|
|
|
|
g_free (site);
|
2001-09-10 19:46:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
__cyg_profile_func_exit (void *this_fn, void *call_site)
|
|
|
|
G_GNUC_NO_INSTRUMENT;
|
|
|
|
void __cyg_profile_func_exit (void *this_fn, void *call_site)
|
2001-10-17 10:21:27 +00:00
|
|
|
{
|
|
|
|
gchar *name = _gst_debug_nameof_funcptr (this_fn);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_CALL_TRACE, "leaving function %s", name);
|
2001-10-17 10:21:27 +00:00
|
|
|
g_free (stack_trace->data);
|
|
|
|
stack_trace = g_slist_delete_link (stack_trace, stack_trace);
|
|
|
|
|
|
|
|
g_free (name);
|
|
|
|
}
|
|
|
|
|
2005-10-09 20:49:46 +00:00
|
|
|
/**
|
|
|
|
* gst_debug_print_stack_trace:
|
|
|
|
*
|
|
|
|
* If GST_ENABLE_FUNC_INSTRUMENTATION is defined a stacktracke is available for
|
2005-10-15 15:30:24 +00:00
|
|
|
* gstreamer code, which can be printed with this function.
|
2005-10-09 20:49:46 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
2001-10-17 10:21:27 +00:00
|
|
|
gst_debug_print_stack_trace (void)
|
|
|
|
{
|
|
|
|
GSList *walk = stack_trace;
|
|
|
|
gint count = 0;
|
|
|
|
|
|
|
|
if (walk)
|
|
|
|
walk = g_slist_next (walk);
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
gchar *name = (gchar *) walk->data;
|
|
|
|
|
|
|
|
g_print ("#%-2d %s\n", count++, name);
|
|
|
|
|
|
|
|
walk = g_slist_next (walk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
2001-10-17 10:21:27 +00:00
|
|
|
gst_debug_print_stack_trace (void)
|
|
|
|
{
|
2001-12-14 22:59:21 +00:00
|
|
|
/* nothing because it's compiled out */
|
2001-09-10 19:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */
|