aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_control.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_control.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_control.c')
-rw-r--r--src/mixer_control.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mixer_control.c b/src/mixer_control.c
index 927a1276c..7ee9fabf0 100644
--- a/src/mixer_control.c
+++ b/src/mixer_control.c
@@ -20,8 +20,6 @@
#include "mixer_control.h"
#include "mixer_api.h"
-#include <glib.h>
-
#include <assert.h>
#include <stddef.h>
@@ -29,13 +27,14 @@
#define G_LOG_DOMAIN "mixer"
struct mixer *
-mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
+mixer_new(const struct mixer_plugin *plugin, const struct config_param *param,
+ GError **error_r)
{
struct mixer *mixer;
assert(plugin != NULL);
- mixer = plugin->init(param);
+ mixer = plugin->init(param, error_r);
assert(mixer == NULL || mixer->plugin == plugin);
@@ -55,7 +54,7 @@ mixer_free(struct mixer *mixer)
}
bool
-mixer_open(struct mixer *mixer)
+mixer_open(struct mixer *mixer, GError **error_r)
{
bool success;
@@ -67,7 +66,7 @@ mixer_open(struct mixer *mixer)
if (mixer->open)
success = true;
else
- success = mixer->open = mixer->plugin->open(mixer);
+ success = mixer->open = mixer->plugin->open(mixer, error_r);
mixer->failed = !success;
@@ -123,19 +122,20 @@ mixer_failed(struct mixer *mixer)
}
int
-mixer_get_volume(struct mixer *mixer)
+mixer_get_volume(struct mixer *mixer, GError **error_r)
{
int volume;
assert(mixer != NULL);
- if (mixer->plugin->global && !mixer->failed && !mixer_open(mixer))
+ if (mixer->plugin->global && !mixer->failed &&
+ !mixer_open(mixer, error_r))
return -1;
g_mutex_lock(mixer->mutex);
if (mixer->open) {
- volume = mixer->plugin->get_volume(mixer);
+ volume = mixer->plugin->get_volume(mixer, error_r);
if (volume < 0)
mixer_failed(mixer);
} else
@@ -147,20 +147,21 @@ mixer_get_volume(struct mixer *mixer)
}
bool
-mixer_set_volume(struct mixer *mixer, unsigned volume)
+mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
{
bool success;
assert(mixer != NULL);
assert(volume <= 100);
- if (mixer->plugin->global && !mixer->failed && !mixer_open(mixer))
+ if (mixer->plugin->global && !mixer->failed &&
+ !mixer_open(mixer, error_r))
return false;
g_mutex_lock(mixer->mutex);
if (mixer->open) {
- success = mixer->plugin->set_volume(mixer, volume);
+ success = mixer->plugin->set_volume(mixer, volume, error_r);
if (!success)
mixer_failed(mixer);
} else