[vlc-devel] [RFC PATCH 5/8] vlc_opengl: add vlc_gl_GetEglContexts
Thomas Guillem
thomas at gllm.fr
Fri Feb 10 11:35:59 CET 2017
This function will return the current EGLDisplay and EGLContext (if egl is
used).
---
include/vlc_opengl.h | 7 +++++++
modules/video_output/opengl/egl.c | 11 +++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index 4e79753b61..abef71ed96 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -51,6 +51,7 @@ struct vlc_gl_t
void (*swap)(vlc_gl_t *);
void*(*getProcAddress)(vlc_gl_t *, const char *);
int (*getNativeDpy)(vlc_gl_t *, void **nativedpy);
+ int (*getEglContexts)(vlc_gl_t *, void **egldpy, void **eglctx);
};
enum {
@@ -92,6 +93,12 @@ static inline int vlc_gl_GetNativeDpy(vlc_gl_t *gl, void **nativedpy)
return gl->getNativeDpy ? gl->getNativeDpy(gl, nativedpy) : -1;
}
+static inline int vlc_gl_GetEglContexts(vlc_gl_t *gl, void **egldpy,
+ void **eglctx)
+{
+ return gl->getEglContexts ? gl->getEglContexts(gl, egldpy, eglctx) : -1;
+}
+
VLC_API vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *,
const struct vout_window_cfg_t *,
struct vout_window_t **) VLC_USED;
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index cc9c76d389..66cc210d36 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -117,6 +117,16 @@ static int GetNativeDpy(vlc_gl_t *gl, void **nativedpy)
return *nativedpy != NULL ? 0 : -1;
}
+static int GetEglContexts(vlc_gl_t *gl, void **egldpy, void **eglctx)
+{
+ vlc_gl_sys_t *sys = gl->sys;
+
+ assert(sys->display && sys->context);
+ *egldpy = sys->display;
+ *eglctx = sys->context;
+ return 0;
+}
+
static bool CheckToken(const char *haystack, const char *needle)
{
size_t len = strlen(needle);
@@ -386,6 +396,7 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
gl->swap = SwapBuffers;
gl->getProcAddress = GetSymbol;
gl->getNativeDpy = GetNativeDpy;
+ gl->getEglContexts = GetEglContexts;
return VLC_SUCCESS;
error:
--
2.11.0
More information about the vlc-devel
mailing list