[vlc-devel] [PATCH 2/9] video_output: add video-stereo-mode option to select the stereoscopic video output mode

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


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

New options:
Auto-detect (default), Original, Left Only, Right Only

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 include/vlc_vout.h           | 11 +++++++++++
 src/libvlc-module.c          | 15 +++++++++++++++
 src/video_output/vout_intf.c | 21 +++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 6bb712c17c..c4a2b94b24 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -72,6 +72,17 @@ struct vout_thread_t {
 #define VOUT_ALIGN_BOTTOM       0x0008
 #define VOUT_ALIGN_VMASK        0x000C
 
+/**
+  * Stereoscopic display mode.
+  */
+typedef enum vlc_stereoscopic_mode_t
+{
+    VIDEO_STEREO_OUTPUT_AUTO = 0,
+    VIDEO_STEREO_OUTPUT_ORIGINAL,
+    VIDEO_STEREO_OUTPUT_LEFT_ONLY,
+    VIDEO_STEREO_OUTPUT_RIGHT_ONLY,
+} vlc_stereoscopic_mode_t;
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 950c30d64d..8b8c86dc2f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -365,6 +365,17 @@ static const char * const ppsz_deinterlace_mode_text[] = {
     N_("Film NTSC (IVTC)")
 };
 
+#define VIDEO_STEREO_FORMAT_TEXT N_("Video Stereo 3D mode")
+#define VIDEO_STEREO_FORMAT_TEXT_LONGTEXT  N_("Set the Video Stereo 3D mode.")
+
+static const int video_stereo_formats[] = {
+    VIDEO_STEREO_OUTPUT_AUTO, VIDEO_STEREO_OUTPUT_ORIGINAL,
+    VIDEO_STEREO_OUTPUT_LEFT_ONLY, VIDEO_STEREO_OUTPUT_RIGHT_ONLY,
+};
+static const char *const video_stereo_formats_text[] = {
+    N_("Auto"), N_("Original"), N_("Left Only"), N_("Right Only"),
+};
+
 static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
 static const char *const ppsz_pos_descriptions[] =
 { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
@@ -1614,6 +1625,10 @@ vlc_module_begin ()
 
     add_bool( "video-title-show", 1, VIDEO_TITLE_SHOW_TEXT,
               VIDEO_TITLE_SHOW_LONGTEXT, false )
+    add_integer ("video-stereo-mode", VIDEO_STEREO_OUTPUT_AUTO, VIDEO_STEREO_FORMAT_TEXT,
+                 VIDEO_STEREO_FORMAT_TEXT_LONGTEXT, false)
+        change_integer_list (video_stereo_formats, video_stereo_formats_text)
+
         change_safe()
     add_integer( "video-title-timeout", 5000, VIDEO_TITLE_TIMEOUT_TEXT,
                  VIDEO_TITLE_TIMEOUT_LONGTEXT, false )
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 8c7b4571d6..a70563bb4e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -124,6 +124,17 @@ static const struct
     { "5:4", "5:4" },
 };
 
+static const struct
+{
+    int i_value;
+    char psz_label[13];
+} p_3D_output_format_values[] = {
+    { VIDEO_STEREO_OUTPUT_AUTO,         N_("Auto")         },
+    { VIDEO_STEREO_OUTPUT_ORIGINAL,     N_("Original")     },
+    { VIDEO_STEREO_OUTPUT_LEFT_ONLY,    N_("Left Only")    },
+    { VIDEO_STEREO_OUTPUT_RIGHT_ONLY,   N_("Right Only")   },
+};
+
 static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
                              char *psz_list )
 {
@@ -182,6 +193,16 @@ void vout_IntfInit( vout_thread_t *p_vout )
 
     var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
 
+    var_Create( p_vout, "video-stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Change( p_vout, "video-stereo-mode", VLC_VAR_SETTEXT, _("video-stereo-output"), NULL );
+
+    for( size_t i = 0; i < ARRAY_SIZE(p_3D_output_format_values); i++ )
+    {
+        val.i_int = p_3D_output_format_values[i].i_value;
+        var_Change( p_vout, "video-stereo-mode", VLC_VAR_ADDCHOICE, val,
+                    vlc_gettext( p_3D_output_format_values[i].psz_label ) );
+    }
+
     /* Crop offset vars */
     var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
     var_Create( p_vout, "crop-top", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
-- 
2.17.0



More information about the vlc-devel mailing list