mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
sink, source: Assign to s->muted from only one place
Forcing all mute changes to go through set_mute() makes it easier to check where the muted field is changed, and it also allows us to have only one place where notifications for changed mute are sent.
This commit is contained in:
parent
dbd2a8f851
commit
e4a7625ba8
7 changed files with 87 additions and 64 deletions
|
|
@ -1277,18 +1277,17 @@ static void source_write_volume_cb(pa_source *s) {
|
|||
}
|
||||
}
|
||||
|
||||
static void source_get_mute_cb(pa_source *s) {
|
||||
static int source_get_mute_cb(pa_source *s, bool *mute) {
|
||||
struct userdata *u = s->userdata;
|
||||
bool b;
|
||||
|
||||
pa_assert(u);
|
||||
pa_assert(u->mixer_path);
|
||||
pa_assert(u->mixer_handle);
|
||||
|
||||
if (pa_alsa_path_get_mute(u->mixer_path, u->mixer_handle, &b) < 0)
|
||||
return;
|
||||
if (pa_alsa_path_get_mute(u->mixer_path, u->mixer_handle, mute) < 0)
|
||||
return -1;
|
||||
|
||||
s->muted = b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void source_set_mute_cb(pa_source *s) {
|
||||
|
|
@ -2088,8 +2087,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
|
|||
if (u->source->set_mute)
|
||||
u->source->set_mute(u->source);
|
||||
} else {
|
||||
if (u->source->get_mute)
|
||||
u->source->get_mute(u->source);
|
||||
if (u->source->get_mute) {
|
||||
bool mute;
|
||||
|
||||
if (u->source->get_mute(u->source, &mute) >= 0)
|
||||
pa_source_set_mute(u->source, mute, false);
|
||||
}
|
||||
}
|
||||
|
||||
if ((data.volume_is_set || data.muted_is_set) && u->source->write_volume)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue