From b30023f571489e814378be2823db327099ba7177 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 14 May 2014 17:33:21 +1000 Subject: [PATCH] gl/context: add generic feature checking At the moment it simply delegates to the subclass. --- docs/libs/gst-plugins-bad-libs-sections.txt | 1 + gst-libs/gst/gl/gstglcontext.c | 25 +++++++++++++++++++++++++ gst-libs/gst/gl/gstglcontext.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 0b1bf21..50dba86 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -742,6 +742,7 @@ gst_gl_context_get_display 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 GST_GL_IS_CONTEXT diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index ea57601..a2f1909 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -1032,6 +1032,31 @@ gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min) *min = context->priv->gl_minor; } +/** + * gst_gl_context_check_feature: + * @context: a #GstGLContext + * @feature: a platform specific feature + * + * Some features require that the context be created before it is possible to + * determine their existence and so will fail if that is not the case. + * + * Returns: Whether @feature is supported by @context + */ +gboolean +gst_gl_context_check_feature (GstGLContext * context, const gchar * feature) +{ + GstGLContextClass *context_class; + + g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE); + g_return_val_if_fail (feature != NULL, FALSE); + + context_class = GST_GL_CONTEXT_GET_CLASS (context); + if (!context_class->check_feature) + return FALSE; + + return context_class->check_feature (context, feature); +} + static GstGLAPI gst_gl_wrapped_context_get_gl_api (GstGLContext * context) { diff --git a/gst-libs/gst/gl/gstglcontext.h b/gst-libs/gst/gl/gstglcontext.h index edf347f..269a51d 100644 --- a/gst-libs/gst/gl/gstglcontext.h +++ b/gst-libs/gst/gl/gstglcontext.h @@ -103,6 +103,7 @@ struct _GstGLContextClass { GstGLContext *other_context, GError ** error); void (*destroy_context) (GstGLContext *context); void (*swap_buffers) (GstGLContext *context); + gboolean (*check_feature) (GstGLContext *context, const gchar *feature); /*< private >*/ gpointer _reserved[GST_PADDING]; @@ -132,6 +133,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_feature (GstGLContext *context, const gchar *feature); /* FIXME: remove */ void gst_gl_context_thread_add (GstGLContext * context, -- 2.7.4