changeset 36209:236179a10ee9

vo_gl: some Android fixes. Load libui dynamically so compilation is possible with unmodified NDK, avoid crash with > 8-bit YUV input.
author reimar
date Fri, 07 Jun 2013 19:18:16 +0000
parents 363dce384fba
children 6e2e30ee31d0
files configure libvo/gl_common.c
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu Jun 06 13:08:48 2013 +0000
+++ b/configure	Fri Jun 07 19:18:16 2013 +0000
@@ -5289,10 +5289,7 @@
 #else
   glXCreateContext(NULL, NULL, NULL, True);
 #endif
-#ifdef GL_EGL_ANDROID
-  EGLNativeWindowType android_createDisplaySurface(void);
-  android_createDisplaySurface();
-#elif !defined(GL_EGL_X11)
+#if !defined(GL_EGL_X11) && !defined(GL_EGL_ANDROID)
   glFinish();
 #endif
   return 0;
@@ -5307,15 +5304,14 @@
       break
     fi
   done
-  if cc_check -DGL_EGL_ANDROID -lEGL -lui ; then
-    _gl=yes
-    _gl_egl_android=yes
-    libs_mplayer="$libs_mplayer -lEGL -lui $ld_dl"
-  fi
   if test "$_x11" = yes && cc_check -DGL_EGL_X11 -lEGL ; then
     _gl=yes
     _gl_egl_x11=yes
     libs_mplayer="$libs_mplayer -lEGL $ld_dl"
+  elif cc_check -DGL_EGL_ANDROID -lEGL ; then
+    _gl=yes
+    _gl_egl_android=yes
+    libs_mplayer="$libs_mplayer -lEGL $ld_dl"
   fi
   if win32 && cc_check -DGL_WIN32 -lopengl32 ; then
     _gl=yes
--- a/libvo/gl_common.c	Thu Jun 06 13:08:48 2013 +0000
+++ b/libvo/gl_common.c	Fri Jun 07 19:18:16 2013 +0000
@@ -635,7 +635,8 @@
   if (format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT) {
     // ensure we get enough bits
     GLint bits = 0;
-    mpglGetTexLevelParameteriv(target, 0, GL_TEXTURE_LUMINANCE_SIZE, &bits);
+    if (mpglGetTexLevelParameteriv)
+      mpglGetTexLevelParameteriv(target, 0, GL_TEXTURE_LUMINANCE_SIZE, &bits);
     if (bits >= 0 && bits < 14 && (use_depth_l16 || HAVE_BIGENDIAN)) {
       fmt = GL_DEPTH_COMPONENT;
       format = GL_DEPTH_COMPONENT;
@@ -2394,7 +2395,7 @@
 static EGLNativeWindowType vo_window;
 #define eglGetProcAddress(a) 0
 #define mDisplay EGL_DEFAULT_DISPLAY
-EGLNativeWindowType android_createDisplaySurface(void);
+static EGLNativeWindowType (*android_createDisplaySurface)(void);
 #endif
 static void *eglgpa(const GLubyte *name) {
   void *res = eglGetProcAddress(name);
@@ -2440,8 +2441,17 @@
   }
   if (WinID != -1)
     vo_window = (EGLNativeWindowType)(intptr_t)WinID;
-  if (!vo_window)
+  if (!vo_window) {
+    if (!android_createDisplaySurface) {
+      void *handle = dlopen("libui.so", RTLD_LAZY);
+      if (!handle)
+        return SET_WINDOW_FAILED;
+      android_createDisplaySurface = dlsym(handle, "android_createDisplaySurface");
+      if (!android_createDisplaySurface)
+        return SET_WINDOW_FAILED;
+    }
     vo_window = android_createDisplaySurface();
+  }
   if (!vo_window)
     return SET_WINDOW_FAILED;
 #endif