glwindow: remove is_running() function

It isn't necessary in correctly written programs.
This commit is contained in:
Matthew Waters 2016-10-26 16:30:43 +11:00 committed by Tim-Philipp Müller
parent 204e68a5b1
commit 2b89a2c348
6 changed files with 82 additions and 109 deletions

View file

@ -2326,15 +2326,14 @@ static gboolean
gst_glimage_sink_redisplay (GstGLImageSink * gl_sink)
{
GstGLWindow *window;
gboolean alive;
GstBuffer *old_stored_buffer[2], *old_sync;
gulong handler_id;
window = gst_gl_context_get_window (gl_sink->context);
if (!window)
return FALSE;
if (gst_gl_window_is_running (window)) {
gulong handler_id =
handler_id =
g_signal_handler_find (GST_ELEMENT_PARENT (gl_sink), G_SIGNAL_MATCH_ID,
gst_gl_image_sink_bin_signals[SIGNAL_BIN_CLIENT_DRAW], 0,
NULL, NULL, NULL);
@ -2406,9 +2405,7 @@ gst_glimage_sink_redisplay (GstGLImageSink * gl_sink)
* It means that it does not wait for stuff to be executed in other threads
*/
gst_gl_window_draw (window);
}
alive = gst_gl_window_is_running (window);
gst_object_unref (window);
return alive;
return TRUE;
}

View file

@ -329,15 +329,13 @@ gst_gl_cocoa_draw_cb (GstGLWindowCocoa *window_cocoa)
GstGLWindowCocoaPrivate *priv = window_cocoa->priv;
GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
if (gst_gl_window_is_running (window)) {
if (![priv->internal_win_id isClosed]) {
if (window_cocoa->priv->internal_win_id && ![priv->internal_win_id isClosed]) {
GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
/* draw opengl scene in the back buffer */
if (window->draw)
window->draw (window->draw_data);
}
}
}
static void
@ -348,7 +346,7 @@ gst_gl_cocoa_resize_cb (GstGLNSView * view, guint width, guint height)
GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
GstGLContext *context = gst_gl_window_get_context (window);
if (gst_gl_window_is_running (window) && ![window_cocoa->priv->internal_win_id isClosed]) {
if (window_cocoa->priv->internal_win_id && ![window_cocoa->priv->internal_win_id isClosed]) {
const GstGLFuncs *gl;
NSRect bounds = [view bounds];
NSRect visibleRect = [view visibleRect];

View file

@ -897,12 +897,8 @@ gst_gl_context_set_window (GstGLContext * context, GstGLWindow * window)
if (context->priv->alive)
return FALSE;
if (window) {
if (gst_gl_window_is_running (window))
return FALSE;
if (window)
g_weak_ref_set (&window->context_ref, context);
}
if (context->window)
gst_object_unref (context->window);

View file

@ -782,22 +782,6 @@ gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
GST_GL_WINDOW_UNLOCK (window);
}
/**
* gst_gl_window_is_running:
* @window: a #GstGLWindow
*
* Whether the runloop is running
*
* Since: 1.4
*/
gboolean
gst_gl_window_is_running (GstGLWindow * window)
{
GstGLWindowPrivate *priv = window->priv;
return priv->alive && (!priv->loop
|| g_main_loop_is_running (window->priv->loop));
}
/**
* gst_gl_window_get_display:
* @window: a #GstGLWindow

View file

@ -111,9 +111,10 @@ struct _GstGLWindow {
* GstGLWindowClass:
* @parent_class: Parent class
* @get_display: Gets the current windowing system display connection
* @set_window_handle: Set a window to render into
* @get_window_handle: Gets the current window that this #GstGLWindow is
* rendering into
* @set_window_handle: Set a window handle to render into
* @get_window_handle: Gets the current window handle that this #GstGLWindow is
* rendering into. This may return a different value to
* what is passed into @set_window_handle
* @draw: redraw the window with the specified dimensions
* @run: run the mainloop
* @quit: send a quit to the mainloop
@ -186,8 +187,6 @@ void gst_gl_window_run (GstGLWindow *window);
GST_EXPORT
void gst_gl_window_quit (GstGLWindow *window);
GST_EXPORT
gboolean gst_gl_window_is_running (GstGLWindow *window);
GST_EXPORT
void gst_gl_window_send_message (GstGLWindow *window,
GstGLWindowCB callback,
gpointer data);

View file

@ -363,11 +363,10 @@ draw_cb (gpointer data)
{
GstGLWindowX11 *window_x11 = data;
GstGLWindow *window = GST_GL_WINDOW (window_x11);
if (gst_gl_window_is_running (window)) {
guint width, height;
XWindowAttributes attr;
if (window_x11->internal_win_id) {
XGetWindowAttributes (window_x11->device, window_x11->internal_win_id,
&attr);
GST_TRACE_OBJECT (window, "window size %ux%u", attr.width, attr.height);