mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
glcontext: add API to retreive the thread that context is active in
This commit is contained in:
parent
a1ae26acbd
commit
e7bd332887
3 changed files with 26 additions and 0 deletions
|
@ -804,6 +804,7 @@ gst_gl_context_get_display
|
||||||
gst_gl_context_get_gl_api
|
gst_gl_context_get_gl_api
|
||||||
gst_gl_context_get_gl_context
|
gst_gl_context_get_gl_context
|
||||||
gst_gl_context_get_gl_platform
|
gst_gl_context_get_gl_platform
|
||||||
|
gst_gl_context_get_thread
|
||||||
gst_gl_context_check_feature
|
gst_gl_context_check_feature
|
||||||
gst_gl_context_check_gl_version
|
gst_gl_context_check_gl_version
|
||||||
gst_gl_context_get_gl_version
|
gst_gl_context_get_gl_version
|
||||||
|
|
|
@ -139,6 +139,7 @@ struct _GstGLContextPrivate
|
||||||
GstGLDisplay *display;
|
GstGLDisplay *display;
|
||||||
|
|
||||||
GThread *gl_thread;
|
GThread *gl_thread;
|
||||||
|
GThread *active_thread;
|
||||||
|
|
||||||
/* conditions */
|
/* conditions */
|
||||||
GMutex render_lock;
|
GMutex render_lock;
|
||||||
|
@ -407,11 +408,34 @@ gst_gl_context_activate (GstGLContext * context, gboolean activate)
|
||||||
context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||||
g_return_val_if_fail (context_class->activate != NULL, FALSE);
|
g_return_val_if_fail (context_class->activate != NULL, FALSE);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (context);
|
||||||
result = context_class->activate (context, activate);
|
result = context_class->activate (context, activate);
|
||||||
|
|
||||||
|
context->priv->active_thread = result
|
||||||
|
&& activate ? context->priv->gl_thread : NULL;
|
||||||
|
GST_OBJECT_UNLOCK (context);
|
||||||
|
|
||||||
return result;
|
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:
|
* gst_gl_context_get_gl_api:
|
||||||
* @context: a #GstGLContext
|
* @context: a #GstGLContext
|
||||||
|
|
|
@ -120,6 +120,7 @@ GstGLContext * gst_gl_context_new_wrapped (GstGLDisplay *display,
|
||||||
GstGLAPI available_apis);
|
GstGLAPI available_apis);
|
||||||
|
|
||||||
gboolean gst_gl_context_activate (GstGLContext *context, gboolean activate);
|
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);
|
GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
|
||||||
gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
|
gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);
|
||||||
|
|
Loading…
Reference in a new issue