glcontext: add more functionality to wrapped contexts

Implements get_current_context() and get_proc_address() for wrapped
contexts.
This commit is contained in:
Matthew Waters 2014-10-30 16:48:00 +11:00 committed by Tim-Philipp Müller
parent 366eaea6d2
commit 7d97a35139
7 changed files with 46 additions and 15 deletions

View file

@ -51,8 +51,6 @@ static guintptr gst_gl_context_egl_get_gl_context (GstGLContext * context);
static GstGLAPI gst_gl_context_egl_get_gl_api (GstGLContext * context);
static GstGLPlatform gst_gl_context_egl_get_gl_platform (GstGLContext *
context);
static gpointer gst_gl_context_egl_get_proc_address (GstGLContext * context,
const gchar * name);
static gboolean gst_gl_context_egl_check_feature (GstGLContext * context,
const gchar * feature);
@ -547,7 +545,7 @@ load_egl_module (gpointer user_data)
return NULL;
}
static gpointer
gpointer
gst_gl_context_egl_get_proc_address (GstGLContext * context, const gchar * name)
{
gpointer result = NULL;

View file

@ -56,8 +56,9 @@ struct _GstGLContextEGLClass {
};
GType gst_gl_context_egl_get_type (void);
GstGLContextEGL * gst_gl_context_egl_new (void);
guintptr gst_gl_context_egl_get_current_context (void);
GstGLContextEGL * gst_gl_context_egl_new (void);
guintptr gst_gl_context_egl_get_current_context (void);
gpointer gst_gl_context_egl_get_proc_address (GstGLContext * context, const gchar * name);
/* TODO:
* add support for EGL_NO_CONTEXT

View file

@ -325,6 +325,7 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
{
GstGLContext *context;
GstGLWrappedContext *context_wrap = NULL;
GstGLContextClass *context_class;
_init_debug ();
@ -344,6 +345,39 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
context_wrap->platform = context_type;
context_wrap->available_apis = available_apis;
context_class = GST_GL_CONTEXT_GET_CLASS (context);
#if GST_GL_HAVE_PLATFORM_GLX
if (context_type == GST_GL_PLATFORM_GLX) {
context_class->get_current_context = gst_gl_context_glx_get_current_context;
context_class->get_proc_address = gst_gl_context_glx_get_proc_address;
}
#endif
#if GST_GL_HAVE_PLATFORM_EGL
if (context_type == GST_GL_PLATFORM_EGL) {
context_class->get_current_context = gst_gl_context_egl_get_current_context;
context_class->get_proc_address = gst_gl_context_egl_get_proc_address;
}
#endif
#if GST_GL_HAVE_PLATFORM_CGL
if (context_type == GST_GL_PLATFORM_CGL) {
context_class->get_current_context =
gst_gl_context_cocoa_get_current_context;
}
#endif
#if GST_GL_HAVE_PLATFORM_WGL
if (context_type == GST_GL_PLATFORM_WGL) {
context_class->get_current_context = gst_gl_context_wgl_get_current_context;
context_class->get_proc_address = gst_gl_context_wgl_get_proc_address;
}
#endif
#if GST_GL_HAVE_PLATFORM_EAGL
if (context_type == GST_GL_PLATFORM_EAGL) {
context_class->get_current_context =
gst_gl_context_eagl_get_current_context;
}
#endif
return context;
}

View file

@ -46,8 +46,6 @@ static void gst_gl_context_wgl_destroy_context (GstGLContext * context);
GstGLAPI gst_gl_context_wgl_get_gl_api (GstGLContext * context);
static GstGLPlatform gst_gl_context_wgl_get_gl_platform (GstGLContext *
context);
static gpointer gst_gl_context_wgl_get_proc_address (GstGLContext * context,
const gchar * name);
static void
gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass)
@ -285,7 +283,7 @@ gst_gl_context_wgl_get_gl_platform (GstGLContext * context)
return GST_GL_PLATFORM_WGL;
}
static gpointer
gpointer
gst_gl_context_wgl_get_proc_address (GstGLContext * context, const gchar * name)
{
gpointer result;

View file

@ -55,8 +55,9 @@ struct _GstGLContextWGLClass {
GType gst_gl_context_wgl_get_type (void);
GstGLContextWGL * gst_gl_context_wgl_new (void);
guintptr gst_gl_context_wgl_get_current_context (void);
GstGLContextWGL * gst_gl_context_wgl_new (void);
guintptr gst_gl_context_wgl_get_current_context (void);
gpointer gst_gl_context_wgl_get_proc_address (GstGLContext * context, const gchar * name);
G_END_DECLS

View file

@ -57,8 +57,6 @@ 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 gpointer gst_gl_context_glx_get_proc_address (GstGLContext * context,
const gchar * name);
struct _GstGLContextGLXPrivate
{
@ -421,7 +419,7 @@ gst_gl_context_glx_get_gl_platform (GstGLContext * context)
return GST_GL_PLATFORM_GLX;
}
static gpointer
gpointer
gst_gl_context_glx_get_proc_address (GstGLContext * context, const gchar * name)
{
gpointer result;

View file

@ -59,8 +59,9 @@ struct _GstGLContextGLXClass {
GType gst_gl_context_glx_get_type (void);
GstGLContextGLX * gst_gl_context_glx_new (void);
guintptr gst_gl_context_glx_get_current_context (void);
GstGLContextGLX * gst_gl_context_glx_new (void);
guintptr gst_gl_context_glx_get_current_context (void);
gpointer gst_gl_context_glx_get_proc_address (GstGLContext * context, const gchar * name);
G_END_DECLS