diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2017-02-20 22:46:48 -0800 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2017-02-20 22:56:30 -0800 |
commit | df30b217d9551749e02373b66bddd2f8787223cf (patch) | |
tree | 668294b876f32cd7d69447160bb7c2c7c5ecefc5 /audio | |
parent | fffab30a3ef01dc6f34adadccb05617f4a3a528e (diff) | |
download | mpv-df30b217d9551749e02373b66bddd2f8787223cf.tar.bz2 mpv-df30b217d9551749e02373b66bddd2f8787223cf.tar.xz |
ao: never set ao->device = ""
For example, previously, --audio-device='alsa/' would provide ao->device="" to
the alsa driver in spite of the fact that this is an already parsed option. To
avoid requiring a check of ao->device[0] in every driver, make sure this never
happens.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c index e643945ec7..32140b2b34 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -245,9 +245,10 @@ static void split_ao_device(void *tmp, char *opt, char **out_ao, char **out_dev) return; if (!opt[0] || strcmp(opt, "auto") == 0) return; - // Split on "/". If there's no "/", leave out_device NULL. + // Split on "/". If "/" is the final character, or absent, out_dev is NULL. bstr b_dev, b_ao; - if (bstr_split_tok(bstr0(opt), "/", &b_ao, &b_dev)) + bstr_split_tok(bstr0(opt), "/", &b_ao, &b_dev); + if (b_dev.len > 0) *out_dev = bstrto0(tmp, b_dev); *out_ao = bstrto0(tmp, b_ao); } |