summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-11-14 13:33:53 +0100
committerwm4 <wm4@nowhere>2016-11-14 13:33:53 +0100
commit84513ba58bcbcf6dfb17eb1ae6b7d2e6a1d7bb4b (patch)
treefaa67f3cf138bda596b4af35634227e7edb816ea /audio/out
parentcf85191cb7322b9cfeda3a872ef22e6df4f97860 (diff)
downloadmpv-84513ba58bcbcf6dfb17eb1ae6b7d2e6a1d7bb4b.tar.bz2
mpv-84513ba58bcbcf6dfb17eb1ae6b7d2e6a1d7bb4b.tar.xz
audio: avoid returning audio-device-list entries without description
Use the device name as fallback. This is ugly, but still better than skipping the description entirely. This can be an issue on ALSA, where the API can return entries without proper description.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index e1a3eda9dd..9846869f2c 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -599,6 +599,8 @@ void ao_device_list_add(struct ao_device_list *list, struct ao *ao,
{
struct ao_device_desc c = *e;
const char *dname = ao->driver->name;
+ if ((!c.desc || !c.desc[0]) && c.name)
+ c.desc = c.name;
c.name = c.name[0] ? talloc_asprintf(list, "%s/%s", dname, c.name)
: talloc_strdup(list, dname);
c.desc = talloc_strdup(list, c.desc);