[vlc-commits] auhal: do proper deinitialization when device changes

David Fuhrmann git at videolan.org
Mon Apr 22 22:15:32 CEST 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Apr 22 21:48:32 2013 +0200| [94dca03600b3260cf3c2c262ce9eb4731176b154] | committer: David Fuhrmann

auhal: do proper deinitialization when device changes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=94dca03600b3260cf3c2c262ce9eb4731176b154
---

 modules/audio_output/auhal.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index fbbb9fe..f90be9e 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -79,6 +79,7 @@ struct aout_sys_t
 {
     AudioObjectID               i_default_dev;      /* DeviceID of defaultOutputDevice */
     AudioObjectID               i_selected_dev;     /* DeviceID of the selected device */
+    AudioObjectID               i_new_selected_dev; /* DeviceID of device which will be selected on start */
     bool                        b_selected_dev_is_digital;
     AudioDeviceIOProcID         i_procID;           /* DeviceID of current device */
     bool                        b_digital;          /* Are we running in digital mode? */
@@ -255,6 +256,8 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
     p_sys->b_changed_mixing = false;
     p_sys->i_bytes_per_sample = 0;
 
+    p_sys->i_selected_dev = p_sys->i_new_selected_dev;
+
     aout_FormatPrint(p_aout, "VLC is looking for:", fmt);
 
     msg_Dbg(p_aout, "attempting to use device %i", p_sys->i_selected_dev);
@@ -1071,17 +1074,17 @@ static int SwitchAudioDevice(audio_output_t *p_aout, const char *name)
     struct aout_sys_t *p_sys = p_aout->sys;
 
     if (name)
-        p_sys->i_selected_dev = atoi(name);
+        p_sys->i_new_selected_dev = atoi(name);
     else
-        p_sys->i_selected_dev = 0;
+        p_sys->i_new_selected_dev = 0;
 
-    bool b_supports_digital = (p_sys->i_selected_dev & AOUT_VAR_SPDIF_FLAG);
+    bool b_supports_digital = (p_sys->i_new_selected_dev & AOUT_VAR_SPDIF_FLAG);
     if (b_supports_digital)
         p_sys->b_selected_dev_is_digital = true;
     else
         p_sys->b_selected_dev_is_digital = false;
 
-    p_sys->i_selected_dev = p_sys->i_selected_dev & ~AOUT_VAR_SPDIF_FLAG;
+    p_sys->i_new_selected_dev = p_sys->i_new_selected_dev & ~AOUT_VAR_SPDIF_FLAG;
 
     aout_DeviceReport(p_aout, name);
     aout_RestartRequest(p_aout, AOUT_RESTART_OUTPUT);



More information about the vlc-commits mailing list