mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
alsa-sink: Don't assume we were able to enable hw-volume or sync-volume (v1.1)
This patch also disables mixer callback code if we do not have neither HW-volume or HW-mute.
This commit is contained in:
parent
98db3dffb6
commit
aefa94f052
1 changed files with 21 additions and 21 deletions
|
|
@ -1672,8 +1672,6 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_volume) {
|
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_volume) {
|
||||||
int (*mixer_callback)(snd_mixer_elem_t *, unsigned int);
|
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
if (!u->mixer_handle)
|
if (!u->mixer_handle)
|
||||||
|
|
@ -1762,30 +1760,32 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
|
||||||
pa_log_info("Using hardware mute control.");
|
pa_log_info("Using hardware mute control.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sync_volume) {
|
if (u->sink->flags & (PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL)) {
|
||||||
u->mixer_pd = pa_alsa_mixer_pdata_new();
|
int (*mixer_callback)(snd_mixer_elem_t *, unsigned int);
|
||||||
mixer_callback = io_mixer_callback;
|
if (u->sink->flags & PA_SINK_SYNC_VOLUME) {
|
||||||
|
u->mixer_pd = pa_alsa_mixer_pdata_new();
|
||||||
|
mixer_callback = io_mixer_callback;
|
||||||
|
|
||||||
if (pa_alsa_set_mixer_rtpoll(u->mixer_pd, u->mixer_handle, u->rtpoll) < 0) {
|
if (pa_alsa_set_mixer_rtpoll(u->mixer_pd, u->mixer_handle, u->rtpoll) < 0) {
|
||||||
pa_log("Failed to initialize file descriptor monitoring");
|
pa_log("Failed to initialize file descriptor monitoring");
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
u->mixer_fdl = pa_alsa_fdlist_new();
|
||||||
|
mixer_callback = ctl_mixer_callback;
|
||||||
|
|
||||||
|
if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, u->core->mainloop) < 0) {
|
||||||
|
pa_log("Failed to initialize file descriptor monitoring");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if (u->mixer_path_set)
|
||||||
u->mixer_fdl = pa_alsa_fdlist_new();
|
pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
|
||||||
mixer_callback = ctl_mixer_callback;
|
else
|
||||||
|
pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
|
||||||
if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, u->core->mainloop) < 0) {
|
|
||||||
pa_log("Failed to initialize file descriptor monitoring");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->mixer_path_set)
|
|
||||||
pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
|
|
||||||
else
|
|
||||||
pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue