Commit 31e8f235 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

DirectSound: cosmetics and error path fix

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3ff8a01e
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software Foundation, Inc.,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
...@@ -580,7 +580,6 @@ static void Play( aout_instance_t *p_aout ) ...@@ -580,7 +580,6 @@ static void Play( aout_instance_t *p_aout )
if( !p_aout->output.p_sys->b_playing ) if( !p_aout->output.p_sys->b_playing )
{ {
aout_buffer_t *p_buffer; aout_buffer_t *p_buffer;
int i;
p_aout->output.p_sys->b_playing = 1; p_aout->output.p_sys->b_playing = 1;
...@@ -589,7 +588,7 @@ static void Play( aout_instance_t *p_aout ) ...@@ -589,7 +588,7 @@ static void Play( aout_instance_t *p_aout )
aout_FifoFirstDate( p_aout, &p_aout->output.fifo ); aout_FifoFirstDate( p_aout, &p_aout->output.fifo );
/* fill in the first samples */ /* fill in the first samples */
for( i = 0; i < FRAMES_NUM; i++ ) for( int i = 0; i < FRAMES_NUM; i++ )
{ {
p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo ); p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
if( !p_buffer ) break; if( !p_buffer ) break;
...@@ -649,7 +648,8 @@ static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCWSTR psz_desc, ...@@ -649,7 +648,8 @@ static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCWSTR psz_desc,
char *psz_device = FromWide( psz_desc ); char *psz_device = FromWide( psz_desc );
msg_Dbg( p_aout, "found device: %s", psz_device ); msg_Dbg( p_aout, "found device: %s", psz_device );
if( p_aout->output.p_sys->psz_device && !strcmp(p_aout->output.p_sys->psz_device, psz_device) && p_guid ) if( p_aout->output.p_sys->psz_device &&
!strcmp(p_aout->output.p_sys->psz_device, psz_device) && p_guid )
{ {
/* Use the device corresponding to psz_device */ /* Use the device corresponding to psz_device */
p_aout->output.p_sys->p_device_guid = malloc( sizeof( GUID ) ); p_aout->output.p_sys->p_device_guid = malloc( sizeof( GUID ) );
...@@ -669,7 +669,7 @@ static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCWSTR psz_desc, ...@@ -669,7 +669,7 @@ static int CALLBACK CallBackDirectSoundEnum( LPGUID p_guid, LPCWSTR psz_desc,
} }
free( psz_device ); free( psz_device );
return 1; return true;
} }
/***************************************************************************** /*****************************************************************************
...@@ -1132,7 +1132,7 @@ static int CALLBACK CallBackConfigNBEnum( LPGUID p_guid, LPCWSTR psz_desc, ...@@ -1132,7 +1132,7 @@ static int CALLBACK CallBackConfigNBEnum( LPGUID p_guid, LPCWSTR psz_desc,
int * a = (int *)p_nb; int * a = (int *)p_nb;
(*a)++; (*a)++;
return 1; return true;
} }
/***************************************************************************** /*****************************************************************************
...@@ -1147,8 +1147,8 @@ static int CALLBACK CallBackConfigEnum( LPGUID p_guid, LPCWSTR psz_desc, ...@@ -1147,8 +1147,8 @@ static int CALLBACK CallBackConfigEnum( LPGUID p_guid, LPCWSTR psz_desc,
p_item->ppsz_list[p_item->i_list] = FromWide( psz_desc ); p_item->ppsz_list[p_item->i_list] = FromWide( psz_desc );
p_item->ppsz_list_text[p_item->i_list] = FromWide( psz_desc ); p_item->ppsz_list_text[p_item->i_list] = FromWide( psz_desc );
p_item->i_list = p_item->i_list +1; p_item->i_list++;
return 1; return true;
} }
/***************************************************************************** /*****************************************************************************
...@@ -1178,11 +1178,16 @@ static int ReloadDirectXDevices( vlc_object_t *p_this, char const *psz_name, ...@@ -1178,11 +1178,16 @@ static int ReloadDirectXDevices( vlc_object_t *p_this, char const *psz_name,
if( hdsound_dll == NULL ) if( hdsound_dll == NULL )
{ {
msg_Warn( p_this, "cannot open DSOUND.DLL" ); msg_Warn( p_this, "cannot open DSOUND.DLL" );
return VLC_SUCCESS;
} }
/* Get DirectSoundEnumerate */ /* Get DirectSoundEnumerate */
OurDirectSoundEnumerate = (void *) OurDirectSoundEnumerate = (void *)
GetProcAddress( hdsound_dll, "DirectSoundEnumerateW" ); GetProcAddress( hdsound_dll, "DirectSoundEnumerateW" );
if( OurDirectSoundEnumerate == NULL )
goto error;
int nb_devices = 0; int nb_devices = 0;
OurDirectSoundEnumerate(CallBackConfigNBEnum, &nb_devices); OurDirectSoundEnumerate(CallBackConfigNBEnum, &nb_devices);
msg_Dbg(p_this,"found %d devices", nb_devices); msg_Dbg(p_this,"found %d devices", nb_devices);
...@@ -1195,11 +1200,12 @@ static int ReloadDirectXDevices( vlc_object_t *p_this, char const *psz_name, ...@@ -1195,11 +1200,12 @@ static int ReloadDirectXDevices( vlc_object_t *p_this, char const *psz_name,
p_item->i_list = 0; p_item->i_list = 0;
OurDirectSoundEnumerate(CallBackConfigEnum, p_item); OurDirectSoundEnumerate(CallBackConfigEnum, p_item);
FreeLibrary(hdsound_dll);
/* Signal change to the interface */ /* Signal change to the interface */
p_item->b_dirty = true; p_item->b_dirty = true;
error:
FreeLibrary(hdsound_dll);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment