vlc | branch: master | Thomas Guillem <[email protected]> | Wed Jun 21 16:04:26 2017 +0200| [c8cc23765f6d9e42b213a0803d0bc24fd094ff30] | committer: Thomas Guillem
egl: add EGLImageKHR functions > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c8cc23765f6d9e42b213a0803d0bc24fd094ff30 --- include/vlc_opengl.h | 19 +++++++++++++++++++ modules/video_output/opengl/egl.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h index 6642f78554..41b622ee15 100644 --- a/include/vlc_opengl.h +++ b/include/vlc_opengl.h @@ -50,6 +50,25 @@ struct vlc_gl_t void (*resize)(vlc_gl_t *, unsigned, unsigned); void (*swap)(vlc_gl_t *); void*(*getProcAddress)(vlc_gl_t *, const char *); + + enum { + VLC_GL_EXT_DEFAULT, + VLC_GL_EXT_EGL, + } ext; + + union { + /* if ext == VLC_GL_EXT_EGL */ + struct { + /* call eglQueryString() with current display */ + const char *(*queryString)(vlc_gl_t *, int32_t name); + /* call eglCreateImageKHR() with current display and context, can + * be NULL */ + void *(*createImageKHR)(vlc_gl_t *, unsigned target, void *buffer, + const int32_t *attrib_list); + /* call eglDestroyImageKHR() with current display, can be NULL */ + bool (*destroyImageKHR)(vlc_gl_t *, void *image); + } egl; + }; }; enum { diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c index 22cf3545c9..9162675447 100644 --- a/modules/video_output/opengl/egl.c +++ b/modules/video_output/opengl/egl.c @@ -55,6 +55,8 @@ typedef struct vlc_gl_sys_t struct wl_egl_window *window; unsigned width, height; #endif + PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; + PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; } vlc_gl_sys_t; static int MakeCurrent (vlc_gl_t *gl) @@ -103,6 +105,29 @@ static void *GetSymbol(vlc_gl_t *gl, const char *procname) return (void *)eglGetProcAddress (procname); } +static const char *QueryString(vlc_gl_t *gl, int32_t name) +{ + vlc_gl_sys_t *sys = gl->sys; + + return eglQueryString(sys->display, name); +} + +static void *CreateImageKHR(vlc_gl_t *gl, unsigned target, void *buffer, + const int32_t *attrib_list) +{ + vlc_gl_sys_t *sys = gl->sys; + + return sys->eglCreateImageKHR(sys->display, NULL, target, buffer, + attrib_list); +} + +static bool DestroyImageKHR(vlc_gl_t *gl, void *image) +{ + vlc_gl_sys_t *sys = gl->sys; + + return sys->eglDestroyImageKHR(sys->display, image); +} + static bool CheckToken(const char *haystack, const char *needle) { size_t len = strlen(needle); @@ -211,6 +236,8 @@ static int Open (vlc_object_t *obj, const struct gl_api *api) gl->sys = sys; sys->display = EGL_NO_DISPLAY; sys->surface = EGL_NO_SURFACE; + sys->eglCreateImageKHR = NULL; + sys->eglDestroyImageKHR = NULL; vout_window_t *wnd = gl->surface; EGLSurface (*createSurface)(EGLDisplay, EGLConfig, void *, const EGLint *) @@ -366,11 +393,22 @@ static int Open (vlc_object_t *obj, const struct gl_api *api) sys->context = ctx; /* Initialize OpenGL callbacks */ + gl->ext = VLC_GL_EXT_EGL; gl->makeCurrent = MakeCurrent; gl->releaseCurrent = ReleaseCurrent; gl->resize = Resize; gl->swap = SwapBuffers; gl->getProcAddress = GetSymbol; + gl->egl.queryString = QueryString; + + sys->eglCreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR"); + sys->eglDestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR"); + if (sys->eglCreateImageKHR != NULL && sys->eglDestroyImageKHR != NULL) + { + gl->egl.createImageKHR = CreateImageKHR; + gl->egl.destroyImageKHR = DestroyImageKHR; + } + return VLC_SUCCESS; error: _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
