From 8cc76f501374ce72506726ca90b1545fa7fb314f Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Mon, 1 Jan 2001 05:18:07 +0000 Subject: [PATCH] updated the debug system so it works nicely now Original commit message from CVS: updated the debug system so it works nicely now --- gst/gst.c | 8 ++++---- gst/gstinfo.c | 18 ++++++++++++++++++ gst/gstinfo.h | 8 +++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index 7a1391efa6..302764b395 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -110,14 +110,14 @@ gst_init_check (int *argc, (*argv)[i] = NULL; } - else if (!strncmp ("--gst-info-mask=", (*argv)[i], 16)) { + else if (!strncmp ("--gst-debug-mask=", (*argv)[i], 17)) { guint32 val; // handle either 0xHEX or dec - if (*((*argv)[i]+17) == 'x') { - sscanf ((*argv)[i]+18, "%08x", &val); + if (*((*argv)[i]+18) == 'x') { + sscanf ((*argv)[i]+19, "%08x", &val); } else { - sscanf ((*argv)[i]+16, "%d", &val); + sscanf ((*argv)[i]+17, "%d", &val); } gst_debug_set_categories (val); diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 63273b90bc..492879a3e4 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -90,6 +90,8 @@ gst_default_info_handler (gint category, gchar *file, gchar *function, void gst_info_set_categories (guint32 categories) { _gst_info_categories = categories; + if (categories) + GST_INFO (0, "setting INFO categories to 0x%08X\n",categories); } guint32 @@ -100,16 +102,28 @@ gst_info_get_categories () { void gst_info_enable_category (gint category) { _gst_info_categories |= (1 << category); + if (_gst_info_categories) + GST_INFO (0, "setting INFO categories to 0x%08X\n",_gst_info_categories); } void gst_info_disable_category (gint category) { _gst_info_categories &= ~ (1 << category); + if (_gst_info_categories) + GST_INFO (0, "setting INFO categories to 0x%08X\n",_gst_info_categories); } + + +/***** DEBUG system *****/ +guint32 _gst_debug_categories = 0x00000000; + + void gst_debug_set_categories (guint32 categories) { _gst_debug_categories = categories; + if (categories) + GST_INFO (0, "setting DEBUG categories to 0x%08X\n",categories); } guint32 @@ -120,11 +134,15 @@ gst_debug_get_categories () { void gst_debug_enable_category (gint category) { _gst_debug_categories |= (1 << category); + if (_gst_debug_categories) + GST_INFO (0, "setting DEBUG categories to 0x%08X\n",_gst_debug_categories); } void gst_debug_disable_category (gint category) { _gst_debug_categories &= ~ (1 << category); + if (_gst_debug_categories) + GST_INFO (0, "setting DEBUG categories to 0x%08X\n",_gst_debug_categories); } const gchar * diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 3aecccf52a..5114a24ba5 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -49,9 +49,11 @@ extern guint32 _gst_debug_categories; #define GST_DEBUG_ENABLED #endif -#ifndef GST_DEBUG_ENABLE_CATEGORIES -#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000 -#endif +//#ifdef GST_DEBUG_ENABLED +#define GST_DEBUG_ENABLE_CATEGORIES 0xffffffff +//#else +//#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000 +//#endif /* fallback, this should probably be a 'weak' symbol or something */ G_GNUC_UNUSED static gchar *_debug_string = NULL;