From 32203f94ea5a6d7467bc0bfd533930235356de21 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Tue, 17 Nov 2009 23:47:24 +0100 Subject: [PATCH] [405/906] glfilter: add external-opengl-context property It repairs the cluttershare and sdlshare example --- gst-libs/gst/gl/gstglfilter.c | 23 +++++++++++++++++++++-- gst-libs/gst/gl/gstglfilter.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 489f764353..087e8bee0e 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -44,6 +44,13 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS (GST_GL_VIDEO_CAPS) ); +/* Properties */ +enum +{ + PROP_0, + PROP_EXTERNAL_OPENGL_CONTEXT +}; + #define DEBUG_INIT(bla) \ GST_DEBUG_CATEGORY_INIT (gst_gl_filter_debug, "glfilter", 0, "glfilter element"); @@ -107,6 +114,12 @@ gst_gl_filter_class_init (GstGLFilterClass * klass) GST_BASE_TRANSFORM_CLASS (klass)->prepare_output_buffer = gst_gl_filter_prepare_output_buffer; + g_object_class_install_property (gobject_class, PROP_EXTERNAL_OPENGL_CONTEXT, + g_param_spec_ulong ("external_opengl_context", + "External OpenGL context", + "Give an external OpenGL context with which to share textures", + 0, G_MAXULONG, 0, G_PARAM_WRITABLE)); + klass->set_caps = NULL; klass->filter = NULL; klass->display_init_cb = NULL; @@ -132,9 +145,14 @@ static void gst_gl_filter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - //GstGLFilter *filter = GST_GL_FILTER (object); + GstGLFilter *filter = GST_GL_FILTER (object); switch (prop_id) { + case PROP_EXTERNAL_OPENGL_CONTEXT: + { + filter->external_gl_context = g_value_get_ulong (value); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -209,6 +227,7 @@ gst_gl_filter_reset (GstGLFilter * filter) filter->height = 0; filter->fbo = 0; filter->depthbuffer = 0; + filter->external_gl_context = 0; } static gboolean @@ -233,7 +252,7 @@ gst_gl_filter_start (GstBaseTransform * bt) else { /* this gl filter is a sink in terms of the gl chain */ filter->display = gst_gl_display_new (); - gst_gl_display_create_context (filter->display, 0); + gst_gl_display_create_context (filter->display, filter->external_gl_context); } } diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h index cc6acaf1f4..0d24b52ffa 100644 --- a/gst-libs/gst/gl/gstglfilter.h +++ b/gst-libs/gst/gl/gstglfilter.h @@ -63,6 +63,8 @@ struct _GstGLFilter gint height; GLuint fbo; GLuint depthbuffer; + + gulong external_gl_context; }; struct _GstGLFilterClass