aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
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/output
parent9cd2129eeb22280836e87bfa12389adf4ddb2488 (diff)
downloadmpd-4e2fb3fb89b8b80d5366466f391f21386120019e.tar.gz
mpd-4e2fb3fb89b8b80d5366466f391f21386120019e.tar.xz
mpd-4e2fb3fb89b8b80d5366466f391f21386120019e.zip
mixer_plugin: use GError for error handling
Diffstat (limited to '')
-rw-r--r--src/output_control.c11
-rw-r--r--src/output_init.c15
2 files changed, 20 insertions, 6 deletions
diff --git a/src/output_control.c b/src/output_control.c
index ef77bf4fa..b833fb08d 100644
--- a/src/output_control.c
+++ b/src/output_control.c
@@ -102,8 +102,15 @@ audio_output_open(struct audio_output *ao,
ao_command(ao, ao->open ? AO_COMMAND_REOPEN : AO_COMMAND_OPEN);
open = ao->open;
- if (open && ao->mixer != NULL)
- mixer_open(ao->mixer);
+ if (open && ao->mixer != NULL) {
+ GError *error = NULL;
+
+ if (!mixer_open(ao->mixer, &error)) {
+ g_warning("Failed to open mixer for '%s': %s",
+ ao->name, error->message);
+ g_error_free(error);
+ }
+ }
return open;
}
diff --git a/src/output_init.c b/src/output_init.c
index b139ec0fd..a628a2499 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -91,7 +91,8 @@ audio_output_mixer_type(const struct config_param *param)
static struct mixer *
audio_output_load_mixer(const struct config_param *param,
const struct mixer_plugin *plugin,
- struct filter *filter_chain)
+ struct filter *filter_chain,
+ GError **error_r)
{
struct mixer *mixer;
@@ -104,10 +105,10 @@ audio_output_load_mixer(const struct config_param *param,
if (plugin == NULL)
return NULL;
- return mixer_new(plugin, param);
+ return mixer_new(plugin, param, error_r);
case MIXER_TYPE_SOFTWARE:
- mixer = mixer_new(&software_mixer_plugin, NULL);
+ mixer = mixer_new(&software_mixer_plugin, NULL, NULL);
assert(mixer != NULL);
filter_chain_append(filter_chain,
@@ -124,6 +125,7 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
GError **error_r)
{
const struct audio_output_plugin *plugin = NULL;
+ GError *error = NULL;
if (param) {
const char *p;
@@ -199,7 +201,12 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
return false;
ao->mixer = audio_output_load_mixer(param, plugin->mixer_plugin,
- ao->filter);
+ ao->filter, &error);
+ if (ao->mixer == NULL && error != NULL) {
+ g_warning("Failed to initialize hardware mixer for '%s': %s",
+ ao->name, error->message);
+ g_error_free(error);
+ }
/* the "convert" filter must be the last one in the chain */