From 71b8103cbd16fff9cf5a65cf517083cb794aa3b5 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 27 May 2015 10:55:20 +0100 Subject: [PATCH] glcontext: add gst_gl_context_set_display helper --- gst-libs/gst/gl/gstglcontext.c | 19 +++++++++++++++++++ gst-libs/gst/gl/gstglcontext.h | 1 + 2 files changed, 20 insertions(+) diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index 98ed0ed..ab63183 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -1550,6 +1550,25 @@ gst_gl_context_get_display (GstGLContext * context) return gst_object_ref (context->priv->display); } +/** + * gst_gl_context_set_display: + * @context: a #GstGLContext: + * @display: a #GstGLDisplay: + * + * Ref @display and unref previous display if exists. + * + * Since: 1.6 + */ +void +gst_gl_context_set_display (GstGLContext * context, GstGLDisplay * display) +{ + g_return_if_fail (GST_GL_IS_CONTEXT (context)); + g_return_if_fail (GST_IS_GL_DISPLAY (display)); + + gst_object_replace ((GstObject **) & context->priv->display, + (GstObject *) display); +} + typedef struct { GstGLContext *context; diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h index 7b19d6e..3e5fc23 100644 --- a/gst-libs/gst/gl/gstglcontext.h +++ b/gst-libs/gst/gl/gstglcontext.h @@ -124,6 +124,7 @@ gboolean gst_gl_context_activate (GstGLContext *context, gboolean a GThread * gst_gl_context_get_thread (GstGLContext *context); GstGLContext * gst_gl_context_get_current (void); +void gst_gl_context_set_display (GstGLContext *context, GstGLDisplay *display); GstGLDisplay * gst_gl_context_get_display (GstGLContext *context); gpointer gst_gl_context_get_proc_address (GstGLContext *context, const gchar *name); GstGLPlatform gst_gl_context_get_gl_platform (GstGLContext *context); -- 2.7.4