/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <string.h> /* strerror() */
-#include <stdlib.h> /* calloc(), malloc(), free() */
#include <vlc/vlc.h>
#include <vlc_aout.h>
if( p_aout->output.p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
- return VLC_EGENERIC;
+ return VLC_ENOMEM;
}
/* Initialize some variables */
msg_Err( p_aout, "cannot create DirectSoundThread" );
CloseHandle( p_aout->output.p_sys->p_notif->event );
vlc_object_destroy( p_aout->output.p_sys->p_notif );
- p_aout->output.p_sys->p_notif = 0;
+ p_aout->output.p_sys->p_notif = NULL;
goto error;
}
if( p_sys->p_notif )
{
vlc_object_detach( p_sys->p_notif );
- if( p_sys->p_notif->b_thread )
- {
- vlc_object_kill( p_sys->p_notif );
-
- /* wake up the audio thread if needed */
- if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event );
+ vlc_object_kill( p_sys->p_notif );
+ /* wake up the audio thread if needed */
+ if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event );
- vlc_thread_join( p_sys->p_notif );
- }
+ vlc_thread_join( p_sys->p_notif );
vlc_object_destroy( p_sys->p_notif );
}
/* finally release the DirectSound object */
if( p_sys->p_dsobject ) IDirectSound_Release( p_sys->p_dsobject );
-
+
/* free DSOUND.DLL */
if( p_sys->hdsound_dll ) FreeLibrary( p_sys->hdsound_dll );
- if( p_aout->output.p_sys->p_device_guid )
- free( p_aout->output.p_sys->p_device_guid );
-
+ free( p_aout->output.p_sys->p_device_guid );
free( p_sys );
}
if( OurDirectSoundEnumerate )
{
/* Attempt enumeration */
- if( FAILED( OurDirectSoundEnumerate( CallBackDirectSoundEnum,
+ if( FAILED( OurDirectSoundEnumerate( CallBackDirectSoundEnum,
p_aout ) ) )
{
msg_Dbg( p_aout, "enumeration of DirectSound devices failed" );
}
/* Create the direct sound object */
- if FAILED( OurDirectSoundCreate( p_aout->output.p_sys->p_device_guid,
+ if FAILED( OurDirectSoundCreate( p_aout->output.p_sys->p_device_guid,
&p_aout->output.p_sys->p_dsobject,
NULL ) )
{
}
/*****************************************************************************
- * DirectSoundThread: this thread will capture play notification events.
+ * DirectSoundThread: this thread will capture play notification events.
*****************************************************************************
* We use this thread to emulate a callback mechanism. The thread probes for
* event notification and fills up the DS secondary buffer when needed.