aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_all.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-20 22:10:56 +0200
committerMax Kellermann <max@duempel.org>2009-10-20 22:10:56 +0200
commit4e2fb3fb89b8b80d5366466f391f21386120019e (patch)
treeb483ed23c73afbbefcba86c1ce0d2b8c4afa824b /src/mixer_all.c
parent9cd2129eeb22280836e87bfa12389adf4ddb2488 (diff)
downloadmpd-4e2fb3fb89b8b80d5366466f391f21386120019e.tar.gz
mpd-4e2fb3fb89b8b80d5366466f391f21386120019e.tar.xz
mpd-4e2fb3fb89b8b80d5366466f391f21386120019e.zip
mixer_plugin: use GError for error handling
Diffstat (limited to 'src/mixer_all.c')
-rw-r--r--src/mixer_all.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/mixer_all.c b/src/mixer_all.c
index cd05eec85..b9c1afdad 100644
--- a/src/mixer_all.c
+++ b/src/mixer_all.c
@@ -38,6 +38,8 @@ output_mixer_get_volume(unsigned i)
{
struct audio_output *output;
struct mixer *mixer;
+ int volume;
+ GError *error = NULL;
assert(i < audio_output_count());
@@ -49,7 +51,14 @@ output_mixer_get_volume(unsigned i)
if (mixer == NULL)
return -1;
- return mixer_get_volume(mixer);
+ volume = mixer_get_volume(mixer, &error);
+ if (volume < 0 && error != NULL) {
+ g_warning("Failed to read mixer for '%s': %s",
+ output->name, error->message);
+ g_error_free(error);
+ }
+
+ return volume;
}
int
@@ -77,6 +86,8 @@ output_mixer_set_volume(unsigned i, unsigned volume)
{
struct audio_output *output;
struct mixer *mixer;
+ bool success;
+ GError *error = NULL;
assert(i < audio_output_count());
assert(volume <= 100);
@@ -89,7 +100,14 @@ output_mixer_set_volume(unsigned i, unsigned volume)
if (mixer == NULL)
return false;
- return mixer_set_volume(mixer, volume);
+ success = mixer_set_volume(mixer, volume, &error);
+ if (!success && error != NULL) {
+ g_warning("Failed to set mixer for '%s': %s",
+ output->name, error->message);
+ g_error_free(error);
+ }
+
+ return success;
}
bool
@@ -123,7 +141,7 @@ output_mixer_get_software_volume(unsigned i)
if (mixer == NULL || mixer->plugin != &software_mixer_plugin)
return -1;
- return mixer_get_volume(mixer);
+ return mixer_get_volume(mixer, NULL);
}
int
@@ -157,6 +175,6 @@ mixer_all_set_software_volume(unsigned volume)
struct audio_output *output = audio_output_get(i);
if (output->mixer != NULL &&
output->mixer->plugin == &software_mixer_plugin)
- mixer_set_volume(output->mixer, volume);
+ mixer_set_volume(output->mixer, volume, NULL);
}
}