]> git.sesse.net Git - vlc/commitdiff
* modules/audio_output/directx.c, modules/audio_output/waveout.c: we destroy the...
authorGildas Bazin <gbazin@videolan.org>
Wed, 21 May 2003 15:54:08 +0000 (15:54 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 21 May 2003 15:54:08 +0000 (15:54 +0000)
modules/audio_output/directx.c
modules/audio_output/waveout.c

index 023dce93c74da313ad8b75fe6b7196a61d43655e..887dfc2b6053cb03bd18d35c37f8e1ffea772e53 100644 (file)
@@ -2,7 +2,7 @@
  * directx.c: Windows DirectX audio output method
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.19 2003/05/04 22:42:15 gbazin Exp $
+ * $Id: directx.c,v 1.20 2003/05/21 15:54:08 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -251,11 +251,6 @@ static int OpenAudio( vlc_object_t *p_this )
         goto error;
     }
 
-    /* Now we need to setup our DirectSound play notification structure */
-    p_aout->output.p_sys->p_notif =
-        vlc_object_create( p_aout, sizeof(notification_thread_t) );
-    p_aout->output.p_sys->p_notif->p_aout = p_aout;
-
     if( var_Type( p_aout, "audio-device" ) == 0 )
     {
         Probe( p_aout );
@@ -267,6 +262,11 @@ static int OpenAudio( vlc_object_t *p_this )
         goto error;
     }
 
+    /* Now we need to setup our DirectSound play notification structure */
+    p_aout->output.p_sys->p_notif =
+        vlc_object_create( p_aout, sizeof(notification_thread_t) );
+    p_aout->output.p_sys->p_notif->p_aout = p_aout;
+
     /* Then create the notification events */
     for( i = 0; i < FRAMES_NUM; i++ )
         p_aout->output.p_sys->p_notif->p_events[i].hEventNotify =
@@ -483,6 +483,14 @@ static void Probe( aout_instance_t * p_aout )
         }
     }
 
+    var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
+    if( val.i_int <= 0 )
+    {
+        /* Probe() has failed. */
+        var_Destroy( p_aout, "audio-device" );
+        return;
+    }
+
     var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
 
     val.b_bool = VLC_TRUE;
index 4899859e7cc37aede0d473720b75614ea88a4f31..ef039e3c469bef128864e7146a7dab48730c02dd 100644 (file)
@@ -2,7 +2,7 @@
  * waveout.c : Windows waveOut plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: waveout.c,v 1.24 2003/05/04 22:42:15 gbazin Exp $
+ * $Id: waveout.c,v 1.25 2003/05/21 15:54:08 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *      
@@ -392,6 +392,14 @@ static void Probe( aout_instance_t * p_aout )
         }
     }
 
+    var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
+    if( val.i_int <= 0 )
+    {
+        /* Probe() has failed. */
+        var_Destroy( p_aout, "audio-device" );
+        return;
+    }
+
     var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart, NULL );
 
     val.b_bool = VLC_TRUE;