[vlc-devel] [PATCH] vout: android: allow force select android-opaque
Zhao Zhili
quinkblack at foxmail.com
Fri Aug 10 04:45:00 CEST 2018
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.
---
modules/video_output/android/display.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 79e7144..579942b 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -505,12 +505,11 @@ 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 force selected
+ */
vd->fmt.projection_mode = PROJECTION_MODE_RECTANGULAR;
vout_window_t *embed =
@@ -621,8 +620,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 +627,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;
--
2.9.5
More information about the vlc-devel
mailing list