summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/libs/gst-plugins-bad-libs-sections.txt1
-rw-r--r--gst-libs/gst/gl/gstglcontext.c31
-rw-r--r--gst-libs/gst/gl/gstglcontext.h1
3 files changed, 33 insertions, 0 deletions
diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt
index 75cc02336..c70c8486a 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
<SUBSECTION Standard>
GST_GL_CONTEXT
GST_GL_IS_CONTEXT
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index b53e21087..c244de21a 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -1042,6 +1042,37 @@ gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min)
}
/**
+ * 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
* @feature: a platform specific feature
diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h
index e6e654914..999b86af9 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 */