[MPlayer-cvslog] r36305 - in trunk: configure libvo/gl_common.c

reimar subversion at mplayerhq.hu
Fri Jun 7 21:18:16 CEST 2013


Author: reimar
Date: Fri Jun  7 21:18:16 2013
New Revision: 36305

Log:
vo_gl: some Android fixes.

Load libui dynamically so compilation is possible with unmodified
NDK, avoid crash with > 8-bit YUV input.

Modified:
   trunk/configure
   trunk/libvo/gl_common.c

Modified: trunk/configure
==============================================================================
--- trunk/configure	Thu Jun  6 15:08:48 2013	(r36304)
+++ trunk/configure	Fri Jun  7 21:18:16 2013	(r36305)
@@ -5289,10 +5289,7 @@ int main(int argc, char *argv[]) {
 #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 @@ EOF
       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

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Thu Jun  6 15:08:48 2013	(r36304)
+++ trunk/libvo/gl_common.c	Fri Jun  7 21:18:16 2013	(r36305)
@@ -635,7 +635,8 @@ void glCreateClearTex(GLenum target, GLe
   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 EGLSurface eglSurface = EGL_NO_SU
 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 @@ static int setGlWindow_egl(MPGLContext *
   }
   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


More information about the MPlayer-cvslog mailing list