diff --git a/ext/gl/gstglbasemixer.c b/ext/gl/gstglbasemixer.c index ef90479412..d207883776 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 456d9f032a..5786220063 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 bcf8fb962e..95c73213dd 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), diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c index a4e97b9295..2fcea266bb 100644 --- a/gst-libs/gst/gl/gstglbasefilter.c +++ b/gst-libs/gst/gl/gstglbasefilter.c @@ -50,7 +50,8 @@ enum #define gst_gl_base_filter_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLBaseFilter, gst_gl_base_filter, GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_gl_base_filter_debug, - "glbasefilter", 0, "glbasefilter element");); + "glbasefilter", 0, "glbasefilter element"); + ); static void gst_gl_base_filter_finalize (GObject * object); static void gst_gl_base_filter_set_property (GObject * object, guint prop_id, @@ -357,6 +358,7 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query) { GstGLBaseFilter *filter = GST_GL_BASE_FILTER (trans); + GstGLBaseFilterClass *filter_class = GST_GL_BASE_FILTER_GET_CLASS (filter); GError *error = NULL; gboolean new_context = FALSE; @@ -389,6 +391,12 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_stop, filter); + { + GstGLAPI current_gl_api = gst_gl_context_get_gl_api (mix->context); + if ((current_gl_api & filter_class->supported_gl_api) == 0) + goto unsupported_gl_api; + } + gst_gl_context_thread_add (filter->context, gst_gl_base_filter_gl_start, filter); @@ -404,6 +412,21 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, query); + +unsupported_gl_api: + { + GstGLAPI gl_api = gst_gl_context_get_gl_api (filter->context); + gchar *gl_api_str = gst_gl_api_to_string (gl_api); + gchar *supported_gl_api_str = + gst_gl_api_to_string (filter_class->supported_gl_api); + GST_ELEMENT_ERROR (filter, 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 (trans, RESOURCE, NOT_FOUND, ("%s", error->message),