diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-02-03 00:28:54 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-02-03 00:40:02 +0100 |
commit | de4f9977528e454c44f980a4364ecd18d3219c62 (patch) | |
tree | 323c54565b1ead914d59a4826f09b8cecccef91c /audio/out/ao_coreaudio.c | |
parent | a3be14683a33211e3e07094246bb3342fc789763 (diff) | |
download | mpv-de4f9977528e454c44f980a4364ecd18d3219c62.tar.bz2 mpv-de4f9977528e454c44f980a4364ecd18d3219c62.tar.xz |
ao_coreaudio: use device UID instead of ID for selection
Previously we let the user use the audio device ID, but this is not persistent
and can change when plugging in new devices. That of course made it quite
worthless for storing it as a user setting for GUIs, or for user scripts.
In theory getting the kAudioDevicePropertyDeviceUID can fail but it doesn't
on any of my devices, so I'm leaving the error reporting quite high and see if
someone complains.
Diffstat (limited to 'audio/out/ao_coreaudio.c')
-rw-r--r-- | audio/out/ao_coreaudio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index 590549bd1a..0eab220421 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -156,7 +156,10 @@ static int init(struct ao *ao) OSStatus err = ca_select_device(ao, ao->device, &p->device); CHECK_CA_ERROR("failed to select device"); - ao->detected_device = talloc_asprintf(ao, "%d", p->device); + char *uid; + err = CA_GET_STR(p->device, kAudioDevicePropertyDeviceUID, &uid); + CHECK_CA_ERROR("failed to get device UID"); + ao->detected_device = talloc_steal(ao, uid); if (!init_chmap(ao)) goto coreaudio_error; |