diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 75cc02336f..c70c8486a1 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -763,6 +763,7 @@ gst_gl_context_get_gl_api gst_gl_context_get_gl_context gst_gl_context_get_platform gst_gl_context_check_feature +gst_gl_context_check_gl_version GST_GL_CONTEXT GST_GL_IS_CONTEXT diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index b53e21087e..c244de21ab 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -1041,6 +1041,37 @@ gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min) *min = context->priv->gl_minor; } +/** + * gst_gl_context_check_gl_version: + * @context: a #GstGLContext + * @api: api type required + * @maj: major version required + * @min: minor version required + * + * Returns: whether OpenGL context implements the required api and specified + * version. + */ +gboolean +gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, + gint maj, gint min) +{ + g_return_if_fail (GST_GL_IS_CONTEXT (context)); + + if (maj > context->priv->gl_major) + return FALSE; + + if ((gst_gl_context_get_gl_api (context) & api) == GST_GL_API_NONE) + return FALSE; + + if (maj < context->priv->gl_major) + return TRUE; + + if (min > context->priv->gl_minor) + return FALSE; + + return TRUE; +} + /** * gst_gl_context_check_feature: * @context: a #GstGLContext diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h index e6e6549148..999b86af93 100644 --- a/gst-libs/gst/gl/gstglcontext.h +++ b/gst-libs/gst/gl/gstglcontext.h @@ -135,6 +135,7 @@ gboolean gst_gl_context_set_window (GstGLContext *context, GstGLWindow *win GstGLWindow * gst_gl_context_get_window (GstGLContext *context); void gst_gl_context_get_gl_version (GstGLContext *context, gint *maj, gint *min); +gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min); gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature); /* FIXME: remove */