Commit e7bd3328 authored by Matthew Waters's avatar Matthew Waters 🐨

glcontext: add API to retreive the thread that context is active in

parent a1ae26ac
......@@ -804,6 +804,7 @@ gst_gl_context_get_display
gst_gl_context_get_gl_api
gst_gl_context_get_gl_context
gst_gl_context_get_gl_platform
gst_gl_context_get_thread
gst_gl_context_check_feature
gst_gl_context_check_gl_version
gst_gl_context_get_gl_version
......
......@@ -139,6 +139,7 @@ struct _GstGLContextPrivate
GstGLDisplay *display;
GThread *gl_thread;
GThread *active_thread;
/* conditions */
GMutex render_lock;
......@@ -407,11 +408,34 @@ gst_gl_context_activate (GstGLContext * context, gboolean activate)
context_class = GST_GL_CONTEXT_GET_CLASS (context);
g_return_val_if_fail (context_class->activate != NULL, FALSE);
GST_OBJECT_LOCK (context);
result = context_class->activate (context, activate);
context->priv->active_thread = result
&& activate ? context->priv->gl_thread : NULL;
GST_OBJECT_UNLOCK (context);
return result;
}
/**
* gst_gl_context_get_thread:
* @context: a #GstGLContext
*
* Returns: The #GThread, @context is current in or NULL
*/
GThread *
gst_gl_context_get_thread (GstGLContext * context)
{
GThread *ret;
GST_OBJECT_LOCK (context);
ret = context->priv->active_thread;
GST_OBJECT_UNLOCK (context);
return ret;
}
/**
* gst_gl_context_get_gl_api:
* @context: a #GstGLContext
......
......@@ -120,6 +120,7 @@ GstGLContext * gst_gl_context_new_wrapped (GstGLDisplay *display,
GstGLAPI available_apis);
gboolean gst_gl_context_activate (GstGLContext *context, gboolean activate);
GThread * gst_gl_context_get_thread (GstGLContext *context);
GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment