From 2d2878125ef17f140d15a5b44359cd2929901608 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 22 Feb 2016 20:49:52 +1100 Subject: gl: error out if the configured GL API is unsupported by our element https://bugzilla.gnome.org/show_bug.cgi?id=759801 --- ext/gl/gstglbasemixer.c | 20 ++++++++++++++++++++ ext/gl/gstglstereosplit.c | 19 +++++++++++++++++++ ext/gl/gstgltestsrc.c | 16 ++++++++++++++++ 3 files changed, 55 insertions(+) (limited to 'ext') diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c index ef9047941..d20788377 100644 --- a/ext/gl/gstglbasemixer.c +++ b/ext/gl/gstglbasemixer.c @@ -489,11 +489,31 @@ gst_gl_base_mixer_decide_allocation (GstGLBaseMixer * mix, GstQuery * query) GST_OBJECT_UNLOCK (mix->display); } + { + GstGLAPI current_gl_api = gst_gl_context_get_gl_api (mix->context); + if ((current_gl_api & mix_class->supported_gl_api) == 0) + goto unsupported_gl_api; + } + if (mix_class->decide_allocation) ret = mix_class->decide_allocation (mix, query); return ret; +unsupported_gl_api: + { + GstGLAPI gl_api = gst_gl_context_get_gl_api (mix->context); + gchar *gl_api_str = gst_gl_api_to_string (gl_api); + gchar *supported_gl_api_str = + gst_gl_api_to_string (mix_class->supported_gl_api); + GST_ELEMENT_ERROR (mix, RESOURCE, BUSY, + ("GL API's not compatible context: %s supported: %s", gl_api_str, + supported_gl_api_str), (NULL)); + + g_free (supported_gl_api_str); + g_free (gl_api_str); + return FALSE; + } context_error: { GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s", error->message), diff --git a/ext/gl/gstglstereosplit.c b/ext/gl/gstglstereosplit.c index 456d9f032..578622006 100644 --- a/ext/gl/gstglstereosplit.c +++ b/ext/gl/gstglstereosplit.c @@ -584,8 +584,27 @@ ensure_context (GstGLStereoSplit * self) GST_OBJECT_UNLOCK (self->display); } + { + GstGLAPI current_gl_api = gst_gl_context_get_gl_api (self->context); + if ((current_gl_api & SUPPORTED_GL_APIS) == 0) + goto unsupported_gl_api; + } + return TRUE; +unsupported_gl_api: + { + GstGLAPI gl_api = gst_gl_context_get_gl_api (self->context); + gchar *gl_api_str = gst_gl_api_to_string (gl_api); + gchar *supported_gl_api_str = gst_gl_api_to_string (SUPPORTED_GL_APIS); + GST_ELEMENT_ERROR (mix, RESOURCE, BUSY, + ("GL API's not compatible context: %s supported: %s", gl_api_str, + supported_gl_api_str), (NULL)); + + g_free (supported_gl_api_str); + g_free (gl_api_str); + return FALSE; + } context_error: { GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND, ("%s", error->message), diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c index bcf8fb962..95c73213d 100644 --- a/ext/gl/gstgltestsrc.c +++ b/ext/gl/gstgltestsrc.c @@ -804,6 +804,9 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) GST_OBJECT_UNLOCK (src->display); } + if ((gst_gl_context_get_gl_api (src->context) & SUPPORTED_GL_APIS) == 0) + goto unsupported_gl_api; + out_width = GST_VIDEO_INFO_WIDTH (&src->out_info); out_height = GST_VIDEO_INFO_HEIGHT (&src->out_info); @@ -856,6 +859,19 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) return TRUE; +unsupported_gl_api: + { + GstGLAPI gl_api = gst_gl_context_get_gl_api (src->context); + gchar *gl_api_str = gst_gl_api_to_string (gl_api); + gchar *supported_gl_api_str = gst_gl_api_to_string (SUPPORTED_GL_APIS); + GST_ELEMENT_ERROR (src, RESOURCE, BUSY, + ("GL API's not compatible context: %s supported: %s", gl_api_str, + supported_gl_api_str), (NULL)); + + g_free (supported_gl_api_str); + g_free (gl_api_str); + return FALSE; + } context_error: { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, ("%s", error->message), -- cgit v1.2.1