[vlc-commits] vout: android: store AWindowHandler in window handle

Thomas Guillem git at videolan.org
Mon Nov 28 16:37:45 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 22 15:38:30 2016 +0100| [92a8ff01aa1e76e23c6bae72104dbb522d57abe9] | committer: Thomas Guillem

vout: android: store AWindowHandler in window handle

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

 modules/video_output/android/window.c |  7 +------
 modules/video_output/egl.c            | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/android/window.c b/modules/video_output/android/window.c
index bc517c1..9503f28 100644
--- a/modules/video_output/android/window.c
+++ b/modules/video_output/android/window.c
@@ -66,8 +66,6 @@ struct vout_window_sys_t
  */
 static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
 {
-    ANativeWindow *p_anw;
-
     if (cfg->type != VOUT_WINDOW_TYPE_INVALID
      && cfg->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
         return VLC_EGENERIC;
@@ -79,12 +77,9 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     p_sys->p_awh = AWindowHandler_new(VLC_OBJECT(wnd));
     if (!p_sys->p_awh)
         goto error;
-    p_anw = AWindowHandler_getANativeWindow(p_sys->p_awh, AWindow_Video);
-    if (!p_anw)
-        goto error;
 
     wnd->type = VOUT_WINDOW_TYPE_ANDROID_NATIVE;
-    wnd->handle.anativewindow = p_anw;
+    wnd->handle.anativewindow = p_sys->p_awh;
     wnd->control = Control;
     wnd->sys = p_sys;
 
diff --git a/modules/video_output/egl.c b/modules/video_output/egl.c
index a10dd5a..da50036 100644
--- a/modules/video_output/egl.c
+++ b/modules/video_output/egl.c
@@ -39,6 +39,9 @@
 #ifdef USE_PLATFORM_WAYLAND
 # include <wayland-egl.h>
 #endif
+#if defined (USE_PLATFORM_ANDROID)
+# include "android/utils.h"
+#endif
 
 typedef struct vlc_gl_sys_t
 {
@@ -188,6 +191,10 @@ static void Close (vlc_object_t *obj)
     if (sys->window != NULL)
         wl_egl_window_destroy(sys->window);
 #endif
+#ifdef USE_PLATFORM_ANDROID
+    AWindowHandler_releaseANativeWindow(gl->surface->handle.anativewindow,
+                                        AWindow_Video, false);
+#endif
     free (sys);
 }
 
@@ -284,7 +291,12 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
     if (wnd->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
         goto error;
 
-    window = &wnd->handle.anativewindow;
+    ANativeWindow *anw =
+        AWindowHandler_getANativeWindow(wnd->handle.anativewindow,
+                                        AWindow_Video);
+    if (anw == NULL)
+        goto error;
+    window = &anw,
 # if defined (__ANDROID__) || defined (ANDROID)
     sys->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 # endif



More information about the vlc-commits mailing list