[vlc-commits] EGL: update and unify the platforms list

Rémi Denis-Courmont git at videolan.org
Sat May 5 22:27:30 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May  5 23:27:05 2012 +0300| [a159d1540a03aa58133d2bbad362dfab6d425cb5] | committer: Rémi Denis-Courmont

EGL: update and unify the platforms list

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a159d1540a03aa58133d2bbad362dfab6d425cb5
---

 modules/video_output/egl.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/egl.c b/modules/video_output/egl.c
index 8217478..63f5013 100644
--- a/modules/video_output/egl.c
+++ b/modules/video_output/egl.c
@@ -109,12 +109,33 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
 {
     vlc_gl_t *gl = (vlc_gl_t *)obj;
 
-#ifdef __unix__
+    /* <EGL/eglplatform.h> defines the list and order of platforms */
+#if defined(_WIN32) || defined(__VC32__) \
+ && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+# define vlc_eglGetWindow(w) ((w)->handle.hwnd)
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
+# error Symbian EGL not supported.
+
+#elif defined(WL_EGL_PLATFORM)
+# error Wayland EGL not supported.
+
+#elif defined(__GBM__)
+# error Glamor EGL not supported.
+
+#elif defined(ANDROID)
+# error Android EGL not supported
+
+#elif defined(__unix__) /* X11 */
+# define vlc_eglGetWindow(w) ((w)->handle.xid)
     /* EGL can only use the default X11 display */
     if (gl->surface->display.x11 != NULL)
         return VLC_EGENERIC;
     if (!vlc_xlib_init (obj))
         return VLC_EGENERIC;
+
+#else
+# error EGL platform not recognized.
 #endif
 
     /* Initialize EGL display */
@@ -163,12 +184,7 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
         goto error;
 
     /* Create a drawing surface */
-#if defined (WIN32)
-    EGLNativeWindowType win = gl->surface->handle.hwnd;
-#elif defined (__unix__)
-    EGLNativeWindowType win = gl->surface->handle.xid;
-#endif
-
+    EGLNativeWindowType win = vlc_eglGetWindow(gl->surface);
     EGLSurface surface = eglCreateWindowSurface (dpy, cfgv[0], win, NULL);
     if (surface == EGL_NO_SURFACE)
     {



More information about the vlc-commits mailing list