aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_init.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-26 22:04:59 +0100
committerMax Kellermann <max@duempel.org>2009-02-26 22:04:59 +0100
commitec926539a3a7a09b310e74a4fc84902e0971b29d (patch)
tree9ce6a1c94f45bc740648b3b4995375844a02ccf0 /src/output_init.c
parent353ae5e558c2dbdc7f9e148a14d8ffa0431e88de (diff)
downloadmpd-ec926539a3a7a09b310e74a4fc84902e0971b29d.tar.gz
mpd-ec926539a3a7a09b310e74a4fc84902e0971b29d.tar.xz
mpd-ec926539a3a7a09b310e74a4fc84902e0971b29d.zip
output_plugin: report errors with GError
Use GLib's GError library for reporting output device failures. Note that some init() methods don't clean up properly after a failure, but that's ok for now, because the MPD core will abort anyway.
Diffstat (limited to 'src/output_init.c')
-rw-r--r--src/output_init.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/output_init.c b/src/output_init.c
index ab26e76ef..004b73e84 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -48,6 +48,7 @@ audio_output_init(struct audio_output *ao, const struct config_param *param)
char *format = NULL;
struct block_param *bp = NULL;
const struct audio_output_plugin *plugin = NULL;
+ GError *error = NULL;
if (param) {
const char *type = NULL;
@@ -97,7 +98,6 @@ audio_output_init(struct audio_output *ao, const struct config_param *param)
pcm_convert_init(&ao->convert_state);
if (format) {
- GError *error = NULL;
bool ret;
ret = audio_format_parse(&ao->config_audio_format, format,
@@ -114,9 +114,14 @@ audio_output_init(struct audio_output *ao, const struct config_param *param)
ao->data = ao_plugin_init(plugin,
format ? &ao->config_audio_format : NULL,
- param);
- if (ao->data == NULL)
+ param, &error);
+ if (ao->data == NULL) {
+ g_warning("Failed to initialize \"%s\" [%s]: %s",
+ ao->name, ao->plugin->name,
+ error->message);
+ g_error_free(error);
return false;
+ }
return true;
}