diff options
author | wm4 <wm4@nowhere> | 2016-10-07 17:21:08 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-10-07 17:21:08 +0200 |
commit | b5357e8ba751167832a480ae53d1c54acd1c2f6f (patch) | |
tree | 028d2c360c88af1d4d50eede19e14016485b277c /audio | |
parent | 65c75112a7f0c9c6ad886fc39f97099033733f55 (diff) | |
download | mpv-b5357e8ba751167832a480ae53d1c54acd1c2f6f.tar.bz2 mpv-b5357e8ba751167832a480ae53d1c54acd1c2f6f.tar.xz |
ao_alsa: try to fallback to "hdmi" before "iec958" for spdif
If the "default" device refuses to be opened as spdif device (i.e. it
errors due to the AES0 etc. parameters), we were falling back to the
iec958 device. This is needed on some systems for smooth operation with
PCM vs. spdif.
Now change it to try "hdmi" before "iec958", which supposedly helps in
other situations.
Better suggestions welcome. Apparently kodi does this too, although I
didn't check directly.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_alsa.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 4d879b1565..90250c9855 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -590,11 +590,16 @@ static int try_open_device(struct ao *ao, const char *device, int mode) bstr dev; bstr_split_tok(bstr0(device), ":", &dev, &(bstr){0}); if (bstr_equals0(dev, "default")) { - ac3_device = append_params(tmp, "iec958", params); - MP_VERBOSE(ao, "got error %d; opening iec fallback device '%s'\n", - err, ac3_device); - err = snd_pcm_open - (&p->alsa, ac3_device, SND_PCM_STREAM_PLAYBACK, mode); + const char *const fallbacks[] = {"hdmi", "iec958", NULL}; + for (int n = 0; fallbacks[n]; n++) { + char *ndev = append_params(tmp, fallbacks[n], params); + MP_VERBOSE(ao, "got error %d; opening iec fallback " + "device '%s'\n", err, ndev); + err = snd_pcm_open + (&p->alsa, ndev, SND_PCM_STREAM_PLAYBACK, mode); + if (err >= 0) + break; + } } } talloc_free(tmp); |