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

Steve Lhomme robux4 at ycbcr.xyz
Thu Aug 16 11:00:45 CEST 2018


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

New options:
Auto-detect (default), Stereo, Left Only, Right Only, Side by Side

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

diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 6bb712c17c..cc45ca6160 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -72,6 +72,18 @@ 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_STEREO,
+    VIDEO_STEREO_OUTPUT_LEFT_ONLY,
+    VIDEO_STEREO_OUTPUT_RIGHT_ONLY,
+    VIDEO_STEREO_OUTPUT_SIDE_BY_SIDE,
+} vlc_stereoscopic_mode_t;
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 82862ab474..6f2ef91013 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -365,6 +365,19 @@ 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_STEREO,
+    VIDEO_STEREO_OUTPUT_LEFT_ONLY, VIDEO_STEREO_OUTPUT_RIGHT_ONLY,
+    VIDEO_STEREO_OUTPUT_SIDE_BY_SIDE,
+};
+static const char *const video_stereo_formats_text[] = {
+    N_("Auto"), N_("Stereo"), N_("Left Only"), N_("Right Only"),
+    N_("Side-by-Side"),
+};
+
 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"),
@@ -1589,6 +1602,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..4e67d3d493 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -124,6 +124,18 @@ 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_STEREO, N_("Stereo") },
+    { VIDEO_STEREO_OUTPUT_LEFT_ONLY, N_("Left Only") },
+    { VIDEO_STEREO_OUTPUT_RIGHT_ONLY, N_("Right Only") },
+    { VIDEO_STEREO_OUTPUT_SIDE_BY_SIDE, N_("Side-by-Side") },
+};
+
 static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
                              char *psz_list )
 {
@@ -182,6 +194,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