aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer/pulse_mixer_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-17 19:50:36 +0200
committerMax Kellermann <max@duempel.org>2011-09-17 19:50:36 +0200
commit3934d2d30cf97271dc7b33e3b77b101f09f916e7 (patch)
tree5a4370440c19e60f90caa9b050804a37ab3e7e69 /src/mixer/pulse_mixer_plugin.c
parent423ce9557a7d2068292a95ceedc6c57982a231a0 (diff)
downloadmpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.tar.gz
mpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.tar.xz
mpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.zip
output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer plugin.
Diffstat (limited to 'src/mixer/pulse_mixer_plugin.c')
-rw-r--r--src/mixer/pulse_mixer_plugin.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mixer/pulse_mixer_plugin.c b/src/mixer/pulse_mixer_plugin.c
index 8fbba4c5a..a82c032b3 100644
--- a/src/mixer/pulse_mixer_plugin.c
+++ b/src/mixer/pulse_mixer_plugin.c
@@ -191,13 +191,13 @@ pulse_mixer_get_volume(struct mixer *mixer, G_GNUC_UNUSED GError **error_r)
struct pulse_mixer *pm = (struct pulse_mixer *) mixer;
int ret;
- pa_threaded_mainloop_lock(pm->output->mainloop);
+ pulse_output_lock(pm->output);
ret = pm->online
? (int)((100*(pa_cvolume_avg(&pm->volume)+1))/PA_VOLUME_NORM)
: -1;
- pa_threaded_mainloop_unlock(pm->output->mainloop);
+ pulse_output_unlock(pm->output);
return ret;
}
@@ -209,9 +209,10 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
struct pa_cvolume cvolume;
bool success;
- pa_threaded_mainloop_lock(pm->output->mainloop);
+ pulse_output_lock(pm->output);
+
if (!pm->online) {
- pa_threaded_mainloop_unlock(pm->output->mainloop);
+ pulse_output_unlock(pm->output);
g_set_error(error_r, pulse_mixer_quark(), 0, "disconnected");
return false;
}
@@ -221,7 +222,8 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
success = pulse_output_set_volume(pm->output, &cvolume, error_r);
if (success)
pm->volume = cvolume;
- pa_threaded_mainloop_unlock(pm->output->mainloop);
+
+ pulse_output_unlock(pm->output);
return success;
}