]> git.sesse.net Git - vlc/commitdiff
aout: remove temporary hack on the "device" variable
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 14 Jan 2013 17:31:16 +0000 (19:31 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 14 Jan 2013 17:31:59 +0000 (19:31 +0200)
src/audio_output/output.c

index 7c51cb3f65434b63d42f8c905c5e6cb1366b37dc..a0137f8b023630a42d15ced67ed12eecf10a4460 100644 (file)
@@ -44,23 +44,6 @@ static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev,
     return var_Set (dst, name, value);
 }
 
-static int aout_DeviceSelect (vlc_object_t *obj, const char *varname,
-                              vlc_value_t prev, vlc_value_t value, void *data)
-{
-    audio_output_t *aout = (audio_output_t *)obj;
-    int ret = 0; /* FIXME: default value should be -1 */
-
-    msg_Dbg (aout, "changing device: %s -> %s", prev.psz_string,
-             value.psz_string);
-    aout_lock (aout);
-    if (aout->device_select != NULL)
-        ret = aout->device_select (aout, value.psz_string);
-    aout_unlock (aout);
-
-    (void) varname; (void) data;
-    return ret ? VLC_EGENERIC : VLC_SUCCESS;
-}
-
 /**
  * Supply or update the current custom ("hardware") volume.
  * @note This only makes sense after calling aout_VolumeHardInit().
@@ -88,19 +71,7 @@ static void aout_PolicyNotify (audio_output_t *aout, bool cork)
 
 static void aout_DeviceNotify (audio_output_t *aout, const char *id)
 {
-    vlc_value_t val;
-
-    val.psz_string = (char *)id;
-    var_Change (aout, "device", VLC_VAR_SETVALUE, &val, NULL);
-
-    /* FIXME: Remove this hack. Needed if device is not in the list. */
-    char *tmp = var_GetNonEmptyString (aout, "device");
-    if (tmp == NULL || strcmp (tmp, id))
-    {
-        var_Change (aout, "device", VLC_VAR_ADDCHOICE, &val, &val);
-        var_Change (aout, "device", VLC_VAR_SETVALUE, &val, NULL);
-    }
-    free (tmp);
+    var_SetString (aout, "device", (id != NULL) ? id : "");
 }
 
 static void aout_RestartNotify (audio_output_t *aout, unsigned mode)
@@ -144,7 +115,6 @@ audio_output_t *aout_New (vlc_object_t *parent)
     var_Create (aout, "device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
     text.psz_string = _("Audio Device");
     var_Change (aout, "device", VLC_VAR_SETTEXT, &text, NULL);
-    var_AddCallback (aout, "device", aout_DeviceSelect, NULL);
 
     aout->event.volume_report = aout_VolumeNotify;
     aout->event.mute_report = aout_MuteNotify;
@@ -299,7 +269,6 @@ void aout_Destroy (audio_output_t *aout)
     aout->mute_set = NULL;
     aout_unlock (aout);
 
-    var_DelCallback (aout, "device", aout_DeviceSelect, NULL);
     var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
     var_SetFloat (aout, "volume", -1.f);
     var_DelCallback (aout, "volume", var_Copy, aout->p_parent);