diff --git a/ChangeLog b/ChangeLog index e7c72f71d8..351e96a8f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2007-11-06 Tim-Philipp Müller + + * gst/gst.c: (_gst_disable_segtrap): + Make _gst_disable_segtrap static, it's only used in gstplugin.c and + we can use gst_segtrap_is_enabled() there now that we have that API. + Move _gst_debug_dump_dot_dir into gstdebugutils.c, there's no reason + to do the getenv here (and export the variable). + + * gst/gstdebugutils.c: (debug_dump_element), + (_gst_debug_bin_to_dot_file), (_gst_debug_bin_to_dot_file_with_ts): + Don't use VLAs which is a C99ism and throws off MSVC (#493983). + + * gst/gstinfo.c: (_priv_gst_info_start_time), (_gst_debug_init), + (gst_debug_log_default): + Rename _gst_info_start_time to priv_gst_info_start_time so it + doesn't get exported (was never in any header). + + * gst/gstplugin.c: (_gst_plugin_fault_handler_setup), + (gst_plugin_loading_mutex): + Make static mutex gst_plugin_loading_mutex really static (was never + in any header), and use gst_segtrap_is_enabled() instead of + _gst_disable_segtrap. + + * gst/gsttrace.c: (_gst_trace_default): + Make local _gst_trace_default static (was never in any header). + 2007-11-06 Tim-Philipp Müller Patch by: Ole André Vadla Ravnås diff --git a/gst/gst.c b/gst/gst.c index f5910ec7cc..a45daa43a5 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -134,7 +134,6 @@ static GList *plugin_paths = NULL; /* for delayed processing in post_init * #endif extern gint _gst_trace_on; -extern const gchar *_gst_debug_dump_dot_dir; /* defaults */ #ifdef HAVE_FORK @@ -143,9 +142,8 @@ extern const gchar *_gst_debug_dump_dot_dir; #define DEFAULT_FORK FALSE #endif /* HAVE_FORK */ -/* set to TRUE when segfaults need to be left as is, FIXME, this variable is - * global. */ -gboolean _gst_disable_segtrap = FALSE; +/* set to TRUE when segfaults need to be left as is */ +static gboolean _gst_disable_segtrap = FALSE; /* control the behaviour of registry rebuild */ static gboolean _gst_enable_registry_fork = DEFAULT_FORK; @@ -586,8 +584,6 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data, if (debug_list) { parse_debug_list (debug_list); } - - _gst_debug_dump_dot_dir = g_getenv ("GST_DEBUG_DUMP_DOT_DIR"); } #endif /* This is the earliest we can make stuff show up in the logs. diff --git a/gst/gstdebugutils.c b/gst/gstdebugutils.c index 25b8025c4d..fdbc83163f 100644 --- a/gst/gstdebugutils.c +++ b/gst/gstdebugutils.c @@ -37,8 +37,7 @@ /*** PIPELINE GRAPHS **********************************************************/ -const gchar *_gst_debug_dump_dot_dir = NULL; -extern GstClockTime _gst_info_start_time; +extern GstClockTime _priv_gst_info_start_time; static gchar * debug_dump_make_object_name (GstObject * element) @@ -138,8 +137,9 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out, gchar *color_name; gchar *state_name = NULL; gchar *param_name = NULL; - gchar spc[1 + indent * 2]; + gchar *spc = NULL; + spc = g_malloc (1 + indent * 2); memset (spc, 32, indent * 2); spc[indent * 2] = '\0'; @@ -251,8 +251,7 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out, free_caps = TRUE; } else { free_caps = FALSE; - if (!(caps = - (GstCaps *) + if (!(caps = (GstCaps *) gst_pad_get_pad_template_caps (pad))) { /* this should not happen */ media = "?"; @@ -263,6 +262,7 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out, gchar *tmp = g_strdelimit (gst_caps_to_string (caps), ",", '\n'); + media = g_strescape (tmp, NULL); free_media = TRUE; g_free (tmp); @@ -397,6 +397,7 @@ debug_dump_element (GstBin * bin, GstDebugGraphDetails details, FILE * out, } } gst_iterator_free (element_iter); + g_free (spc); } /* @@ -415,12 +416,14 @@ void _gst_debug_bin_to_dot_file (GstBin * bin, GstDebugGraphDetails details, const gchar * file_name) { + const gchar *dump_dot_dir; gchar *full_file_name = NULL; FILE *out; g_return_if_fail (GST_IS_BIN (bin)); - if (!_gst_debug_dump_dot_dir) + dump_dot_dir = g_getenv ("GST_DEBUG_DUMP_DOT_DIR"); + if (!dump_dot_dir) return; if (!file_name) { @@ -430,7 +433,7 @@ _gst_debug_bin_to_dot_file (GstBin * bin, GstDebugGraphDetails details, } full_file_name = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.dot", - _gst_debug_dump_dot_dir, file_name); + dump_dot_dir, file_name); if ((out = fopen (full_file_name, "wb"))) { gchar *state_name = NULL; @@ -498,7 +501,7 @@ _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details, /* add timestamp */ g_get_current_time (&now); - elapsed = GST_TIMEVAL_TO_TIME (now) - _gst_info_start_time; + elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time; ts_file_name = g_strdup_printf ("%" GST_TIME_FORMAT "-%s", GST_TIME_ARGS (elapsed), file_name); diff --git a/gst/gstinfo.c b/gst/gstinfo.c index adc38ea645..2833a8906c 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -120,7 +120,7 @@ GST_DEBUG_CATEGORY_STATIC (_GST_CAT_DEBUG); * FIXME: we use this in gstdebugutils.c, what about a function + macro to * get the running time: GST_DEBUG_RUNNING_TIME */ -GstClockTime _gst_info_start_time; +GstClockTime _priv_gst_info_start_time; #if 0 #if defined __sgi__ @@ -284,7 +284,7 @@ _gst_debug_init (void) /* get time we started for debugging messages */ g_get_current_time (¤t); - _gst_info_start_time = GST_TIMEVAL_TO_TIME (current); + _priv_gst_info_start_time = GST_TIMEVAL_TO_TIME (current); #ifdef HAVE_PRINTF_EXTENSION register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr, @@ -670,7 +670,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level, } g_get_current_time (&now); - elapsed = GST_TIMEVAL_TO_TIME (now) - _gst_info_start_time; + elapsed = GST_TIMEVAL_TO_TIME (now) - _priv_gst_info_start_time; /* g_printerr ("%s (%p - %" GST_TIME_FORMAT ") %s%20s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n", diff --git a/gst/gstplugin.c b/gst/gstplugin.c index bd43f4bc88..ceee9cf291 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -65,13 +65,7 @@ #include "gst_private.h" -#include "gstplugin.h" -#include "gstversion.h" -#include "gstinfo.h" -#include "gstfilter.h" -#include "gstregistry.h" -#include "gstmacros.h" - +#include #define GST_CAT_DEFAULT GST_CAT_PLUGIN_LOADING @@ -80,7 +74,6 @@ static gboolean _gst_plugin_inited; /* static variables for segfault handling of plugin loading */ static char *_gst_plugin_fault_handler_filename = NULL; -extern gboolean _gst_disable_segtrap; /* see gst.c */ #ifndef HAVE_WIN32 static gboolean _gst_plugin_fault_handler_is_setup = FALSE; @@ -327,7 +320,7 @@ _gst_plugin_fault_handler_setup (void) struct sigaction action; /* if asked to leave segfaults alone, just return */ - if (_gst_disable_segtrap) + if (!gst_segtrap_is_enabled ()) return; if (_gst_plugin_fault_handler_is_setup) @@ -354,7 +347,7 @@ _gst_plugin_fault_handler_setup (void) static void _gst_plugin_fault_handler_setup (); -GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT; +static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT; /** * gst_plugin_load_file: diff --git a/gst/gsttrace.c b/gst/gsttrace.c index 709800e5d2..819886080f 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -95,7 +95,7 @@ gst_trace_read_tsc (gint64 * dst) read_tsc (dst); } -GstTrace *_gst_trace_default = NULL; +static GstTrace *_gst_trace_default = NULL; gint _gst_trace_on = 1; /**