mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-29 08:33:23 -05:00
Fallback to the Master mixer element if PCM is not available
When using PulseAudio through ALSA, the mixer doesn't have a PCM element; fallback to Master in this case.
This commit is contained in:
parent
791a2770f0
commit
204a756283
@ -410,6 +410,8 @@ static int
|
|||||||
mixer_open(void)
|
mixer_open(void)
|
||||||
{
|
{
|
||||||
snd_mixer_elem_t *elem;
|
snd_mixer_elem_t *elem;
|
||||||
|
snd_mixer_elem_t *master;
|
||||||
|
snd_mixer_elem_t *pcm;
|
||||||
snd_mixer_selem_id_t *sid;
|
snd_mixer_selem_id_t *sid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -449,17 +451,25 @@ mixer_open(void)
|
|||||||
/* Grab interesting elements */
|
/* Grab interesting elements */
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
|
|
||||||
|
pcm = NULL;
|
||||||
|
master = NULL;
|
||||||
for (elem = snd_mixer_first_elem(mixer_hdl); elem; elem = snd_mixer_elem_next(elem))
|
for (elem = snd_mixer_first_elem(mixer_hdl); elem; elem = snd_mixer_elem_next(elem))
|
||||||
{
|
{
|
||||||
snd_mixer_selem_get_id(elem, sid);
|
snd_mixer_selem_get_id(elem, sid);
|
||||||
|
|
||||||
if (strcmp(snd_mixer_selem_id_get_name(sid), "PCM") == 0)
|
if (strcmp(snd_mixer_selem_id_get_name(sid), "PCM") == 0)
|
||||||
vol_elem = elem;
|
pcm = elem;
|
||||||
|
else if (strcmp(snd_mixer_selem_id_get_name(sid), "Master") == 0)
|
||||||
|
master = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vol_elem)
|
if (pcm)
|
||||||
|
vol_elem = pcm;
|
||||||
|
else if (master)
|
||||||
|
vol_elem = master;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_LAUDIO, "Failed to open PCM mixer element\n");
|
DPRINTF(E_LOG, L_LAUDIO, "Failed to open PCM or Master mixer element\n");
|
||||||
|
|
||||||
goto out_detach;
|
goto out_detach;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user