* waveout.c : Windows waveOut plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: waveout.c,v 1.17 2003/02/17 22:19:24 gbazin Exp $
+ * $Id: waveout.c,v 1.25 2003/05/21 15:54:08 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
#endif
#include <initguid.h>
-#ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
-DEFINE_GUID( KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-#endif
-#ifndef KSDATAFORMAT_SUBTYPE_PCM
-DEFINE_GUID( KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-#endif
-#ifndef KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF
-DEFINE_GUID( KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-#endif
+DEFINE_GUID( __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+DEFINE_GUID( __KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+DEFINE_GUID( __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
/*****************************************************************************
* Local prototypes
* Module descriptor
*****************************************************************************/
vlc_module_begin();
- set_description( _("Win32 waveOut extension module") );
- set_capability( "audio output", 100 );
+ set_description( _("Win32 waveOut extension output") );
+ set_capability( "audio output", 50 );
set_callbacks( Open, Close );
vlc_module_end();
}
/* Open the device */
- if( !strcmp( val.psz_string, N_("A/52 over S/PDIF") ) )
+ if( val.i_int == AOUT_VAR_SPDIF )
{
p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
- free( val.psz_string );
if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
}
else
{
- if( !strcmp( val.psz_string, N_("5.1") ) )
+ if( val.i_int == AOUT_VAR_5_1 )
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_LFE;
}
- else if( !strcmp( val.psz_string, N_("2 Front 2 Rear") ) )
+ else if( val.i_int == AOUT_VAR_2F2R )
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
}
- else if( !strcmp( val.psz_string, "Mono" ) )
+ else if( val.i_int == AOUT_VAR_MONO )
{
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
}
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
- free( val.psz_string );
if( OpenWaveOutPCM( p_aout, &p_aout->output.output.i_format,
p_aout->output.output.i_physical_channels,
*****************************************************************************/
static void Probe( aout_instance_t * p_aout )
{
- vlc_value_t val;
+ vlc_value_t val, text;
int i_format;
unsigned int i_physical_channels;
- var_Create( p_aout, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
-
- /* Test for SPDIF support */
- if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
- {
- if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
- p_aout->output.output.i_physical_channels,
- aout_FormatNbChannels( &p_aout->output.output ),
- p_aout->output.output.i_rate, VLC_TRUE )
- == VLC_SUCCESS )
- {
- msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
- val.psz_string = N_("A/52 over S/PDIF");
- var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
- }
- }
+ var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
+ text.psz_string = _("Audio device");
+ var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );
/* Test for 5.1 support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
- val.psz_string = N_("5.1");
- var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
+ val.i_int = AOUT_VAR_5_1;
+ text.psz_string = N_("5.1");
+ var_Change( p_aout, "audio-device",
+ VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 5.1 channels" );
}
}
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
- val.psz_string = N_("2 Front 2 Rear");
- var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
+ val.i_int = AOUT_VAR_2F2R;
+ text.psz_string = N_("2 Front 2 Rear");
+ var_Change( p_aout, "audio-device",
+ VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 4 channels" );
}
}
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
- val.psz_string = N_("Stereo");
- var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
- var_Set( p_aout, "audio-device", val );
+ val.i_int = AOUT_VAR_STEREO;
+ text.psz_string = N_("Stereo");
+ var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 2 channels" );
}
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
- val.psz_string = N_("Mono");
- var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
+ val.i_int = AOUT_VAR_MONO;
+ text.psz_string = N_("Mono");
+ var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 1 channel" );
}
+ /* Test for SPDIF support */
+ if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
+ {
+ if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
+ p_aout->output.output.i_physical_channels,
+ aout_FormatNbChannels( &p_aout->output.output ),
+ p_aout->output.output.i_rate, VLC_TRUE )
+ == VLC_SUCCESS )
+ {
+ msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
+ val.i_int = AOUT_VAR_SPDIF;
+ text.psz_string = N_("A/52 over S/PDIF");
+ var_Change( p_aout, "audio-device",
+ VLC_VAR_ADDCHOICE, &val, &text );
+ if( config_GetInt( p_aout, "spdif" ) )
+ var_Set( p_aout, "audio-device", val );
+ }
+ }
+
+ var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
+ if( val.i_int <= 0 )
+ {
+ /* Probe() has failed. */
+ var_Destroy( p_aout, "audio-device" );
+ return;
+ }
+
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
val.b_bool = VLC_TRUE;
{
case VLC_FOURCC('s','p','d','i'):
i_nb_channels = 2;
+ /* To prevent channel re-ordering */
+ waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
waveformat.Format.wBitsPerSample = 16;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
- waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
+ waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
break;
case VLC_FOURCC('f','l','3','2'):
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
- waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+ waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
break;
case VLC_FOURCC('s','1','6','l'):
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_PCM;
- waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_PCM;
break;
}