summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-05-04 13:42:36 (GMT)
committerMatthew Waters <matthew@centricular.com>2015-05-04 13:44:17 (GMT)
commit8ef4b12ab8fc95f8a39603be9eeb58ca5c23d6ec (patch)
tree17c91935615f2fbbbd877e964de2c184c7074a4b
parent3c77fbda8774de0e9ac9a3839f8b6bcd656f3887 (diff)
downloadgst-plugins-bad-8ef4b12ab8fc95f8a39603be9eeb58ca5c23d6ec.tar.gz
gst-plugins-bad-8ef4b12ab8fc95f8a39603be9eeb58ca5c23d6ec.tar.xz
glimagesink: handle the local_context query
so that upstream elements can get the GL context from glimagesink
-rw-r--r--ext/gl/gstglimagesink.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index a7de89f..674e30d 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -597,12 +597,40 @@ gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query)
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:
{
- gboolean ret =
- gst_gl_handle_context_query ((GstElement *) glimage_sink, query,
+ const gchar *context_type;
+ GstContext *context, *old_context;
+
+ res = gst_gl_handle_context_query ((GstElement *) glimage_sink, query,
&glimage_sink->display, &glimage_sink->other_context);
if (glimage_sink->display)
gst_gl_display_filter_gl_api (glimage_sink->display, SUPPORTED_GL_APIS);
- return ret;
+
+ gst_query_parse_context_type (query, &context_type);
+
+ if (g_strcmp0 (context_type, "gst.gl.local_context") == 0) {
+ GstStructure *s;
+
+ gst_query_parse_context (query, &old_context);
+
+ if (old_context)
+ context = gst_context_copy (old_context);
+ else
+ context = gst_context_new ("gst.gl.local_context", FALSE);
+
+ s = gst_context_writable_structure (context);
+ gst_structure_set (s, "context", GST_GL_TYPE_CONTEXT,
+ glimage_sink->context, NULL);
+ gst_query_set_context (query, context);
+ gst_context_unref (context);
+
+ res = glimage_sink->context != NULL;
+ }
+ GST_LOG_OBJECT (glimage_sink, "context query of type %s %i", context_type,
+ res);
+
+ if (res)
+ return res;
+ break;
}
case GST_QUERY_DRAIN:
{