]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/directx.c
Revert the so-called whitelisting commits that are actually blacklisting
[vlc] / modules / audio_output / directx.c
index 765b30f6e55d49b4d192180fa0790c381ea443e1..f22c77488240f4190cd1af47e9d079d17ab67ff1 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <string.h>                                            /* strerror() */
 
-#include <stdlib.h>                            /* calloc(), malloc(), free() */
 
 #include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include "aout_internal.h"
+#include <vlc_aout.h>
 
 #include <windows.h>
 #include <mmsystem.h>
@@ -242,7 +239,7 @@ static int OpenAudio( vlc_object_t *p_this )
     if( p_aout->output.p_sys == NULL )
     {
         msg_Err( p_aout, "out of memory" );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
 
     /* Initialize some variables */
@@ -374,7 +371,7 @@ static int OpenAudio( vlc_object_t *p_this )
         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;
     }
 
@@ -412,7 +409,7 @@ static void Probe( aout_instance_t * p_aout )
             == VLC_SUCCESS )
         {
             val.i_int = AOUT_VAR_5_1;
-            text.psz_string = N_("5.1");
+            text.psz_string = "5.1";
             var_Change( p_aout, "audio-device",
                         VLC_VAR_ADDCHOICE, &val, &text );
             msg_Dbg( p_aout, "device supports 5.1 channels" );
@@ -582,21 +579,17 @@ static void CloseAudio( vlc_object_t *p_this )
     aout_instance_t * p_aout = (aout_instance_t *)p_this;
     aout_sys_t *p_sys = p_aout->output.p_sys;
 
-    msg_Dbg( p_aout, "CloseAudio" );
+    msg_Dbg( p_aout, "closing audio device" );
 
     /* kill the position notification thread, if any */
     if( p_sys->p_notif )
     {
         vlc_object_detach( p_sys->p_notif );
-        if( p_sys->p_notif->b_thread )
-        {
-            p_sys->p_notif->b_die = 1;
-
-            /* 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 );
     }
 
@@ -605,13 +598,11 @@ static void CloseAudio( vlc_object_t *p_this )
 
     /* 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 );
 }
 
@@ -667,7 +658,7 @@ static int InitDirectSound( aout_instance_t *p_aout )
     if( OurDirectSoundEnumerate )
     {
         /* Attempt enumeration */
-        if( FAILED( OurDirectSoundEnumerate( CallBackDirectSoundEnum, 
+        if( FAILED( OurDirectSoundEnumerate( CallBackDirectSoundEnum,
                                              p_aout ) ) )
         {
             msg_Dbg( p_aout, "enumeration of DirectSound devices failed" );
@@ -675,7 +666,7 @@ static int InitDirectSound( aout_instance_t *p_aout )
     }
 
     /* 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 ) )
     {
@@ -965,7 +956,7 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
                                  p_sys->i_bits_per_sample );
         }
 
-        p_aout->p_vlc->pf_memcpy( p_write_position, p_buffer->p_buffer,
+        p_aout->p_libvlc->pf_memcpy( p_write_position, p_buffer->p_buffer,
                                   l_bytes1 );
         aout_BufferFree( p_buffer );
     }
@@ -979,7 +970,7 @@ static int FillBuffer( aout_instance_t *p_aout, int i_frame,
 }
 
 /*****************************************************************************
- * 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.