[vlc-commits] ALSA: remove variable callback (refs #5273)

Rémi Denis-Courmont git at videolan.org
Sun Oct 2 14:46:04 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct  2 15:44:49 2011 +0300| [90cce4e05af1412c1d7b7c2b92c5f7028afc3dfc] | committer: Rémi Denis-Courmont

ALSA: remove variable callback (refs #5273)

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

 modules/audio_output/alsa.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 00f8f54..f2df6cc 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -147,18 +147,17 @@ static void DumpDeviceStatus (vlc_object_t *obj, snd_pcm_t *pcm)
 static void Probe (vlc_object_t *obj)
 {
     /* Due to design bug in audio output core, this hack is required: */
-    if (var_Type (obj, "audio-device"))
-        return;
-
-    /* The variable does not exist - first call. */
-    vlc_value_t text;
-
-    var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
-    text.psz_string = _("Audio Device");
-    var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL);
+    if (var_Type (obj, "audio-device") == 0)
+    {
+        /* The variable does not exist - first call. */
+        vlc_value_t text;
 
-    GetDevices (obj, NULL);
+        var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
+        text.psz_string = _("Audio Device");
+        var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL);
 
+        GetDevices (obj, NULL);
+    }
     var_AddCallback (obj, "audio-device", aout_ChannelsRestart, NULL);
     var_TriggerCallback (obj, "intf-change");
 }
@@ -697,6 +696,7 @@ static void Close (vlc_object_t *obj)
     aout_sys_t *sys = aout->sys;
     snd_pcm_t *pcm = aout->sys->pcm;
 
+    var_DelCallback (obj, "audio-device", aout_ChannelsRestart, NULL);
     snd_pcm_drop (pcm);
     snd_pcm_close (pcm);
     free (sys);



More information about the vlc-commits mailing list