gl/context: add generic feature checking

At the moment it simply delegates to the subclass.
This commit is contained in:
Matthew Waters 2014-05-14 17:33:21 +10:00
parent d80630f011
commit b30023f571
3 changed files with 28 additions and 0 deletions

View file

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

View file

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

View file

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