[vlc-commits] EGL: add the OpenGL ES 2.0 support for android

Adrien Maglo git at videolan.org
Fri Nov 8 13:53:11 CET 2013


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Nov  8 13:36:27 2013 +0100| [902056ed64a0e0150dd96f553e82381c2363846d] | committer: Adrien Maglo

EGL: add the OpenGL ES 2.0 support for android

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

 modules/video_output/Modules.am |    7 +++++++
 modules/video_output/egl.c      |    9 +++++++++
 modules/video_output/gl.c       |   10 +++++-----
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
index 3ac8af7..89304f9 100644
--- a/modules/video_output/Modules.am
+++ b/modules/video_output/Modules.am
@@ -182,12 +182,19 @@ endif
 
 ### Android ###
 
+libegl_android_plugin_la_SOURCES = egl.c
+libegl_android_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_PLATFORM_ANDROID=1
+libegl_android_plugin_la_LIBADD = $(EGL_LIBS)
+
 libandroid_native_window_plugin_la_SOURCES = android/nativewindow.c
 libandroid_native_window_plugin_la_CFLAGS = $(AM_CFLAGS)
 libandroid_native_window_plugin_la_LIBADD = -ldl
 
 if HAVE_ANDROID
 vout_LTLIBRARIES += libandroid_native_window_plugin.la
+if HAVE_EGL
+vout_LTLIBRARIES += libegl_android_plugin.la
+endif
 endif
 
 ### Coloured ASCII art ###
diff --git a/modules/video_output/egl.c b/modules/video_output/egl.c
index 58cbece..6d46c6f 100644
--- a/modules/video_output/egl.c
+++ b/modules/video_output/egl.c
@@ -209,6 +209,15 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
     window.native = wnd->handle.hwnd;
 # endif
 
+#elif defined (USE_PLATFORM_ANDROID)
+    if (wnd->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
+        goto error;
+
+# if USE_DEFAULT_PLATFORM
+    sys->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+    window.native = wnd->handle.anativewindow;
+# endif
+
 #endif
 
     if (sys->display == EGL_NO_DISPLAY)
diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c
index 7217eed..9034612 100644
--- a/modules/video_output/gl.c
+++ b/modules/video_output/gl.c
@@ -105,14 +105,14 @@ static vout_window_t *MakeWindow (vout_display_t *vd)
     };
     vout_window_t *wnd;
 
-#ifdef _WIN32
+#if defined(_WIN32)
     cfg.type = VOUT_WINDOW_TYPE_HWND;
-    wnd = vout_display_NewWindow (vd, &cfg);
-    if (wnd != NULL)
-        return wnd;
+#elif defined(__ANDROID__)
+    cfg.type = VOUT_WINDOW_TYPE_ANDROID_NATIVE;
+#else
+    cfg.type = VOUT_WINDOW_TYPE_XID;
 #endif
 
-    cfg.type = VOUT_WINDOW_TYPE_XID;
     wnd = vout_display_NewWindow (vd, &cfg);
     if (wnd != NULL)
         return wnd;



More information about the vlc-commits mailing list