[vlc-commits] vout/android: change android-display priority
Thomas Guillem
git at videolan.org
Mon Dec 19 17:24:43 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 19 15:37:32 2016 +0100| [6d5cd320c197388de621624f1b505c9e610019b6] | committer: Thomas Guillem
vout/android: change android-display priority
This allow us to use a different vout to render VLC_CODEC_ANDROID_OPAQUE in
regards of the video_format_t:
- opaque android-display: priority of 280: do direct rendering on a
SurfaceView, will fail if there is a projection to handle (360 videos).
- gles2: priority of 265: do direct rendering on a SurfaceTexture created from
an OpenGL Texture, can handle projection.
- android-display: priority of 260: will fail for VLC_CODEC_ANDROID_OPAQUE.
The gles2 module has a little overhead for VLC_CODEC_ANDROID_OPAQUE. It does
one JNI->Java/synchronize/wait per frame. That's why it's not used by default
(but I wasn't able to see any significant differences on the devices I tested).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d5cd320c197388de621624f1b505c9e610019b6
---
modules/video_output/android/display.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 7c5bbd1..4adb652 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -49,6 +49,7 @@
#define CFG_PREFIX "android-display-"
static int Open (vlc_object_t *);
+static int OpenOpaque (vlc_object_t *);
static void Close(vlc_object_t *);
static void SubpicturePrepare(vout_display_t *vd, subpicture_t *subpicture);
@@ -60,6 +61,10 @@ vlc_module_begin()
add_shortcut("android-display")
add_string(CFG_PREFIX "chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true)
set_callbacks(Open, Close)
+ add_submodule ()
+ set_description("Android opaque video output")
+ set_capability("vout display", 280)
+ set_callbacks(OpenOpaque, Close)
vlc_module_end()
/*****************************************************************************
@@ -634,9 +639,8 @@ static void SetRGBMask(video_format_t *p_fmt)
}
}
-static int Open(vlc_object_t *p_this)
+static int OpenCommon(vout_display_t *vd)
{
- vout_display_t *vd = (vout_display_t*)p_this;
vout_display_sys_t *sys;
video_format_t sub_fmt;
@@ -745,10 +749,33 @@ static int Open(vlc_object_t *p_this)
return VLC_SUCCESS;
error:
- Close(p_this);
+ Close(VLC_OBJECT(vd));
return VLC_EGENERIC;
}
+static int Open(vlc_object_t *p_this)
+{
+ vout_display_t *vd = (vout_display_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);
+}
+
+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)
+ return VLC_EGENERIC;
+
+ return OpenCommon(vd);
+}
+
static void Close(vlc_object_t *p_this)
{
vout_display_t *vd = (vout_display_t *)p_this;
More information about the vlc-commits
mailing list