mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
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
This commit is contained in:
parent
d42145e8c1
commit
f2e9190229
4 changed files with 69 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue