[vlc-devel] [PATCH 4/9] video_output: tell the display the stereo-mode has changed

Steve Lhomme robux4 at ycbcr.xyz
Sat Oct 27 08:46:30 CEST 2018


From: "Mohammed (Shaan) Huzaifa Danish" <shaan3 at gmail.com>

It may refuse the change if it doesn't know how to handle the mode.
---
 include/vlc_vout_display.h |  4 ++++
 src/video_output/display.c | 20 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 91ac07b9c0..bbf0342ddb 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -159,6 +159,10 @@ enum {
     /* Ask the module to acknowledge/refuse VR/360° viewing direction after
      * being requested externally */
     VOUT_DISPLAY_CHANGE_VIEWPOINT,   /* const vout_display_cfg_t *p_cfg */
+
+    /* Ask the module to acknowledge/refuse a new Stereoscopic 3D mode after
+     * being requested externally */
+    VOUT_DISPLAY_CHANGE_STEREO_MODE,   /* const vout_display_cfg_t *p_cfg */
 };
 
 /**
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 94487b1748..bba22dd6c2 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -352,6 +352,7 @@ typedef struct {
         unsigned den;
     } crop;
 
+    bool ch_stereo_mode;
     vlc_stereoscopic_mode_t stereo_mode;
 
     /* */
@@ -671,6 +672,19 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             osys->ch_crop = true;
     }
 
+    if (osys->ch_stereo_mode) {
+        vout_display_cfg_t cfg = osys->cfg;
+
+        cfg.stereo_mode = osys->stereo_mode;
+
+        if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_STEREO_MODE, &cfg)) {
+            msg_Err(vd, "Failed to change multiview display mode");
+            osys->stereo_mode = osys->cfg.stereo_mode;
+        }
+        osys->cfg.stereo_mode = osys->stereo_mode;
+        osys->ch_stereo_mode = false;
+    }
+
     if (osys->ch_crop) {
         unsigned crop_num = osys->crop.num;
         unsigned crop_den = osys->crop.den;
@@ -928,7 +942,11 @@ void vout_SetDisplayStereo(vout_display_t *vd, vlc_stereoscopic_mode_t mode)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
-    osys->stereo_mode = mode;
+    if (osys->stereo_mode != mode) {
+        osys->stereo_mode = mode;
+
+        osys->ch_stereo_mode = true;
+    }
 }
 
 static vout_display_t *DisplayNew(vout_thread_t *vout,
-- 
2.17.0



More information about the vlc-devel mailing list