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.
This commit is contained in:
Sebastian Dröge 2019-10-01 18:02:27 +03:00
parent eabfd98e6d
commit 1d12f0b1a1
2 changed files with 34 additions and 7 deletions

View file

@ -34,11 +34,13 @@
G_BEGIN_DECLS G_BEGIN_DECLS
GST_DEBUG_CATEGORY_EXTERN (_ges_debug);
#ifndef GST_CAT_DEFAULT #ifndef GST_CAT_DEFAULT
#define GST_CAT_DEFAULT _ges_debug #define GST_CAT_DEFAULT (_ges_debug ())
#endif #endif
G_GNUC_INTERNAL
GstDebugCategory * _ges_debug (void);
/* The first 2 NLE priorities are used for: /* The first 2 NLE priorities are used for:
* 0- The Mixing element * 0- The Mixing element
* 1- The Gaps * 1- The Gaps

View file

@ -46,7 +46,7 @@
#define GES_GNONLIN_VERSION_NEEDED_MINOR 2 #define GES_GNONLIN_VERSION_NEEDED_MINOR 2
#define GES_GNONLIN_VERSION_NEEDED_MICRO 0 #define GES_GNONLIN_VERSION_NEEDED_MICRO 0
GST_DEBUG_CATEGORY (_ges_debug); GST_DEBUG_CATEGORY (_ges_debug_category);
G_LOCK_DEFINE_STATIC (init_lock); G_LOCK_DEFINE_STATIC (init_lock);
@ -55,6 +55,35 @@ G_LOCK_DEFINE_STATIC (init_lock);
*/ */
static GThread *initialized_thread = NULL; 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 static gboolean
ges_init_pre (GOptionContext * context, GOptionGroup * group, gpointer data, ges_init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
GError ** error) GError ** error)
@ -64,10 +93,6 @@ ges_init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
return TRUE; return TRUE;
} }
/* initialize debugging category */
GST_DEBUG_CATEGORY_INIT (_ges_debug, "ges", GST_DEBUG_FG_YELLOW,
"GStreamer Editing Services");
return TRUE; return TRUE;
} }