[vlc-commits] auhal: keep last used audio device throughout sessions (close #8277)
Felix Paul Kühne
git at videolan.org
Sat Mar 9 22:15:45 CET 2013
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Mar 9 22:14:51 2013 +0100| [1351dcd2c0cf298673b265c909ac2154f75c3279] | committer: 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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1351dcd2c0cf298673b265c909ac2154f75c3279
---
modules/audio_output/auhal.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 519b084..70020aa 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -64,6 +64,9 @@
#define VOLUME_TEXT N_("Audio volume")
#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
*****************************************************************************
@@ -161,6 +164,7 @@ vlc_module_begin ()
add_integer("auhal-volume", AOUT_VOLUME_DEFAULT,
VOLUME_TEXT, VOLUME_LONGTEXT, true)
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 */
vlc_module_end ()
@@ -192,6 +196,8 @@ static int Open(vlc_object_t *obj)
aout_VolumeReport(aout, var_InheritInteger(aout, "auhal-volume") / (float)AOUT_VOLUME_DEFAULT);
MuteSet(aout, var_InheritBool(aout, "mute"));
+ SwitchAudioDevice(aout, config_GetPsz(aout, "auhal-audio-device"));
+
return VLC_SUCCESS;
}
@@ -200,6 +206,8 @@ static void Close(vlc_object_t *obj)
audio_output_t *aout = (audio_output_t *)obj;
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) {
next = device->next;
free(device->name);
More information about the vlc-commits
mailing list