aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-16 01:39:00 +0100
committerMax Kellermann <max@duempel.org>2009-02-16 01:39:00 +0100
commit37bc31d161d486d0499cf64123b7561f57dd0c53 (patch)
tree54cb688aecd4f30f1afbf0f4d87d48a7abbe4fba /src/audio.c
parent79b50b7d9c2ef84e0b74345a31a9b2f96d2690cd (diff)
downloadmpd-37bc31d161d486d0499cf64123b7561f57dd0c53.tar.gz
mpd-37bc31d161d486d0499cf64123b7561f57dd0c53.tar.xz
mpd-37bc31d161d486d0499cf64123b7561f57dd0c53.zip
output_plugin: replaced method "control()" with "mixer()"
The output plugin shouldn't know any specifics of the mixer API. Make it return the mixer object, and let the caller deal with it.
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/audio.c b/src/audio.c
index 47916a5f7..e5b043962 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -62,15 +62,17 @@ void finishAudioConfig(void)
bool mixer_control_setvol(unsigned int device, int volume, int rel)
{
struct audio_output *output;
+ struct mixer *mixer;
if (device >= audio_output_count())
return false;
output = audio_output_get(device);
- if (output->plugin && output->plugin->control) {
+ mixer = ao_plugin_get_mixer(output->plugin, output->data);
+ if (mixer != NULL) {
if (rel) {
int cur_volume;
- if (!output->plugin->control(output->data, AC_MIXER_GETVOL, &cur_volume)) {
+ if (!mixer_control(mixer, AC_MIXER_GETVOL, &cur_volume)) {
return false;
}
volume = volume + cur_volume;
@@ -80,7 +82,7 @@ bool mixer_control_setvol(unsigned int device, int volume, int rel)
else if (volume < 0)
volume = 0;
- return output->plugin->control(output->data, AC_MIXER_SETVOL, &volume);
+ return mixer_control(mixer, AC_MIXER_SETVOL, &volume);
}
return false;
}
@@ -88,13 +90,15 @@ bool mixer_control_setvol(unsigned int device, int volume, int rel)
bool mixer_control_getvol(unsigned int device, int *volume)
{
struct audio_output *output;
+ struct mixer *mixer;
if (device >= audio_output_count())
return false;
output = audio_output_get(device);
- if (output->plugin && output->plugin->control) {
- return output->plugin->control(output->data, AC_MIXER_GETVOL, volume);
- }
+ mixer = ao_plugin_get_mixer(output->plugin, output->data);
+ if (mixer != NULL)
+ return mixer_control(mixer, AC_MIXER_GETVOL, volume);
+
return false;
}