glwindow: initialize debug in class_init

Useful if one uses gst_gl_window_x11_new directly
instead of gst_gl_window_new.
This commit is contained in:
Julien Isorce 2015-05-27 11:11:55 +01:00 committed by Tim-Philipp Müller
parent a81de2f282
commit 01961ec44d

View file

@ -164,6 +164,18 @@ gst_gl_window_default_close (GstGLWindow * window)
g_main_context_unref (priv->main_context); g_main_context_unref (priv->main_context);
} }
static void
_init_debug (void)
{
static volatile gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
"glwindow element");
g_once_init_leave (&_init, 1);
}
}
static void static void
gst_gl_window_init (GstGLWindow * window) gst_gl_window_init (GstGLWindow * window)
{ {
@ -228,6 +240,8 @@ gst_gl_window_class_init (GstGLWindowClass * klass)
g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass), g_signal_new ("key-event", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
_init_debug ();
} }
/** /**
@ -243,15 +257,10 @@ gst_gl_window_new (GstGLDisplay * display)
{ {
GstGLWindow *window = NULL; GstGLWindow *window = NULL;
const gchar *user_choice; const gchar *user_choice;
static volatile gsize _init = 0;
g_return_val_if_fail (display != NULL, NULL); g_return_val_if_fail (display != NULL, NULL);
if (g_once_init_enter (&_init)) { _init_debug ();
GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
"glwindow element");
g_once_init_leave (&_init, 1);
}
user_choice = g_getenv ("GST_GL_WINDOW"); user_choice = g_getenv ("GST_GL_WINDOW");
GST_INFO ("creating a window, user choice:%s", user_choice); GST_INFO ("creating a window, user choice:%s", user_choice);