mirror of https://github.com/mpv-player/mpv
ao_alsa: fix setting mono channel map
When setting the ALSA channel map, we never actually set the map we got from ALSA directly, but convert it to mpv's, and then back to ALSA's. mpv and ALSA use different conventions for mono, and there is already an exception for ALSA->mpv, but not mpv->ALSA.
This commit is contained in:
parent
0dc455eb16
commit
a69f168dff
|
@ -538,6 +538,10 @@ static int init_device(struct ao *ao)
|
||||||
for (int c = 0; c < dev_chmap.num; c++)
|
for (int c = 0; c < dev_chmap.num; c++)
|
||||||
alsa_chmap->pos[c] = find_alsa_channel(dev_chmap.speaker[c]);
|
alsa_chmap->pos[c] = find_alsa_channel(dev_chmap.speaker[c]);
|
||||||
|
|
||||||
|
// mpv and ALSA use different conventions for mono
|
||||||
|
if (dev_chmap.num == 1 && dev_chmap.speaker[0] == MP_SP(FC))
|
||||||
|
alsa_chmap->pos[0] = SND_CHMAP_MONO;
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
if (snd_pcm_chmap_print(alsa_chmap, sizeof(tmp), tmp) > 0)
|
if (snd_pcm_chmap_print(alsa_chmap, sizeof(tmp), tmp) > 0)
|
||||||
MP_VERBOSE(ao, "trying to set ALSA channel map: %s\n", tmp);
|
MP_VERBOSE(ao, "trying to set ALSA channel map: %s\n", tmp);
|
||||||
|
@ -603,6 +607,7 @@ static int init_device(struct ao *ao)
|
||||||
MP_WARN(ao, "Got unknown channel map from ALSA.\n");
|
MP_WARN(ao, "Got unknown channel map from ALSA.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mpv and ALSA use different conventions for mono
|
||||||
if (ao->channels.num == 1)
|
if (ao->channels.num == 1)
|
||||||
ao->channels.speaker[0] = MP_SP(FC);
|
ao->channels.speaker[0] = MP_SP(FC);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue