static gboolean gst_glimage_sink_redisplay (GstGLImageSink * gl_sink) { GstGLWindow *window; gboolean alive; window = gst_gl_context_get_window (gl_sink->context); if (window && gst_gl_window_is_running (window)) { #if GST_GL_HAVE_GLES2 if (USING_GLES2 (gl_sink->context)) { if (!gl_sink->redisplay_shader) { gst_gl_window_send_message (window, GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink); } } #endif /* Drawing is asynchrone: gst_gl_window_draw is not blocking * It means that it does not wait for stuff being executed in other threads */ gst_gl_window_draw (window, GST_VIDEO_SINK_WIDTH (gl_sink), GST_VIDEO_SINK_HEIGHT (gl_sink)); } alive = gst_gl_window_is_running (window); gst_object_unref (window); return alive; }
/** * gst_gl_context_set_window: * @context: a #GstGLContext * @window: (transfer full): a #GstGLWindow * * Set's the current window on @context to @window. The window can only be * changed before gst_gl_context_create() has been called and the @window is not * already running. * * Returns: Whether the window was successfully updated * * Since: 1.4 */ gboolean gst_gl_context_set_window (GstGLContext * context, GstGLWindow * window) { g_return_val_if_fail (!GST_IS_GL_WRAPPED_CONTEXT (context), FALSE); GST_DEBUG_OBJECT (context, "window:%" GST_PTR_FORMAT, window); /* we can't change the window while we are running */ if (context->priv->alive) return FALSE; if (window) { if (gst_gl_window_is_running (window)) return FALSE; g_weak_ref_set (&window->context_ref, context); } if (context->window) gst_object_unref (context->window); context->window = window ? gst_object_ref (window) : NULL; return TRUE; }
static gboolean gst_glimage_sink_redisplay (GstGLImageSink * gl_sink) { GstGLWindow *window; gboolean alive; window = gst_gl_context_get_window (gl_sink->context); if (!window) return FALSE; if (gst_gl_window_is_running (window)) { #if GST_GL_HAVE_GLES2 if (USING_GLES2 (gl_sink->context)) { if (G_UNLIKELY (!gl_sink->redisplay_shader)) { gst_gl_window_send_message (window, GST_GL_WINDOW_CB (gst_glimage_sink_thread_init_redisplay), gl_sink); /* if the shader is still null it means it failed to be useable */ if (G_UNLIKELY (!gl_sink->redisplay_shader)) { gst_object_unref (window); return FALSE; } } } #endif /* Drawing is asynchronous: gst_gl_window_draw is not blocking * It means that it does not wait for stuff to be executed in other threads */ gst_gl_window_draw (window, GST_VIDEO_SINK_WIDTH (gl_sink), GST_VIDEO_SINK_HEIGHT (gl_sink)); } alive = gst_gl_window_is_running (window); gst_object_unref (window); return alive; }