#endif
GST_DEBUG_CATEGORY_STATIC (gst_performance);
+static GPrivate current_context_key;
+
static GModule *module_self;
static GOnce module_self_gonce = G_ONCE_INIT;
GST_OBJECT_LOCK (context);
result = context_class->activate (context, activate);
- context->priv->active_thread = result
- && activate ? context->priv->gl_thread : NULL;
+ if (result && activate) {
+ context->priv->active_thread = g_thread_self ();
+ g_private_set (¤t_context_key, context);
+ } else {
+ context->priv->active_thread = NULL;
+ g_private_set (¤t_context_key, NULL);
+ }
GST_OBJECT_UNLOCK (context);
return result;
return context_class->check_feature (context, feature);
}
+/**
+ * gst_gl_context_get_current:
+ *
+ * See also gst_gl_context_activate().
+ *
+ * Returns: the #GstGLContext active in the current thread or %NULL
+ *
+ * Since: 1.6
+ */
+GstGLContext *
+gst_gl_context_get_current (void)
+{
+ return g_private_get (¤t_context_key);
+}
+
static GstGLAPI
gst_gl_wrapped_context_get_gl_api (GstGLContext * context)
{
gboolean gst_gl_context_activate (GstGLContext *context, gboolean activate);
GThread * gst_gl_context_get_thread (GstGLContext *context);
+GstGLContext * gst_gl_context_get_current (void);
GstGLDisplay * gst_gl_context_get_display (GstGLContext *context);
gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name);