Commit 1351dcd2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

auhal: keep last used audio device throughout sessions (close #8277)

if the device was unplugged in the meantime, VLC will fallback on the default system device
parent 37d01f73
...@@ -64,6 +64,9 @@ ...@@ -64,6 +64,9 @@
#define VOLUME_TEXT N_("Audio volume") #define VOLUME_TEXT N_("Audio volume")
#define VOLUME_LONGTEXT VOLUME_TEXT #define VOLUME_LONGTEXT VOLUME_TEXT
#define DEVICE_TEXT N_("Last audio device")
#define DEVICE_LONGTEXT DEVICE_TEXT
/***************************************************************************** /*****************************************************************************
* aout_sys_t: private audio output method descriptor * aout_sys_t: private audio output method descriptor
***************************************************************************** *****************************************************************************
...@@ -161,6 +164,7 @@ vlc_module_begin () ...@@ -161,6 +164,7 @@ vlc_module_begin ()
add_integer("auhal-volume", AOUT_VOLUME_DEFAULT, add_integer("auhal-volume", AOUT_VOLUME_DEFAULT,
VOLUME_TEXT, VOLUME_LONGTEXT, true) VOLUME_TEXT, VOLUME_LONGTEXT, true)
change_integer_range(0, AOUT_VOLUME_MAX) change_integer_range(0, AOUT_VOLUME_MAX)
add_string("auhal-audio-device", "", DEVICE_TEXT, DEVICE_LONGTEXT, true)
add_obsolete_integer("macosx-audio-device") /* since 2.1.0 */ add_obsolete_integer("macosx-audio-device") /* since 2.1.0 */
vlc_module_end () vlc_module_end ()
...@@ -192,6 +196,8 @@ static int Open(vlc_object_t *obj) ...@@ -192,6 +196,8 @@ static int Open(vlc_object_t *obj)
aout_VolumeReport(aout, var_InheritInteger(aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT); aout_VolumeReport(aout, var_InheritInteger(aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT);
MuteSet(aout, var_InheritBool(aout, "mute")); MuteSet(aout, var_InheritBool(aout, "mute"));
SwitchAudioDevice(aout, config_GetPsz(aout, "auhal-audio-device"));
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -200,6 +206,8 @@ static void Close(vlc_object_t *obj) ...@@ -200,6 +206,8 @@ static void Close(vlc_object_t *obj)
audio_output_t *aout = (audio_output_t *)obj; audio_output_t *aout = (audio_output_t *)obj;
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
config_PutPsz(aout, "auhal-audio-device", aout_DeviceGet(aout));
for (struct audio_device_t * device = sys->devices, *next; device != NULL; device = next) { for (struct audio_device_t * device = sys->devices, *next; device != NULL; device = next) {
next = device->next; next = device->next;
free(device->name); free(device->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment