From 4e2fb3fb89b8b80d5366466f391f21386120019e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 20 Oct 2009 22:10:56 +0200 Subject: mixer_plugin: use GError for error handling --- src/mixer_plugin.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/mixer_plugin.h') diff --git a/src/mixer_plugin.h b/src/mixer_plugin.h index 2b9b440e5..f3f70e2ef 100644 --- a/src/mixer_plugin.h +++ b/src/mixer_plugin.h @@ -27,6 +27,8 @@ #ifndef MPD_MIXER_PLUGIN_H #define MPD_MIXER_PLUGIN_H +#include + #include struct config_param; @@ -35,8 +37,13 @@ struct mixer; struct mixer_plugin { /** * Alocates and configures a mixer device. + * + * @param error_r location to store the error occuring, or + * NULL to ignore errors + * @return a mixer object, or NULL on error */ - struct mixer *(*init)(const struct config_param *param); + struct mixer *(*init)(const struct config_param *param, + GError **error_r); /** * Finish and free mixer data @@ -45,8 +52,12 @@ struct mixer_plugin { /** * Open mixer device + * + * @param error_r location to store the error occuring, or + * NULL to ignore errors + * @return true on success, false on error */ - bool (*open)(struct mixer *data); + bool (*open)(struct mixer *data, GError **error_r); /** * Close mixer device @@ -56,18 +67,23 @@ struct mixer_plugin { /** * Reads the current volume. * + * @param error_r location to store the error occuring, or + * NULL to ignore errors * @return the current volume (0..100 including) or -1 on * error */ - int (*get_volume)(struct mixer *mixer); + int (*get_volume)(struct mixer *mixer, GError **error_r); /** * Sets the volume. * + * @param error_r location to store the error occuring, or + * NULL to ignore errors * @param volume the new volume (0..100 including) - * @return true on success + * @return true on success, false on error */ - bool (*set_volume)(struct mixer *mixer, unsigned volume); + bool (*set_volume)(struct mixer *mixer, unsigned volume, + GError **error_r); /** * If true, then the mixer is automatically opened, even if -- cgit v1.2.3