summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2016-11-17 01:45:38 +1100
committerMatthew Waters <matthew@centricular.com>2016-11-17 14:06:21 +1100
commitf2e9190229094cd5b329dfb12aa8cd6468c19cbc (patch)
treebc6886658ab3655c6fd01642ecd85c8773298184 /gst-libs
parentd42145e8c1ba3bc0445506b92bb7ac04ae98f4dd (diff)
downloadgstreamer-plugins-bad-f2e9190229094cd5b329dfb12aa8cd6468c19cbc.tar.gz
glcontext: add vfunc to retrieve the OpenGL platform version
i.e. the version of EGL, GLX, etc implemented. https://bugzilla.gnome.org/show_bug.cgi?id=774518
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/gl/egl/gstglcontext_egl.c14
-rw-r--r--gst-libs/gst/gl/gstglcontext.c38
-rw-r--r--gst-libs/gst/gl/gstglcontext.h3
-rw-r--r--gst-libs/gst/gl/x11/gstglcontext_glx.c14
4 files changed, 69 insertions, 0 deletions
diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
index 3ed7320bd..78c14a367 100644
--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
+++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
@@ -64,6 +64,8 @@ static GstGLPlatform gst_gl_context_egl_get_gl_platform (GstGLContext *
context);
static gboolean gst_gl_context_egl_check_feature (GstGLContext * context,
const gchar * feature);
+static void gst_gl_context_egl_get_gl_platform_version (GstGLContext * context,
+ gint * major, gint * minor);
G_DEFINE_TYPE (GstGLContextEGL, gst_gl_context_egl, GST_TYPE_GL_CONTEXT);
@@ -93,6 +95,8 @@ gst_gl_context_egl_class_init (GstGLContextEGLClass * klass)
GST_DEBUG_FUNCPTR (gst_gl_context_egl_check_feature);
context_class->get_current_context =
GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_current_context);
+ context_class->get_gl_platform_version =
+ GST_DEBUG_FUNCPTR (gst_gl_context_egl_get_gl_platform_version);
}
static void
@@ -801,3 +805,13 @@ gst_gl_context_egl_get_current_context (void)
{
return (guintptr) eglGetCurrentContext ();
}
+
+static void
+gst_gl_context_egl_get_gl_platform_version (GstGLContext * context,
+ gint * major, gint * minor)
+{
+ GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
+
+ *major = context_egl->egl_major;
+ *minor = context_egl->egl_minor;
+}
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index 1024b3936..3f4332556 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -193,6 +193,8 @@ static void _init_debug (void);
static gpointer gst_gl_context_create_thread (GstGLContext * context);
static void gst_gl_context_finalize (GObject * object);
+static void gst_gl_context_default_get_gl_platform_version (GstGLContext *
+ context, gint * major, gint * minor);
struct _GstGLContextPrivate
{
@@ -285,6 +287,8 @@ gst_gl_context_class_init (GstGLContextClass * klass)
klass->get_proc_address =
GST_DEBUG_FUNCPTR (gst_gl_context_default_get_proc_address);
+ klass->get_gl_platform_version =
+ GST_DEBUG_FUNCPTR (gst_gl_context_default_get_gl_platform_version);
G_OBJECT_CLASS (klass)->finalize = gst_gl_context_finalize;
@@ -1696,6 +1700,40 @@ gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share)
_context_share_group_ref (share->priv->sharegroup);
}
+static void
+gst_gl_context_default_get_gl_platform_version (GstGLContext * context,
+ gint * major, gint * minor)
+{
+ if (major)
+ *major = 0;
+ if (minor)
+ *minor = 0;
+}
+
+/**
+ * gst_gl_context_get_gl_platform_version:
+ * @context: a #GstGLContext
+ * @major: (out): return for the major version
+ * @minor: (out): return for the minor version
+ *
+ * Get the version of the OpenGL platform (GLX, EGL, etc) used. Only valid
+ * after a call to gst_gl_context_create_context().
+ */
+void
+gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major,
+ gint * minor)
+{
+ GstGLContextClass *context_class;
+
+ g_return_if_fail (GST_IS_GL_CONTEXT (context));
+ g_return_if_fail (major != NULL);
+ g_return_if_fail (minor != NULL);
+ context_class = GST_GL_CONTEXT_GET_CLASS (context);
+ g_return_if_fail (context_class->get_gl_platform_version != NULL);
+
+ context_class->get_gl_platform_version (context, major, minor);
+}
+
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 89211b9f1..9aa3d1401 100644
--- a/gst-libs/gst/gl/gstglcontext.h
+++ b/gst-libs/gst/gl/gstglcontext.h
@@ -128,6 +128,7 @@ struct _GstGLContextClass {
void (*destroy_context) (GstGLContext *context);
void (*swap_buffers) (GstGLContext *context);
gboolean (*check_feature) (GstGLContext *context, const gchar *feature);
+ void (*get_gl_platform_version) (GstGLContext *context, gint *major, gint *minor);
/*< private >*/
gpointer _reserved[GST_PADDING];
@@ -184,6 +185,8 @@ GST_EXPORT
gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min);
GST_EXPORT
gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
+GST_EXPORT
+void gst_gl_context_get_gl_platform_version (GstGLContext * context, gint * major, gint * minor);
GST_EXPORT
guintptr gst_gl_context_get_current_gl_context (GstGLPlatform context_type);
diff --git a/gst-libs/gst/gl/x11/gstglcontext_glx.c b/gst-libs/gst/gl/x11/gstglcontext_glx.c
index 1f1849544..b1890ae98 100644
--- a/gst-libs/gst/gl/x11/gstglcontext_glx.c
+++ b/gst-libs/gst/gl/x11/gstglcontext_glx.c
@@ -58,6 +58,8 @@ static gboolean gst_gl_context_glx_choose_format (GstGLContext *
GstGLAPI gst_gl_context_glx_get_gl_api (GstGLContext * context);
static GstGLPlatform gst_gl_context_glx_get_gl_platform (GstGLContext *
context);
+static void gst_gl_context_glx_get_gl_platform_version (GstGLContext * context,
+ gint * major, gint * minor);
struct _GstGLContextGLXPrivate
{
@@ -97,6 +99,8 @@ gst_gl_context_glx_class_init (GstGLContextGLXClass * klass)
GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_proc_address);
context_class->get_current_context =
GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_current_context);
+ context_class->get_gl_platform_version =
+ GST_DEBUG_FUNCPTR (gst_gl_context_glx_get_gl_platform_version);
}
static void
@@ -472,3 +476,13 @@ gst_gl_context_glx_get_current_context (void)
{
return (guintptr) glXGetCurrentContext ();
}
+
+static void
+gst_gl_context_glx_get_gl_platform_version (GstGLContext * context,
+ gint * major, gint * minor)
+{
+ GstGLContextGLX *context_glx = GST_GL_CONTEXT_GLX (context);
+
+ *major = context_glx->priv->glx_major;
+ *minor = context_glx->priv->glx_minor;
+}