diff options
author | Viliam Mateicka <viliam.mateicka@gmail.com> | 2009-03-02 18:39:43 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-02 18:57:49 +0100 |
commit | 406b0403a5767387121875ab4b99de467492415f (patch) | |
tree | c136aa6cacd9f99d1456d3ae716e50e1a64c1cd1 /src/mixer_api.c | |
parent | 2f438e5d238840b96414079d17f1b56ab1fba9a5 (diff) | |
download | mpd-406b0403a5767387121875ab4b99de467492415f.tar.gz mpd-406b0403a5767387121875ab4b99de467492415f.tar.xz mpd-406b0403a5767387121875ab4b99de467492415f.zip |
mixer: adding code to optionally disable all hw mixers
Diffstat (limited to '')
-rw-r--r-- | src/mixer_api.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/mixer_api.c b/src/mixer_api.c index ec621950c..9dc3e3b09 100644 --- a/src/mixer_api.c +++ b/src/mixer_api.c @@ -19,13 +19,30 @@ #include <stdio.h> #include <assert.h> +#include <glib.h> + #include "mixer_api.h" +#undef G_LOG_DOMAIN +#define G_LOG_DOMAIN "mixer" + +static bool mixers_enabled = true; + +void mixer_disable_all(void) +{ + g_debug("mixer api is disabled\n"); + mixers_enabled = false; +} + struct mixer * mixer_new(const struct mixer_plugin *plugin, const struct config_param *param) { struct mixer *mixer; + //mixers are disabled (by using software volume) + if (!mixers_enabled) { + return NULL; + } assert(plugin != NULL); mixer = plugin->init(param); @@ -38,7 +55,9 @@ mixer_new(const struct mixer_plugin *plugin, const struct config_param *param) void mixer_free(struct mixer *mixer) { - assert(mixer != NULL); + if (!mixer) { + return; + } assert(mixer->plugin != NULL); mixer->plugin->finish(mixer); @@ -46,12 +65,18 @@ mixer_free(struct mixer *mixer) bool mixer_open(struct mixer *mixer) { - assert(mixer != NULL && mixer->plugin != NULL); + if (!mixer) { + return false; + } + assert(mixer->plugin != NULL); return mixer->plugin->open(mixer); } void mixer_close(struct mixer *mixer) { - assert(mixer != NULL && mixer->plugin != NULL); + if (!mixer) { + return; + } + assert(mixer->plugin != NULL); mixer->plugin->close(mixer); } |