mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 23:00:41 +00:00
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.
This commit is contained in:
parent
65c75112a7
commit
b5357e8ba7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user