diff options
author | Matthew Waters <ystreet00@gmail.com> | 2014-05-14 17:33:21 +1000 |
---|---|---|
committer | Matthew Waters <ystreet00@gmail.com> | 2014-05-20 22:26:55 +1000 |
commit | b30023f571489e814378be2823db327099ba7177 (patch) | |
tree | 13b577cabf0496641c9b99800a2e19330e2a2278 | |
parent | d80630f011b9a241c55f56b7a7ab88f83832c3c6 (diff) | |
download | gstreamer-plugins-bad-b30023f571489e814378be2823db327099ba7177.tar.gz |
gl/context: add generic feature checking
At the moment it simply delegates to the subclass.
-rw-r--r-- | docs/libs/gst-plugins-bad-libs-sections.txt | 1 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglcontext.c | 25 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglcontext.h | 2 |
3 files changed, 28 insertions, 0 deletions
diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index 0b1bf2174..50dba86ed 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 <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 ea576017d..a2f190952 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 edf347ffe..269a51de3 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, |