diff options
Diffstat (limited to 'gst/gl/gstgltestsrc.c')
-rw-r--r-- | gst/gl/gstgltestsrc.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gst/gl/gstgltestsrc.c b/gst/gl/gstgltestsrc.c index 1d9d343..b788dcd 100644 --- a/gst/gl/gstgltestsrc.c +++ b/gst/gl/gstgltestsrc.c @@ -597,6 +597,7 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) GError *error = NULL; guint idx; guint out_width, out_height; + GstGLContext *other_context = NULL; gst_query_parse_allocation (query, &caps, NULL); @@ -621,6 +622,9 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx)) { GstGLContext *context; const GstStructure *upload_meta_params; + gpointer handle; + gchar *type; + gchar *apis; gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params); if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", @@ -630,12 +634,31 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) src->context = context; if (old) gst_object_unref (old); + } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", + G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, + &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) + && handle) { + GstGLPlatform platform = GST_GL_PLATFORM_NONE; + GstGLAPI gl_apis; + + GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", handle, + type, apis); + + if (g_strcmp0 (type, "glx") == 0) + platform = GST_GL_PLATFORM_GLX; + + gl_apis = gst_gl_api_from_string (apis); + + if (gl_apis && platform) + other_context = + gst_gl_context_new_wrapped (src->display, (guintptr) handle, + platform, gl_apis); } } if (!src->context) { src->context = gst_gl_context_new (src->display); - if (!gst_gl_context_create (src->context, NULL, &error)) + if (!gst_gl_context_create (src->context, other_context, &error)) goto context_error; } |