]> git.sesse.net Git - vlc/commitdiff
Add video connection selection.
authorSteinar Gunderson <sgunderson@bigfoot.com>
Fri, 24 Sep 2010 23:31:14 +0000 (01:31 +0200)
committerSteinar Gunderson <sgunderson@bigfoot.com>
Fri, 24 Sep 2010 23:31:14 +0000 (01:31 +0200)
modules/access/sdi.cpp

index b539074f6e3fad85d648cccad93909962f4956dc..8ea8eeab8e9829e244d89e4b82822e25d40341c2 100644 (file)
@@ -52,6 +52,13 @@ static void Close( vlc_object_t * );
     "Number of input audio channels for SDI captures. " \
     "Must be 2, 8 or 16. 0 disables audio input." )
 
+#define VIDEO_CONNECTION_TEXT N_("Video connection")
+#define VIDEO_CONNECTION_LONGTEXT N_( \
+    "Video connection to use for SDI captures. " \
+    "Valid choices: sdi, hdmi, opticalsdi, component, " \
+    "composite, svideo. " \
+    "Leave blank for card default." )
+
 #define ASPECT_RATIO_TEXT N_("Aspect ratio")
 #define ASPECT_RATIO_LONGTEXT N_( \
     "Aspect ratio (4:3, 16:9). Default assumes square pixels." )
@@ -72,6 +79,8 @@ vlc_module_begin ()
                  RATE_TEXT, RATE_LONGTEXT, true )
     add_integer( "sdi-audio-channels", 2, NULL,
                  CHANNELS_TEXT, CHANNELS_LONGTEXT, true )
+    add_string( "sdi-video-connection", 0, NULL,
+                 VIDEO_CONNECTION_TEXT, VIDEO_CONNECTION_LONGTEXT, true )
     add_string( "sdi-aspect-ratio", NULL, NULL,
                 ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, true )
 
@@ -262,8 +271,41 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_demux, "Failed to get configuration interface" );
         return VLC_EGENERIC;
     }
+    
+    char *psz_tmp = var_CreateGetNonEmptyString( p_demux, "sdi-video-connection" );
+    if( psz_tmp )
+    {
+        BMDVideoConnection conn;
+        if ( !strcmp( psz_tmp, "sdi" ) )
+            conn = bmdVideoConnectionSDI;
+        else if ( !strcmp( psz_tmp, "hdmi" ) )
+            conn = bmdVideoConnectionHDMI;
+        else if ( !strcmp( psz_tmp, "opticalsdi" ) )
+            conn = bmdVideoConnectionOpticalSDI;
+        else if ( !strcmp( psz_tmp, "component" ) )
+            conn = bmdVideoConnectionComponent;
+        else if ( !strcmp( psz_tmp, "composite" ) )
+            conn = bmdVideoConnectionComposite;
+        else if ( !strcmp( psz_tmp, "svideo" ) )
+            conn = bmdVideoConnectionSVideo;
+        else
+        {
+            msg_Err( p_demux, "Invalid --sdi-video-connection specified; choose one of " \
+                              "sdi, hdmi, opticalsdi, component, composite, or svideo." );
+            return VLC_EGENERIC;
+        }
+        free( psz_tmp );
+
+        msg_Dbg( p_demux, "Setting video input format to 0x%x", conn);
+        result = p_config->SetVideoInputFormat( conn );
+        if( result != S_OK )
+        {
+            msg_Err( p_demux, "Failed to set video input connection" );
+            return VLC_EGENERIC;
+        }
+    } 
 
-    char *psz_tmp = var_CreateGetNonEmptyString( p_demux, "sdi-audio-connection" );
+    psz_tmp = var_CreateGetNonEmptyString( p_demux, "sdi-audio-connection" );
     if( psz_tmp )
     {
         BMDAudioConnection conn;