"Caching value for SDI captures. This " \
"value should be set in milliseconds." )
+#define RATE_TEXT N_("Audio sampling rate in Hz")
+#define RATE_LONGTEXT N_( \
+ "Audio sampling rate (in hertz) for SDI captures. " \
+ "0 disables audio input." )
+
+#define CHANNELS_TEXT N_("Number of audio channels")
+#define CHANNELS_LONGTEXT N_( \
+ "Number of input audio channels for SDI captures. " \
+ "Must be 2, 8 or 16. 0 disables audio input." )
+
vlc_module_begin ()
set_shortname( N_("SDI") )
set_description( N_("BlackMagic SDI input") )
MODE_TEXT, MODE_LONGTEXT, true )
add_integer( "sdi-caching", DEFAULT_PTS_DELAY / 1000, NULL,
CACHING_TEXT, CACHING_LONGTEXT, true )
+ add_integer( "sdi-audio-rate", 48000, NULL,
+ RATE_TEXT, RATE_LONGTEXT, true )
+ add_integer( "sdi-audio-channels", 2, NULL,
+ CHANNELS_TEXT, CHANNELS_LONGTEXT, true )
add_shortcut( "sdi" )
set_capability( "access_demux", 10 )
if( audioFrame )
{
- const int i_bytes = audioFrame->GetSampleFrameCount() * sizeof(int16_t) * 2;
+ const int i_bytes = audioFrame->GetSampleFrameCount() * sizeof(int16_t) * p_sys->i_channels;
p_audio_frame = block_New( p_demux_, i_bytes );
if( !p_audio_frame )
return VLC_EGENERIC;
}
- result = p_sys->p_input->EnableAudioInput( 48000, bmdAudioSampleType16bitInteger, 2 );
- if( result != S_OK )
+ int i_rate = var_CreateGetInteger( p_demux, "sdi-audio-rate" );
+ int i_channels = var_CreateGetInteger( p_demux, "sdi-audio-channels" );
+ if( i_rate > 0 && i_channels > 0 )
{
- msg_Err( p_demux, "Failed to enable audio input" );
- return VLC_EGENERIC;
+ result = p_sys->p_input->EnableAudioInput( i_rate, bmdAudioSampleType16bitInteger, i_channels );
+ if( result != S_OK )
+ {
+ msg_Err( p_demux, "Failed to enable audio input" );
+ return VLC_EGENERIC;
+ }
}
-
+
p_sys->p_delegate = new DeckLinkCaptureDelegate( p_demux );
p_sys->p_input->SetCallback( p_sys->p_delegate );
es_format_t audio_fmt;
es_format_Init( &audio_fmt, AUDIO_ES, VLC_CODEC_S16N );
- audio_fmt.audio.i_channels = 2;
- audio_fmt.audio.i_rate = 48000;
+ audio_fmt.audio.i_channels = i_channels;
+ audio_fmt.audio.i_rate = i_rate;
audio_fmt.audio.i_bitspersample = 16;
audio_fmt.audio.i_blockalign = audio_fmt.audio.i_channels * audio_fmt.audio.i_bitspersample / 8;
audio_fmt.i_bitrate = audio_fmt.audio.i_channels * audio_fmt.audio.i_rate * audio_fmt.audio.i_bitspersample;