/** * gst_gl_window_new: * @display: a #GstGLDisplay * * Returns: (transfer full): a new #GstGLWindow using @display's connection */ GstGLWindow * gst_gl_window_new (GstGLDisplay * display) { GstGLWindow *window = NULL; const gchar *user_choice; static volatile gsize _init = 0; g_return_val_if_fail (display != NULL, NULL); if (g_once_init_enter (&_init)) { 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"); GST_INFO ("creating a window, user choice:%s", user_choice); #if GST_GL_HAVE_WINDOW_COCOA if (!window && (!user_choice || g_strstr_len (user_choice, 5, "cocoa"))) window = GST_GL_WINDOW (gst_gl_window_cocoa_new ()); #endif #if GST_GL_HAVE_WINDOW_X11 if (!window && (!user_choice || g_strstr_len (user_choice, 3, "x11"))) window = GST_GL_WINDOW (gst_gl_window_x11_new (display)); #endif #if GST_GL_HAVE_WINDOW_WIN32 if (!window && (!user_choice || g_strstr_len (user_choice, 5, "win32"))) window = GST_GL_WINDOW (gst_gl_window_win32_new ()); #endif #if GST_GL_HAVE_WINDOW_WAYLAND if (!window && (!user_choice || g_strstr_len (user_choice, 7, "wayland"))) window = GST_GL_WINDOW (gst_gl_window_wayland_egl_new ()); #endif #if GST_GL_HAVE_WINDOW_DISPMANX if (!window && (!user_choice || g_strstr_len (user_choice, 8, "dispmanx"))) window = GST_GL_WINDOW (gst_gl_window_dispmanx_egl_new ()); #endif #if GST_GL_HAVE_WINDOW_ANDROID if (!window && (!user_choice || g_strstr_len (user_choice, 7, "android"))) window = GST_GL_WINDOW (gst_gl_window_android_egl_new ()); #endif #if GST_GL_HAVE_WINDOW_EAGL if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl"))) window = GST_GL_WINDOW (gst_gl_window_eagl_new ()); #endif if (!window) { /* subclass returned a NULL window */ GST_WARNING ("Could not create window. user specified %s, creating dummy" " window", user_choice ? user_choice : "(null)"); window = GST_GL_WINDOW (gst_gl_dummy_window_new ()); } window->display = gst_object_ref (display); return window; }
/** * gst_gl_window_new: * @display: a #GstGLDisplay * * Returns: (transfer full): a new #GstGLWindow using @display's connection * * Since: 1.4 */ GstGLWindow * gst_gl_window_new (GstGLDisplay * display) { GstGLWindow *window = NULL; const gchar *user_choice; g_return_val_if_fail (display != NULL, NULL); _init_debug (); user_choice = g_getenv ("GST_GL_WINDOW"); GST_INFO ("creating a window, user choice:%s", user_choice); #if GST_GL_HAVE_WINDOW_COCOA if (!window && (!user_choice || g_strstr_len (user_choice, 5, "cocoa"))) window = GST_GL_WINDOW (gst_gl_window_cocoa_new (display)); #endif #if GST_GL_HAVE_WINDOW_X11 if (!window && (!user_choice || g_strstr_len (user_choice, 3, "x11"))) window = GST_GL_WINDOW (gst_gl_window_x11_new (display)); #endif #if GST_GL_HAVE_WINDOW_WIN32 if (!window && (!user_choice || g_strstr_len (user_choice, 5, "win32"))) window = GST_GL_WINDOW (gst_gl_window_win32_new (display)); #endif #if GST_GL_HAVE_WINDOW_WAYLAND if (!window && (!user_choice || g_strstr_len (user_choice, 7, "wayland"))) window = GST_GL_WINDOW (gst_gl_window_wayland_egl_new (display)); #endif #if GST_GL_HAVE_WINDOW_DISPMANX if (!window && (!user_choice || g_strstr_len (user_choice, 8, "dispmanx"))) window = GST_GL_WINDOW (gst_gl_window_dispmanx_egl_new (display)); #endif #if GST_GL_HAVE_WINDOW_ANDROID if (!window && (!user_choice || g_strstr_len (user_choice, 7, "android"))) window = GST_GL_WINDOW (gst_gl_window_android_egl_new (display)); #endif #if GST_GL_HAVE_WINDOW_EAGL if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl"))) window = GST_GL_WINDOW (gst_gl_window_eagl_new (display)); #endif if (!window) { /* subclass returned a NULL window */ GST_WARNING ("Could not create window. user specified %s, creating dummy" " window", user_choice ? user_choice : "(null)"); window = GST_GL_WINDOW (gst_gl_dummy_window_new ()); } window->display = gst_object_ref (display); g_mutex_lock (&window->priv->nav_lock); window->priv->navigation_thread = g_thread_new ("gstglnavigation", (GThreadFunc) gst_gl_window_navigation_thread, window); while (!window->priv->nav_alive) g_cond_wait (&window->priv->nav_create_cond, &window->priv->nav_lock); g_mutex_unlock (&window->priv->nav_lock); return window; }