Commit ced125da authored by André Weber's avatar André Weber

Revert "#492 bugfix, for SPDIF audio ouput of AC3 and DTS sound on Windows"

This reverts commit 9438646c.
wrong file in my list I'am sorry, and wrong file modes
parent 9438646c
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_charset.h>
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
...@@ -121,12 +120,10 @@ typedef struct notification_thread_t ...@@ -121,12 +120,10 @@ typedef struct notification_thread_t
/* local functions */ /* local functions */
static void Probe ( aout_instance_t * ); static void Probe ( aout_instance_t * );
static int OpenWaveOut ( aout_instance_t *, uint32_t, static int OpenWaveOut ( aout_instance_t *, int, int, int, int, vlc_bool_t );
int, int, int, int, vlc_bool_t ); static int OpenWaveOutPCM( aout_instance_t *, int*, int, int, int, vlc_bool_t );
static int OpenWaveOutPCM( aout_instance_t *, uint32_t,
int*, int, int, int, vlc_bool_t );
static int PlayWaveOut ( aout_instance_t *, HWAVEOUT, WAVEHDR *, static int PlayWaveOut ( aout_instance_t *, HWAVEOUT, WAVEHDR *,
aout_buffer_t *, vlc_bool_t ); aout_buffer_t * );
static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD ); static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD, DWORD, DWORD );
static void WaveOutThread( notification_thread_t * ); static void WaveOutThread( notification_thread_t * );
...@@ -135,19 +132,6 @@ static int VolumeInfos( aout_instance_t *, audio_volume_t * ); ...@@ -135,19 +132,6 @@ static int VolumeInfos( aout_instance_t *, audio_volume_t * );
static int VolumeGet( aout_instance_t *, audio_volume_t * ); static int VolumeGet( aout_instance_t *, audio_volume_t * );
static int VolumeSet( aout_instance_t *, audio_volume_t ); static int VolumeSet( aout_instance_t *, audio_volume_t );
static int WaveOutClearDoneBuffers(aout_sys_t *p_sys);
static int ReloadWaveoutDevices( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static uint32_t findDeviceID(char *);
static const char psz_device_name_fmt[] = "%s ($%x,$%x)";
static const char *ppsz_adev[] = { "wavemapper", };
static const char *ppsz_adev_text[] = { N_("Microsoft Soundmapper") };
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -155,11 +139,6 @@ static const char *ppsz_adev_text[] = { N_("Microsoft Soundmapper") }; ...@@ -155,11 +139,6 @@ static const char *ppsz_adev_text[] = { N_("Microsoft Soundmapper") };
#define FLOAT_LONGTEXT N_( \ #define FLOAT_LONGTEXT N_( \
"The option allows you to enable or disable the high-quality float32 " \ "The option allows you to enable or disable the high-quality float32 " \
"audio output mode (which is not well supported by some soundcards)." ) "audio output mode (which is not well supported by some soundcards)." )
#define DEVICE_TEXT N_("Select Audio Device")
#define DEVICE_LONG N_("Select special Audio device, or let windows "\
"decide (default), change needs VLC restart "\
"to apply.")
#define DEFAULT_AUDIO_DEVICE N_("Default Audio Device")
vlc_module_begin(); vlc_module_begin();
set_shortname( "WaveOut" ); set_shortname( "WaveOut" );
...@@ -168,14 +147,6 @@ vlc_module_begin(); ...@@ -168,14 +147,6 @@ vlc_module_begin();
set_category( CAT_AUDIO ); set_category( CAT_AUDIO );
set_subcategory( SUBCAT_AUDIO_AOUT ); set_subcategory( SUBCAT_AUDIO_AOUT );
add_bool( "waveout-float32", 1, 0, FLOAT_TEXT, FLOAT_LONGTEXT, VLC_TRUE ); add_bool( "waveout-float32", 1, 0, FLOAT_TEXT, FLOAT_LONGTEXT, VLC_TRUE );
add_string( "waveout-dev", "wavemapper", NULL,
DEVICE_TEXT, DEVICE_LONG, VLC_FALSE );
change_string_list( ppsz_adev, ppsz_adev_text, ReloadWaveoutDevices );
change_need_restart();
change_action_add( ReloadWaveoutDevices, N_("Refresh list") );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
vlc_module_end(); vlc_module_end();
...@@ -187,8 +158,6 @@ vlc_module_end(); ...@@ -187,8 +158,6 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
struct aout_sys_t struct aout_sys_t
{ {
uint32_t i_wave_device_id; /* ID of selected output device */
HWAVEOUT h_waveout; /* handle to waveout instance */ HWAVEOUT h_waveout; /* handle to waveout instance */
WAVEFORMATEXTENSIBLE waveformat; /* audio format */ WAVEFORMATEXTENSIBLE waveformat; /* audio format */
...@@ -197,13 +166,6 @@ struct aout_sys_t ...@@ -197,13 +166,6 @@ struct aout_sys_t
notification_thread_t *p_notif; /* WaveOutThread id */ notification_thread_t *p_notif; /* WaveOutThread id */
HANDLE event; HANDLE event;
HANDLE new_buffer_event;
// rental from alsa.c to synchronize startup of audiothread
int b_playing; /* playing status */
mtime_t start_date;
int i_repeat_counter;
int i_buffer_size; int i_buffer_size;
...@@ -252,50 +214,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -252,50 +214,6 @@ static int Open( vlc_object_t *p_this )
p_aout->output.pf_play = Play; p_aout->output.pf_play = Play;
p_aout->b_die = VLC_FALSE; p_aout->b_die = VLC_FALSE;
/*
initialize/update Device selection List
*/
ReloadWaveoutDevices( p_this, "waveout-dev", val, val, NULL);
/*
check for configured audio device!
*/
char *psz_waveout_dev = var_CreateGetString( p_aout, "waveout-dev");
p_aout->output.p_sys->i_wave_device_id =
findDeviceID( psz_waveout_dev );
if(p_aout->output.p_sys->i_wave_device_id == WAVE_MAPPER)
{
if(psz_waveout_dev &&
stricmp(psz_waveout_dev,"wavemapper"))
{
msg_Warn( p_aout, "configured audio device '%s' not available, "\
"use default instead", psz_waveout_dev );
}
}
if(psz_waveout_dev) free( psz_waveout_dev );
WAVEOUTCAPS waveoutcaps;
if(waveOutGetDevCaps( p_aout->output.p_sys->i_wave_device_id,
&waveoutcaps,
sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR)
{
/* log debug some infos about driver, to know who to blame
if it doesn't work */
msg_Dbg( p_aout, "Drivername: %s", waveoutcaps.szPname);
msg_Dbg( p_aout, "Driver Version: %d.%d",
(waveoutcaps.vDriverVersion>>8)&255,
waveoutcaps.vDriverVersion & 255);
msg_Dbg( p_aout, "Manufacturer identifier: 0x%x", waveoutcaps.wMid );
msg_Dbg( p_aout, "Product identifier: 0x%x", waveoutcaps.wPid );
}
if( var_Type( p_aout, "audio-device" ) == 0 ) if( var_Type( p_aout, "audio-device" ) == 0 )
{ {
Probe( p_aout ); Probe( p_aout );
...@@ -304,20 +222,18 @@ static int Open( vlc_object_t *p_this ) ...@@ -304,20 +222,18 @@ static int Open( vlc_object_t *p_this )
if( var_Get( p_aout, "audio-device", &val ) < 0 ) if( var_Get( p_aout, "audio-device", &val ) < 0 )
{ {
/* Probe() has failed. */ /* Probe() has failed. */
var_Destroy( p_aout, "waveout-device");
free( p_aout->output.p_sys ); free( p_aout->output.p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
var_Create( p_aout, "waveout-float32", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* Open the device */ /* Open the device */
if( val.i_int == AOUT_VAR_SPDIF ) if( val.i_int == AOUT_VAR_SPDIF )
{ {
p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i'); p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
if( OpenWaveOut( p_aout, if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.p_sys->i_wave_device_id,
VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels, p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ), aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_FALSE ) p_aout->output.output.i_rate, VLC_FALSE )
...@@ -364,9 +280,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -364,9 +280,7 @@ static int Open( vlc_object_t *p_this )
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
} }
if( OpenWaveOutPCM( p_aout, if( OpenWaveOutPCM( p_aout, &p_aout->output.output.i_format,
p_aout->output.p_sys->i_wave_device_id,
&p_aout->output.output.i_format,
p_aout->output.output.i_physical_channels, p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ), aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_FALSE ) p_aout->output.output.i_rate, VLC_FALSE )
...@@ -413,8 +327,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -413,8 +327,6 @@ static int Open( vlc_object_t *p_this )
msg_Err( p_aout, "out of memory" ); msg_Err( p_aout, "out of memory" );
return 1; return 1;
} }
p_aout->output.p_sys->i_repeat_counter = 0;
/* Zero the buffer. WinCE doesn't have calloc(). */ /* Zero the buffer. WinCE doesn't have calloc(). */
memset( p_aout->output.p_sys->p_silence_buffer, 0, memset( p_aout->output.p_sys->p_silence_buffer, 0,
...@@ -425,18 +337,11 @@ static int Open( vlc_object_t *p_this ) ...@@ -425,18 +337,11 @@ static int Open( vlc_object_t *p_this )
vlc_object_create( p_aout, sizeof(notification_thread_t) ); vlc_object_create( p_aout, sizeof(notification_thread_t) );
p_aout->output.p_sys->p_notif->p_aout = p_aout; p_aout->output.p_sys->p_notif->p_aout = p_aout;
p_aout->output.p_sys->event = CreateEvent( NULL, FALSE, FALSE, NULL ); p_aout->output.p_sys->event = CreateEvent( NULL, FALSE, FALSE, NULL );
p_aout->output.p_sys->new_buffer_event = CreateEvent( NULL, FALSE, FALSE, NULL );
/* define startpoint of playback on first call to play()
like alsa does (instead of playing a blank sample) */
p_aout->output.p_sys->b_playing = 0;
p_aout->output.p_sys->start_date = 0;
/* Then launch the notification thread */ /* Then launch the notification thread */
if( vlc_thread_create( p_aout->output.p_sys->p_notif, if( vlc_thread_create( p_aout->output.p_sys->p_notif,
"waveOut Notification Thread", WaveOutThread, "waveOut Notification Thread", WaveOutThread,
VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
{ {
msg_Err( p_aout, "cannot create WaveOutThread" ); msg_Err( p_aout, "cannot create WaveOutThread" );
} }
...@@ -448,6 +353,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -448,6 +353,8 @@ static int Open( vlc_object_t *p_this )
p_aout->output.p_sys->waveheader[i].dwFlags = WHDR_DONE; p_aout->output.p_sys->waveheader[i].dwFlags = WHDR_DONE;
p_aout->output.p_sys->waveheader[i].dwUser = 0; p_aout->output.p_sys->waveheader[i].dwUser = 0;
} }
PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout,
&p_aout->output.p_sys->waveheader[0], NULL );
return 0; return 0;
} }
...@@ -471,15 +378,13 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -471,15 +378,13 @@ static void Probe( aout_instance_t * p_aout )
AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE; AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE;
if( p_aout->output.output.i_physical_channels == i_physical_channels ) if( p_aout->output.output.i_physical_channels == i_physical_channels )
{ {
if( OpenWaveOutPCM( p_aout, if( OpenWaveOutPCM( p_aout, &i_format,
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 6, i_physical_channels, 6,
p_aout->output.output.i_rate, VLC_TRUE ) p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS ) == VLC_SUCCESS )
{ {
val.i_int = AOUT_VAR_5_1; val.i_int = AOUT_VAR_5_1;
text.psz_string = (char *)N_("5.1"); text.psz_string = N_("5.1");
var_Change( p_aout, "audio-device", var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text ); VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 5.1 channels" ); msg_Dbg( p_aout, "device supports 5.1 channels" );
...@@ -492,15 +397,13 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -492,15 +397,13 @@ static void Probe( aout_instance_t * p_aout )
if( ( p_aout->output.output.i_physical_channels & i_physical_channels ) if( ( p_aout->output.output.i_physical_channels & i_physical_channels )
== i_physical_channels ) == i_physical_channels )
{ {
if( OpenWaveOutPCM( p_aout, if( OpenWaveOutPCM( p_aout, &i_format,
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 4, i_physical_channels, 4,
p_aout->output.output.i_rate, VLC_TRUE ) p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS ) == VLC_SUCCESS )
{ {
val.i_int = AOUT_VAR_2F2R; val.i_int = AOUT_VAR_2F2R;
text.psz_string = (char *)N_("2 Front 2 Rear"); text.psz_string = N_("2 Front 2 Rear");
var_Change( p_aout, "audio-device", var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text ); VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 4 channels" ); msg_Dbg( p_aout, "device supports 4 channels" );
...@@ -509,30 +412,26 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -509,30 +412,26 @@ static void Probe( aout_instance_t * p_aout )
/* Test for stereo support */ /* Test for stereo support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
if( OpenWaveOutPCM( p_aout, if( OpenWaveOutPCM( p_aout, &i_format,
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 2, i_physical_channels, 2,
p_aout->output.output.i_rate, VLC_TRUE ) p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS ) == VLC_SUCCESS )
{ {
val.i_int = AOUT_VAR_STEREO; val.i_int = AOUT_VAR_STEREO;
text.psz_string = (char *)N_("Stereo"); text.psz_string = N_("Stereo");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 2 channels" ); msg_Dbg( p_aout, "device supports 2 channels" );
} }
/* Test for mono support */ /* Test for mono support */
i_physical_channels = AOUT_CHAN_CENTER; i_physical_channels = AOUT_CHAN_CENTER;
if( OpenWaveOutPCM( p_aout, if( OpenWaveOutPCM( p_aout, &i_format,
p_aout->output.p_sys->i_wave_device_id,
&i_format,
i_physical_channels, 1, i_physical_channels, 1,
p_aout->output.output.i_rate, VLC_TRUE ) p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS ) == VLC_SUCCESS )
{ {
val.i_int = AOUT_VAR_MONO; val.i_int = AOUT_VAR_MONO;
text.psz_string = (char *)N_("Mono"); text.psz_string = N_("Mono");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 1 channel" ); msg_Dbg( p_aout, "device supports 1 channel" );
} }
...@@ -540,9 +439,7 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -540,9 +439,7 @@ static void Probe( aout_instance_t * p_aout )
/* Test for SPDIF support */ /* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) ) if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{ {
if( OpenWaveOut( p_aout, if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.p_sys->i_wave_device_id,
VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels, p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ), aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_TRUE ) p_aout->output.output.i_rate, VLC_TRUE )
...@@ -550,7 +447,7 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -550,7 +447,7 @@ static void Probe( aout_instance_t * p_aout )
{ {
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" ); msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.i_int = AOUT_VAR_SPDIF; val.i_int = AOUT_VAR_SPDIF;
text.psz_string = (char *)N_("A/52 over S/PDIF"); text.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device", var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text ); VLC_VAR_ADDCHOICE, &val, &text );
if( config_GetInt( p_aout, "spdif" ) ) if( config_GetInt( p_aout, "spdif" ) )
...@@ -580,21 +477,6 @@ static void Probe( aout_instance_t * p_aout ) ...@@ -580,21 +477,6 @@ static void Probe( aout_instance_t * p_aout )
*****************************************************************************/ *****************************************************************************/
static void Play( aout_instance_t *_p_aout ) static void Play( aout_instance_t *_p_aout )
{ {
if( !_p_aout->output.p_sys->b_playing )
{
_p_aout->output.p_sys->b_playing = 1;
/* get the playing date of the first aout buffer */
_p_aout->output.p_sys->start_date =
aout_FifoFirstDate( _p_aout, &_p_aout->output.fifo );
msg_Dbg( _p_aout, "Wakeup sleeping output thread.");
/* wake up the audio output thread */
SetEvent( _p_aout->output.p_sys->event );
} else {
SetEvent( _p_aout->output.p_sys->new_buffer_event );
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -608,68 +490,20 @@ static void Close( vlc_object_t *p_this ) ...@@ -608,68 +490,20 @@ static void Close( vlc_object_t *p_this )
/* Before calling waveOutClose we must reset the device */ /* Before calling waveOutClose we must reset the device */
vlc_object_kill( p_aout ); vlc_object_kill( p_aout );
/* wake up the audio thread, to recognize that p_aout died */ waveOutReset( p_sys->h_waveout );
SetEvent( p_sys->event );
SetEvent( p_sys->new_buffer_event );
/* wake up the audio thread */
SetEvent( p_sys->event );
vlc_thread_join( p_sys->p_notif ); vlc_thread_join( p_sys->p_notif );
vlc_object_release( p_sys->p_notif ); vlc_object_release( p_sys->p_notif );
CloseHandle( p_sys->event );
/* /* Close the device */
kill the real output then - when the feed thread
is surely terminated!
old code could be too early in case that "feeding"
was running on termination
at this point now its sure, that there will be no new
data send to the driver, and we can cancel the last
running playbuffers
*/
MMRESULT result = waveOutReset( p_sys->h_waveout );
if(result != MMSYSERR_NOERROR)
{
msg_Err( p_aout, "waveOutReset failed 0x%x", result );
/*
now we must wait, that all buffers are played
because cancel doesn't work in this case...
*/
if(result == MMSYSERR_NOTSUPPORTED)
{
/*
clear currently played (done) buffers,
if returnvalue > 0 (means some buffer still playing)
wait for the driver event callback that one buffer
is finished with playing, and check again
the timeout of 5000ms is just, an emergency exit
of this loop, to avoid deadlock in case of other
(currently not known bugs, problems, errors cases?)
*/
while(
(WaveOutClearDoneBuffers( p_sys ) > 0)
&&
(WaitForSingleObject( p_sys->event, 5000) == WAIT_OBJECT_0)
)
{
msg_Dbg( p_aout, "Wait for waveout device...");
}
}
} else {
WaveOutClearDoneBuffers( p_sys );
}
/* now we can Close the device */
if( waveOutClose( p_sys->h_waveout ) != MMSYSERR_NOERROR ) if( waveOutClose( p_sys->h_waveout ) != MMSYSERR_NOERROR )
{ {
msg_Err( p_aout, "waveOutClose failed" ); msg_Err( p_aout, "waveOutClose failed" );
} }
/*
because so long, the waveout device is playing, the callback
could occur and need the events
*/
CloseHandle( p_sys->event );
CloseHandle( p_sys->new_buffer_event);
free( p_sys->p_silence_buffer ); free( p_sys->p_silence_buffer );
free( p_sys ); free( p_sys );
} }
...@@ -677,7 +511,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -677,7 +511,7 @@ static void Close( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* OpenWaveOut: open the waveout sound device * OpenWaveOut: open the waveout sound device
****************************************************************************/ ****************************************************************************/
static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_format, static int OpenWaveOut( aout_instance_t *p_aout, int i_format,
int i_channels, int i_nb_channels, int i_rate, int i_channels, int i_nb_channels, int i_rate,
vlc_bool_t b_probe ) vlc_bool_t b_probe )
{ {
...@@ -744,32 +578,8 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for ...@@ -744,32 +578,8 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for
sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
} }
if(!b_probe) {
msg_Dbg( p_aout, "OpenWaveDevice-ID: %u", i_device_id);
msg_Dbg( p_aout,"waveformat.Format.cbSize = %d",
waveformat.Format.cbSize);
msg_Dbg( p_aout,"waveformat.Format.wFormatTag = %u",
waveformat.Format.wFormatTag);
msg_Dbg( p_aout,"waveformat.Format.nChannels = %u",
waveformat.Format.nChannels);
msg_Dbg( p_aout,"waveformat.Format.nSamplesPerSec = %d",
(int)waveformat.Format.nSamplesPerSec);
msg_Dbg( p_aout,"waveformat.Format.nAvgBytesPerSec = %u",
(int)waveformat.Format.nAvgBytesPerSec);
msg_Dbg( p_aout,"waveformat.Format.nBlockAlign = %d",
waveformat.Format.nBlockAlign);
msg_Dbg( p_aout,"waveformat.Format.wBitsPerSample = %d",
waveformat.Format.wBitsPerSample);
msg_Dbg( p_aout,"waveformat.Samples.wValidBitsPerSample = %d",
waveformat.Samples.wValidBitsPerSample);
msg_Dbg( p_aout,"waveformat.Samples.wSamplesPerBlock = %d",
waveformat.Samples.wSamplesPerBlock);
msg_Dbg( p_aout,"waveformat.dwChannelMask = %lu",
waveformat.dwChannelMask);
}
/* Open the device */ /* Open the device */
result = waveOutOpen( &p_aout->output.p_sys->h_waveout, i_device_id, result = waveOutOpen( &p_aout->output.p_sys->h_waveout, WAVE_MAPPER,
(WAVEFORMATEX *)&waveformat, (WAVEFORMATEX *)&waveformat,
(DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout, (DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout,
CALLBACK_FUNCTION | (b_probe?WAVE_FORMAT_QUERY:0) ); CALLBACK_FUNCTION | (b_probe?WAVE_FORMAT_QUERY:0) );
...@@ -808,17 +618,19 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for ...@@ -808,17 +618,19 @@ static int OpenWaveOut( aout_instance_t *p_aout, uint32_t i_device_id, int i_for
/***************************************************************************** /*****************************************************************************
* OpenWaveOutPCM: open a PCM waveout sound device * OpenWaveOutPCM: open a PCM waveout sound device
****************************************************************************/ ****************************************************************************/
static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i_format, static int OpenWaveOutPCM( aout_instance_t *p_aout, int *i_format,
int i_channels, int i_nb_channels, int i_rate, int i_channels, int i_nb_channels, int i_rate,
vlc_bool_t b_probe ) vlc_bool_t b_probe )
{ {
vlc_bool_t b_use_float32 = var_CreateGetBool( p_aout, "waveout-float32"); vlc_value_t val;
var_Get( p_aout, "waveout-float32", &val );
if( !b_use_float32 || OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('f','l','3','2'), if( !val.b_bool || OpenWaveOut( p_aout, VLC_FOURCC('f','l','3','2'),
i_channels, i_nb_channels, i_rate, b_probe ) i_channels, i_nb_channels, i_rate, b_probe )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
if ( OpenWaveOut( p_aout, i_device_id, VLC_FOURCC('s','1','6','l'), if ( OpenWaveOut( p_aout, VLC_FOURCC('s','1','6','l'),
i_channels, i_nb_channels, i_rate, b_probe ) i_channels, i_nb_channels, i_rate, b_probe )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
...@@ -841,43 +653,16 @@ static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i ...@@ -841,43 +653,16 @@ static int OpenWaveOutPCM( aout_instance_t *p_aout, uint32_t i_device_id, int *i
* PlayWaveOut: play a buffer through the WaveOut device * PlayWaveOut: play a buffer through the WaveOut device
*****************************************************************************/ *****************************************************************************/
static int PlayWaveOut( aout_instance_t *p_aout, HWAVEOUT h_waveout, static int PlayWaveOut( aout_instance_t *p_aout, HWAVEOUT h_waveout,
WAVEHDR *p_waveheader, aout_buffer_t *p_buffer, WAVEHDR *p_waveheader, aout_buffer_t *p_buffer )
vlc_bool_t b_spdif)
{ {
MMRESULT result; MMRESULT result;
/* Prepare the buffer */ /* Prepare the buffer */
if( p_buffer != NULL ) if( p_buffer != NULL )
{
p_waveheader->lpData = p_buffer->p_buffer; p_waveheader->lpData = p_buffer->p_buffer;
/* else
copy the buffer to the silence buffer :) so in case we don't