X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faudio_output%2Fdirectx.c;h=0e83141456ab816cc88c26b82c23d282d8d2deb6;hb=4631b2c170a432b520847cf014c3c952000e6e6e;hp=98ce3147fd48389ba0678edc5d1e3cfc7ce96ac2;hpb=724461bdf250e856eb32f6c0b7c51b065e482982;p=vlc diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c index 98ce3147fd..0e83141456 100644 --- a/modules/audio_output/directx.c +++ b/modules/audio_output/directx.c @@ -1,7 +1,7 @@ /***************************************************************************** * directx.c: Windows DirectX audio output method ***************************************************************************** - * Copyright (C) 2001 the VideoLAN team + * Copyright (C) 2001-2009 the VideoLAN team * $Id$ * * Authors: Gildas Bazin @@ -210,7 +210,7 @@ static void Play ( aout_instance_t * ); static void Probe ( aout_instance_t * ); static int InitDirectSound ( aout_instance_t * ); static int CreateDSBuffer ( aout_instance_t *, int, int, int, int, int, bool ); -static int CreateDSBufferPCM ( aout_instance_t *, int*, int, int, int, bool ); +static int CreateDSBufferPCM ( aout_instance_t *, vlc_fourcc_t*, int, int, int, bool ); static void DestroyDSBuffer ( aout_instance_t * ); static void* DirectSoundThread( vlc_object_t * ); static int FillBuffer ( aout_instance_t *, int, aout_buffer_t * ); @@ -243,7 +243,7 @@ vlc_module_begin () add_shortcut( "directx" ) add_integer( "directx-audio-device", 0, NULL, DEVICE_TEXT, DEVICE_LONGTEXT, true ) - add_bool( "directx-audio-float32", 0, 0, FLOAT_TEXT, + add_bool( "directx-audio-float32", false, NULL, FLOAT_TEXT, FLOAT_LONGTEXT, true ) add_string( "directx-audio-speaker", "Windows default", NULL, SPEAKER_TEXT, SPEAKER_LONGTEXT, true ) @@ -448,7 +448,7 @@ static int OpenAudio( vlc_object_t *p_this ) static void Probe( aout_instance_t * p_aout ) { vlc_value_t val, text; - int i_format; + vlc_fourcc_t i_format; unsigned int i_physical_channels; DWORD ui_speaker_config; bool is_default_output_set = false; @@ -482,21 +482,21 @@ static void Probe( aout_instance_t * p_aout ) AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT | AOUT_CHAN_MIDDLELEFT | AOUT_CHAN_MIDDLERIGHT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE; - if( p_aout->output.output.i_physical_channels == i_physical_channels ) - { - if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 8, + if( p_aout->output.output.i_physical_channels == i_physical_channels ) + { + if( CreateDSBufferPCM( p_aout, &i_format, i_physical_channels, 8, p_aout->output.output.i_rate, true ) - == VLC_SUCCESS ) - { - val.i_int = AOUT_VAR_7_1; - text.psz_string = (char*) "7.1"; - var_Change( p_aout, "audio-device", - VLC_VAR_ADDCHOICE, &val, &text ); - var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); - is_default_output_set = true; - msg_Dbg( p_aout, "device supports 7.1 channels" ); - } - } + == VLC_SUCCESS ) + { + val.i_int = AOUT_VAR_7_1; + text.psz_string = (char*) "7.1"; + var_Change( p_aout, "audio-device", + VLC_VAR_ADDCHOICE, &val, &text ); + var_Change( p_aout, "audio-device", VLC_VAR_SETDEFAULT, &val, NULL ); + is_default_output_set = true; + msg_Dbg( p_aout, "device supports 7.1 channels" ); + } + } /* Test for 3 Front 2 Rear support */ i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | @@ -748,6 +748,8 @@ static void CloseAudio( vlc_object_t *p_this ) static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCSTR psz_desc, LPCSTR psz_mod, LPVOID _p_aout ) { + VLC_UNUSED( psz_mod ); + aout_instance_t *p_aout = (aout_instance_t *)_p_aout; msg_Dbg( p_aout, "found device: %s", psz_desc ); @@ -984,7 +986,7 @@ static int CreateDSBuffer( aout_instance_t *p_aout, int i_format, * We first try to create a WAVE_FORMAT_IEEE_FLOAT buffer if supported by * the hardware, otherwise we create a WAVE_FORMAT_PCM buffer. ****************************************************************************/ -static int CreateDSBufferPCM( aout_instance_t *p_aout, int *i_format, +static int CreateDSBufferPCM( aout_instance_t *p_aout, vlc_fourcc_t *i_format, int i_channels, int i_nb_channels, int i_rate, bool b_probe ) { @@ -1041,7 +1043,7 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame, notification_thread_t *p_notif = p_aout->output.p_sys->p_notif; aout_sys_t *p_sys = p_aout->output.p_sys; void *p_write_position, *p_wrap_around; - long l_bytes1, l_bytes2; + unsigned long l_bytes1, l_bytes2; HRESULT dsresult; /* Before copying anything, we have to lock the buffer */