diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2019-10-01 18:02:27 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-10-05 00:23:03 +0100 |
commit | a7bcc42098fbbef5182db19270f4796e9537b97e (patch) | |
tree | 77dade1fcb737e43af3140eaadac5bc445a4537f | |
parent | 1864da82e1428af9520bfa0872e420ab713c7b17 (diff) |
ges: Hide internal debug category behind a GOnce
Otherwise it might be used (e.g. by the plugin loader via the GES
plugin!) before ges_init() is called.
-rw-r--r-- | ges/ges-internal.h | 6 | ||||
-rw-r--r-- | ges/ges.c | 35 |
2 files changed, 34 insertions, 7 deletions
diff --git a/ges/ges-internal.h b/ges/ges-internal.h index e0c4eda9..cc99998f 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -34,11 +34,13 @@ G_BEGIN_DECLS -GST_DEBUG_CATEGORY_EXTERN (_ges_debug); #ifndef GST_CAT_DEFAULT -#define GST_CAT_DEFAULT _ges_debug +#define GST_CAT_DEFAULT (_ges_debug ()) #endif +G_GNUC_INTERNAL +GstDebugCategory * _ges_debug (void); + /* The first 2 NLE priorities are used for: * 0- The Mixing element * 1- The Gaps @@ -43,7 +43,7 @@ #define GES_GNONLIN_VERSION_NEEDED_MINOR 2 #define GES_GNONLIN_VERSION_NEEDED_MICRO 0 -GST_DEBUG_CATEGORY (_ges_debug); +GST_DEBUG_CATEGORY (_ges_debug_category); G_LOCK_DEFINE_STATIC (init_lock); @@ -52,6 +52,35 @@ G_LOCK_DEFINE_STATIC (init_lock); */ static GThread *initialized_thread = NULL; +#ifndef GST_DISABLE_GST_DEBUG +static gpointer +init_debug_category (gpointer data) +{ + /* initialize debugging category */ + GST_DEBUG_CATEGORY_INIT (_ges_debug_category, "ges", GST_DEBUG_FG_YELLOW, + "GStreamer Editing Services"); + + return _ges_debug_category; +} + +GstDebugCategory * +_ges_debug (void) +{ + static GOnce my_once = G_ONCE_INIT; + + g_once (&my_once, init_debug_category, NULL); + + return my_once.retval; +} +#else +GstDebugCategory * +_ges_debug (void) +{ + return NULL; +} + +#endif + static gboolean ges_init_pre (GOptionContext * context, GOptionGroup * group, gpointer data, GError ** error) @@ -61,10 +90,6 @@ ges_init_pre (GOptionContext * context, GOptionGroup * group, gpointer data, return TRUE; } - /* initialize debugging category */ - GST_DEBUG_CATEGORY_INIT (_ges_debug, "ges", GST_DEBUG_FG_YELLOW, - "GStreamer Editing Services"); - return TRUE; } |