vlc | branch: master | Zhao Zhili <quinkbl...@foxmail.com> | Fri Aug 10 
10:45:00 2018 +0800| [7515f84fd2819860073299e644908afddf43c6cd] | committer: 
Thomas Guillem

vout: android: allow force select android-opaque

This allows the following use case: the user of libvlc do render itself with
OpenGLES and interoperate with libvlc via SurfaceTexture, just as what VLC
gles2 module does.

Signed-off-by: Thomas Guillem <tho...@gllm.fr>

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

 modules/video_output/android/display.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/android/display.c 
b/modules/video_output/android/display.c
index 79e7144877..78c2331845 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -505,12 +505,10 @@ static int OpenCommon(vout_display_t *vd)
     vout_display_sys_t *sys;
     video_format_t sub_fmt;
 
-    /* Fallback to normal projection in case of soft decoding/display (the
-     * openGL vout, with a higher priority, should be used when the projection
-     * need to be handled). */
-    if (vd->fmt.i_chroma == VLC_CODEC_ANDROID_OPAQUE
-     && vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR)
-        return VLC_EGENERIC;
+    /* There are three cases:
+     * 1. the projection_mode is PROJECTION_MODE_RECTANGULAR
+     * 2. gles2 vout failed
+     * 3. the module is forced */
     vd->fmt.projection_mode = PROJECTION_MODE_RECTANGULAR;
 
     vout_window_t *embed =
@@ -621,8 +619,6 @@ static int Open(vlc_object_t *p_this)
     if (vd->fmt.i_chroma == VLC_CODEC_ANDROID_OPAQUE)
         return VLC_EGENERIC;
 
-    /* At this point, gles2 vout failed (old Android device) */
-    vd->fmt.projection_mode = PROJECTION_MODE_RECTANGULAR;
     return OpenCommon(vd);
 }
 
@@ -630,9 +626,12 @@ static int OpenOpaque(vlc_object_t *p_this)
 {
     vout_display_t *vd = (vout_display_t*)p_this;
 
-    if (vd->fmt.i_chroma != VLC_CODEC_ANDROID_OPAQUE
-     || vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR
-     || vd->fmt.orientation != ORIENT_NORMAL)
+    if (vd->fmt.i_chroma != VLC_CODEC_ANDROID_OPAQUE)
+        return VLC_EGENERIC;
+
+    if (!vd->obj.force
+        && (vd->fmt.projection_mode != PROJECTION_MODE_RECTANGULAR
+            || vd->fmt.orientation != ORIENT_NORMAL))
     {
         /* Let the gles2 vout handle orientation and projection */
         return VLC_EGENERIC;

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to