mixer_plugin: use GError for error handling
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#ifndef MPD_MIXER_PLUGIN_H
|
||||
#define MPD_MIXER_PLUGIN_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user