mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
[862/906] window: remove set_need_lock
No-one is using it. The only code that did was the x11 one which doesn't need it anymore.
This commit is contained in:
parent
48d92cbe88
commit
cf7838a0b6
8 changed files with 6 additions and 73 deletions
|
@ -90,8 +90,6 @@ gst_gl_window_android_egl_new (void)
|
||||||
|
|
||||||
window = g_object_new (GST_GL_TYPE_WINDOW_ANDROID_EGL, NULL);
|
window = g_object_new (GST_GL_TYPE_WINDOW_ANDROID_EGL, NULL);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,6 @@ static void
|
||||||
gst_gl_window_cocoa_init (GstGLWindowCocoa * window)
|
gst_gl_window_cocoa_init (GstGLWindowCocoa * window)
|
||||||
{
|
{
|
||||||
window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window);
|
window->priv = GST_GL_WINDOW_COCOA_GET_PRIVATE (window);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
|
|
|
@ -91,8 +91,6 @@ gst_gl_window_dispmanx_egl_new (void)
|
||||||
|
|
||||||
window = g_object_new (GST_GL_TYPE_WINDOW_DISPMANX_EGL, NULL);
|
window = g_object_new (GST_GL_TYPE_WINDOW_DISPMANX_EGL, NULL);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
|
|
||||||
window->egldisplay = EGL_DEFAULT_DISPLAY;
|
window->egldisplay = EGL_DEFAULT_DISPLAY;
|
||||||
|
|
||||||
window->display = 0;
|
window->display = 0;
|
||||||
|
|
|
@ -104,7 +104,6 @@ gst_gl_window_init (GstGLWindow * window)
|
||||||
window->priv = GST_GL_WINDOW_GET_PRIVATE (window);
|
window->priv = GST_GL_WINDOW_GET_PRIVATE (window);
|
||||||
|
|
||||||
g_mutex_init (&window->lock);
|
g_mutex_init (&window->lock);
|
||||||
window->need_lock = TRUE;
|
|
||||||
window->is_drawing = FALSE;
|
window->is_drawing = FALSE;
|
||||||
|
|
||||||
g_weak_ref_init (&window->context_ref, NULL);
|
g_weak_ref_init (&window->context_ref, NULL);
|
||||||
|
@ -209,9 +208,7 @@ gst_gl_window_set_window_handle (GstGLWindow * window, guintptr handle)
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_if_fail (window_class->set_window_handle != NULL);
|
g_return_if_fail (window_class->set_window_handle != NULL);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
|
||||||
window_class->set_window_handle (window, handle);
|
window_class->set_window_handle (window, handle);
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,16 +248,12 @@ gst_gl_window_draw (GstGLWindow * window, guint width, guint height)
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_if_fail (window_class->draw != NULL);
|
g_return_if_fail (window_class->draw != NULL);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
|
||||||
|
|
||||||
/* avoid to overload the drawer */
|
/* avoid to overload the drawer */
|
||||||
if (window->is_drawing) {
|
if (window->is_drawing) {
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window_class->draw (window, width, height);
|
window_class->draw (window, width, height);
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,10 +271,8 @@ gst_gl_window_run (GstGLWindow * window)
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_if_fail (window_class->run != NULL);
|
g_return_if_fail (window_class->run != NULL);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
|
||||||
window->priv->alive = TRUE;
|
window->priv->alive = TRUE;
|
||||||
window_class->run (window);
|
window_class->run (window);
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,8 +299,6 @@ gst_gl_window_quit (GstGLWindow * window)
|
||||||
GST_INFO ("quit sent to gl window loop");
|
GST_INFO ("quit sent to gl window loop");
|
||||||
|
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
GST_GL_WINDOW_UNLOCK (window);
|
||||||
|
|
||||||
GST_INFO ("quit received from gl window");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _GstGLSyncMessage
|
typedef struct _GstGLSyncMessage
|
||||||
|
@ -381,9 +370,7 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_if_fail (window_class->send_message != NULL);
|
g_return_if_fail (window_class->send_message != NULL);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
|
||||||
window_class->send_message (window, callback, data);
|
window_class->send_message (window, callback, data);
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -410,22 +397,6 @@ gst_gl_window_send_message_async (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
window_class->send_message_async (window, callback, data, destroy);
|
window_class->send_message_async (window, callback, data, destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_gl_window_set_need_lock:
|
|
||||||
* @window: a #GstGLWindow
|
|
||||||
* @need_lock: whether the @window needs to lock for concurrent access
|
|
||||||
*
|
|
||||||
* This API is intended only for subclasses of #GstGLWindow in order to ensure
|
|
||||||
* correct interaction with the underlying window system.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_gl_window_set_need_lock (GstGLWindow * window, gboolean need_lock)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GST_GL_IS_WINDOW (window));
|
|
||||||
|
|
||||||
window->need_lock = need_lock;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_gl_window_set_draw_callback:
|
* gst_gl_window_set_draw_callback:
|
||||||
* @window: a #GstGLWindow
|
* @window: a #GstGLWindow
|
||||||
|
@ -528,20 +499,13 @@ gst_gl_window_is_running (GstGLWindow * window)
|
||||||
guintptr
|
guintptr
|
||||||
gst_gl_window_get_display (GstGLWindow * window)
|
gst_gl_window_get_display (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
guintptr ret;
|
|
||||||
GstGLWindowClass *window_class;
|
GstGLWindowClass *window_class;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0);
|
g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0);
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_val_if_fail (window_class->get_display != NULL, 0);
|
g_return_val_if_fail (window_class->get_display != NULL, 0);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
return window_class->get_display (window);
|
||||||
|
|
||||||
ret = window_class->get_display (window);
|
|
||||||
|
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -553,20 +517,13 @@ gst_gl_window_get_display (GstGLWindow * window)
|
||||||
guintptr
|
guintptr
|
||||||
gst_gl_window_get_window_handle (GstGLWindow * window)
|
gst_gl_window_get_window_handle (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
guintptr ret;
|
|
||||||
GstGLWindowClass *window_class;
|
GstGLWindowClass *window_class;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0);
|
g_return_val_if_fail (GST_GL_IS_WINDOW (window), 0);
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
g_return_val_if_fail (window_class->get_window_handle != NULL, 0);
|
g_return_val_if_fail (window_class->get_window_handle != NULL, 0);
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window);
|
return window_class->get_window_handle (window);
|
||||||
|
|
||||||
ret = window_class->get_window_handle (window);
|
|
||||||
|
|
||||||
GST_GL_WINDOW_UNLOCK (window);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,18 +37,8 @@ G_BEGIN_DECLS
|
||||||
#define GST_GL_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW))
|
#define GST_GL_IS_WINDOW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW))
|
||||||
#define GST_GL_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW, GstGLWindowClass))
|
#define GST_GL_WINDOW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW, GstGLWindowClass))
|
||||||
|
|
||||||
#define GST_GL_WINDOW_LOCK(w) \
|
#define GST_GL_WINDOW_LOCK(w) g_mutex_lock(&GST_GL_WINDOW(w)->lock)
|
||||||
do { \
|
#define GST_GL_WINDOW_UNLOCK(w) g_mutex_unlock(&GST_GL_WINDOW(w)->lock)
|
||||||
if (GST_GL_WINDOW(w)->need_lock) \
|
|
||||||
g_mutex_lock (&GST_GL_WINDOW(w)->lock); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define GST_GL_WINDOW_UNLOCK(w) \
|
|
||||||
do { \
|
|
||||||
if (GST_GL_WINDOW(w)->need_lock) \
|
|
||||||
g_mutex_unlock (&GST_GL_WINDOW(w)->lock); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define GST_GL_WINDOW_GET_LOCK(w) (&GST_GL_WINDOW(w)->lock)
|
#define GST_GL_WINDOW_GET_LOCK(w) (&GST_GL_WINDOW(w)->lock)
|
||||||
|
|
||||||
#define GST_GL_WINDOW_ERROR (gst_gl_window_error_quark ())
|
#define GST_GL_WINDOW_ERROR (gst_gl_window_error_quark ())
|
||||||
|
@ -77,7 +67,6 @@ struct _GstGLWindow {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
|
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
gboolean need_lock;
|
|
||||||
|
|
||||||
GWeakRef context_ref;
|
GWeakRef context_ref;
|
||||||
|
|
||||||
|
@ -148,7 +137,6 @@ GstGLWindow * gst_gl_window_new (GstGLDisplay *display);
|
||||||
void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
|
void gst_gl_window_set_draw_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
|
||||||
void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify);
|
void gst_gl_window_set_resize_callback (GstGLWindow *window, GstGLWindowResizeCB callback, gpointer data, GDestroyNotify destroy_notify);
|
||||||
void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
|
void gst_gl_window_set_close_callback (GstGLWindow *window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy_notify);
|
||||||
void gst_gl_window_set_need_lock (GstGLWindow *window, gboolean need_lock);
|
|
||||||
|
|
||||||
void gst_gl_window_set_window_handle (GstGLWindow *window, guintptr handle);
|
void gst_gl_window_set_window_handle (GstGLWindow *window, guintptr handle);
|
||||||
guintptr gst_gl_window_get_window_handle (GstGLWindow *window);
|
guintptr gst_gl_window_get_window_handle (GstGLWindow *window);
|
||||||
|
|
|
@ -298,8 +298,6 @@ gst_gl_window_wayland_egl_new (void)
|
||||||
|
|
||||||
window = g_object_new (GST_GL_TYPE_WINDOW_WAYLAND_EGL, NULL);
|
window = g_object_new (GST_GL_TYPE_WINDOW_WAYLAND_EGL, NULL);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,6 @@ static void
|
||||||
gst_gl_window_win32_init (GstGLWindowWin32 * window)
|
gst_gl_window_win32_init (GstGLWindowWin32 * window)
|
||||||
{
|
{
|
||||||
window->priv = GST_GL_WINDOW_WIN32_GET_PRIVATE (window);
|
window->priv = GST_GL_WINDOW_WIN32_GET_PRIVATE (window);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
|
|
|
@ -175,8 +175,6 @@ gst_gl_window_x11_new (void)
|
||||||
|
|
||||||
window = g_object_new (GST_GL_TYPE_WINDOW_X11, NULL);
|
window = g_object_new (GST_GL_TYPE_WINDOW_X11, NULL);
|
||||||
|
|
||||||
gst_gl_window_set_need_lock (GST_GL_WINDOW (window), FALSE);
|
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +312,7 @@ gst_gl_window_x11_close (GstGLWindow * window)
|
||||||
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
|
GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
|
||||||
GST_GL_WINDOW_LOCK (window_x11);
|
g_mutex_lock (&window_x11->disp_send_lock);
|
||||||
|
|
||||||
if (window_x11->device) {
|
if (window_x11->device) {
|
||||||
if (window_x11->internal_win_id)
|
if (window_x11->internal_win_id)
|
||||||
|
@ -361,7 +359,7 @@ gst_gl_window_x11_close (GstGLWindow * window)
|
||||||
|
|
||||||
window_x11->running = FALSE;
|
window_x11->running = FALSE;
|
||||||
|
|
||||||
GST_GL_WINDOW_UNLOCK (window_x11);
|
g_mutex_unlock (&window_x11->disp_send_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
guintptr
|
guintptr
|
||||||
|
|
Loading…
Reference in a new issue