gl: error out if the configured GL API is unsupported by our element

https://bugzilla.gnome.org/show_bug.cgi?id=759801
This commit is contained in:
Matthew Waters 2016-02-22 20:49:52 +11:00
parent 0d80be0ce0
commit 2d2878125e
4 changed files with 79 additions and 1 deletions

View file

@ -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),

View file

@ -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),

View file

@ -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),

View file

@ -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),