]> git.sesse.net Git - vlc/blobdiff - modules/video_output/androidsurface.c
macosx: move mouse vout event code to vout module
[vlc] / modules / video_output / androidsurface.c
index 9bfd3131ee2e20b42660d0c437fb3321d73e9744..af2cdc19d50b21ab22ee09825d455246605b5740 100644 (file)
@@ -7,20 +7,20 @@
  *          Ludovic Fauvet <etix@l0cal.com>
  *          Sébastien Toque <xilasz@gmail.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- ****************************************************************************/
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -36,6 +36,9 @@
 #ifndef ANDROID_SYM_S_LOCK
 # define ANDROID_SYM_S_LOCK "_ZN7android7Surface4lockEPNS0_11SurfaceInfoEb"
 #endif
+#ifndef ANDROID_SYM_S_LOCK2
+# define ANDROID_SYM_S_LOCK2 "_ZN7android7Surface4lockEPNS0_11SurfaceInfoEPNS_6RegionE"
+#endif
 #ifndef ANDROID_SYM_S_UNLOCK
 # define ANDROID_SYM_S_UNLOCK "_ZN7android7Surface13unlockAndPostEv"
 #endif
@@ -67,6 +70,8 @@ extern void  jni_SetAndroidSurfaceSize(int width, int height);
 
 // _ZN7android7Surface4lockEPNS0_11SurfaceInfoEb
 typedef void (*Surface_lock)(void *, void *, int);
+// _ZN7android7Surface4lockEPNS0_11SurfaceInfoEPNS_6RegionE
+typedef void (*Surface_lock2)(void *, void *, void *);
 // _ZN7android7Surface13unlockAndPostEv
 typedef void (*Surface_unlockAndPost)(void *);
 
@@ -83,6 +88,7 @@ struct vout_display_sys_t {
     picture_pool_t *pool;
     void *p_library;
     Surface_lock s_lock;
+    Surface_lock2 s_lock2;
     Surface_unlockAndPost s_unlockAndPost;
 
     picture_resource_t resource;
@@ -115,9 +121,10 @@ static inline void *LoadSurface(const char *psz_lib, vout_display_sys_t *sys) {
     void *p_library = dlopen(psz_lib, RTLD_NOW);
     if (p_library) {
         sys->s_lock = (Surface_lock)(dlsym(p_library, ANDROID_SYM_S_LOCK));
+        sys->s_lock2 = (Surface_lock2)(dlsym(p_library, ANDROID_SYM_S_LOCK2));
         sys->s_unlockAndPost =
             (Surface_unlockAndPost)(dlsym(p_library, ANDROID_SYM_S_UNLOCK));
-        if (sys->s_lock && sys->s_unlockAndPost) {
+        if ((sys->s_lock || sys->s_lock2) && sys->s_unlockAndPost) {
             return p_library;
         }
         dlclose(p_library);
@@ -129,6 +136,8 @@ static void *InitLibrary(vout_display_sys_t *sys) {
     void *p_library;
     if ((p_library = LoadSurface("libsurfaceflinger_client.so", sys)))
         return p_library;
+    if ((p_library = LoadSurface("libgui.so", sys)))
+        return p_library;
     return LoadSurface("libui.so", sys);
 }
 
@@ -154,7 +163,7 @@ static int Open(vlc_object_t *p_this) {
     sys->p_library = p_library = InitLibrary(sys);
     if (!p_library) {
         free(sys);
-        msg_Err(vd, "Could not initialize libui.so/libsurfaceflinger_client.so!");
+        msg_Err(vd, "Could not initialize libui.so/libgui.so/libsurfaceflinger_client.so!");
         vlc_mutex_unlock(&single_instance);
         return VLC_EGENERIC;
     }
@@ -253,7 +262,10 @@ static int  AndroidLockSurface(picture_t *picture) {
         return VLC_EGENERIC;
     }
 
-    sys->s_lock(surf, info, 1);
+    if (sys->s_lock)
+        sys->s_lock(surf, info, 1);
+    else
+        sys->s_lock2(surf, info, NULL);
 
     // input size doesn't match the surface size,
     // request a resize