[vlc-commits] vout: android: add back "vout window" module

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:39:43 2016 +0100| [329c3c0258ccdb5ed331ef19e45ac67ea4a7bda7] | committer: Thomas Guillem

vout: android: add back "vout window" module

The android-display depends now on the android-window module.

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

 modules/video_output/android/display.c | 28 ++++++++++++++--------------
 modules/video_output/android/window.c  |  2 +-
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index d723b41..49495ef 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -105,6 +105,7 @@ struct buffer_bounds
 
 struct vout_display_sys_t
 {
+    vout_window_t *embed;
     picture_pool_t *pool;
 
     int i_display_width;
@@ -655,21 +656,23 @@ static int Open(vlc_object_t *p_this)
     vout_display_sys_t *sys;
     video_format_t sub_fmt;
 
-    if (vout_display_IsWindowed(vd))
+    vout_window_t *embed =
+        vout_display_NewWindow(vd, VOUT_WINDOW_TYPE_ANDROID_NATIVE);
+
+    if (embed == NULL)
         return VLC_EGENERIC;
+    assert(embed->handle.anativewindow);
 
     /* Allocate structure */
     vd->sys = sys = (struct vout_display_sys_t*)calloc(1, sizeof(*sys));
     if (!sys)
-        return VLC_ENOMEM;
-
-    sys->p_awh = AWindowHandler_new(p_this);
-    if (!sys->p_awh)
     {
-        free(sys);
-        msg_Err(vd, "AWindowHandler_new failed");
-        return VLC_EGENERIC;
+        vout_display_DeleteWindow(vd, embed);
+        return VLC_ENOMEM;
     }
+
+    sys->embed = embed;
+    sys->p_awh = embed->handle.anativewindow;
     sys->anw = AWindowHandler_getANativeWindowAPI(sys->p_awh);
 
 #ifdef USE_ANWP
@@ -751,7 +754,7 @@ static int Open(vlc_object_t *p_this)
 
 error:
     Close(p_this);
-    return VLC_ENOMEM;
+    return VLC_EGENERIC;
 }
 
 static void Close(vlc_object_t *p_this)
@@ -759,9 +762,6 @@ static void Close(vlc_object_t *p_this)
     vout_display_t *vd = (vout_display_t *)p_this;
     vout_display_sys_t *sys = vd->sys;
 
-    if (!sys)
-        return;
-
     /* Check if SPU regions have been properly cleared, and clear them if they
      * were not. */
     if (sys->b_has_subpictures)
@@ -784,8 +784,8 @@ static void Close(vlc_object_t *p_this)
     if (sys->p_sub_window)
         AndroidWindow_Destroy(vd, sys->p_sub_window, false);
 
-    if (sys->p_awh)
-        AWindowHandler_destroy(sys->p_awh);
+    if (sys->embed)
+        vout_display_DeleteWindow(vd, sys->embed);
 
     free(sys);
 }
diff --git a/modules/video_output/android/window.c b/modules/video_output/android/window.c
index 74d1bfc..38e9789 100644
--- a/modules/video_output/android/window.c
+++ b/modules/video_output/android/window.c
@@ -51,7 +51,7 @@ vlc_module_begin()
     set_description(N_("Android native window"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VOUT)
-    set_capability("vout window", 0)
+    set_capability("vout window", 10)
     set_callbacks(Open, Close)
 vlc_module_end()
 



More information about the vlc-commits mailing list