From: Steinar Gunderson Date: Fri, 24 Sep 2010 23:31:14 +0000 (+0200) Subject: Add video connection selection. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=57d6d39cccf4d0283d079929f431d8b8619b269c;p=vlc Add video connection selection. --- diff --git a/modules/access/sdi.cpp b/modules/access/sdi.cpp index b539074f6e..8ea8eeab8e 100644 --- a/modules/access/sdi.cpp +++ b/modules/access/sdi.cpp @@ -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;