diff options
author | Julien Isorce <julien.isorce@gmail.com> | 2009-11-17 23:47:24 +0100 |
---|---|---|
committer | Matthew Waters <ystreet00@gmail.com> | 2014-03-15 18:36:38 +0100 |
commit | a6a5ee2839c4d004dba37ff08b9f8161a54d89b2 (patch) | |
tree | 5a08b14ffc6410d5c91407c2146acd22691fea62 | |
parent | dec44e571b673287f1a97c91b5ddd3ea052ab2ed (diff) | |
download | gstreamer-plugins-bad-a6a5ee2839c4d004dba37ff08b9f8161a54d89b2.tar.gz |
[405/906] glfilter: add external-opengl-context property
It repairs the cluttershare and sdlshare example
-rw-r--r-- | gst-libs/gst/gl/gstglfilter.c | 23 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglfilter.h | 2 | ||||
-rw-r--r-- | tests/examples/clutter/cluttershare.c | 10 | ||||
-rw-r--r-- | tests/examples/sdl/sdlshare.c | 8 |
4 files changed, 32 insertions, 11 deletions
diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 489f76435..087e8bee0 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 cc6acaf1f..0d24b52ff 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 diff --git a/tests/examples/clutter/cluttershare.c b/tests/examples/clutter/cluttershare.c index e17b06737..7c73542de 100644 --- a/tests/examples/clutter/cluttershare.c +++ b/tests/examples/clutter/cluttershare.c @@ -224,7 +224,7 @@ main (int argc, char *argv[]) #endif GstPipeline *pipeline = NULL; GstBus *bus = NULL; - GstElement *glupload = NULL; + GstElement *glfilter = NULL; GstState state = 0; ClutterActor *stage = NULL; ClutterActor *clutter_texture = NULL; @@ -287,10 +287,10 @@ main (int argc, char *argv[]) /* clutter_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */ - glupload = gst_bin_get_by_name (GST_BIN (pipeline), "glupload0"); - g_object_set (G_OBJECT (glupload), "external-opengl-context", + glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "glfilter0"); + g_object_set (G_OBJECT (glfilter), "external-opengl-context", clutter_gl_context, NULL); - g_object_unref (glupload); + g_object_unref (glfilter); /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and * shared with the clutter one */ @@ -359,7 +359,7 @@ main (int argc, char *argv[]) gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); g_object_unref (pipeline); - /* make sure there is no pending gst gl buffer in the communication queues + /* make sure there is no pending gst gl buffer in the communication queues * between clutter and gst-gl */ diff --git a/tests/examples/sdl/sdlshare.c b/tests/examples/sdl/sdlshare.c index 7e85dea72..8f3064f2e 100644 --- a/tests/examples/sdl/sdlshare.c +++ b/tests/examples/sdl/sdlshare.c @@ -248,7 +248,7 @@ main (int argc, char **argv) GMainLoop *loop = NULL; GstPipeline *pipeline = NULL; GstBus *bus = NULL; - GstElement *glupload = NULL; + GstElement *glfilter = NULL; GstElement *fakesink = NULL; GstState state; GAsyncQueue *queue_input_buf = NULL; @@ -304,10 +304,10 @@ main (int argc, char **argv) gst_object_unref (bus); /* sdl_gl_context is an external OpenGL context with which gst-plugins-gl want to share textures */ - glupload = gst_bin_get_by_name (GST_BIN (pipeline), "glupload0"); - g_object_set (G_OBJECT (glupload), "external-opengl-context", + glfilter = gst_bin_get_by_name (GST_BIN (pipeline), "gleffects0"); + g_object_set (G_OBJECT (glfilter), "external-opengl-context", sdl_gl_context, NULL); - g_object_unref (glupload); + g_object_unref (glfilter); /* NULL to PAUSED state pipeline to make sure the gst opengl context is created and * shared with the sdl one */ |