aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-23 09:15:51 +0200
committerMax Kellermann <max@duempel.org>2009-10-23 09:15:51 +0200
commitede828c910f546dfe8ca4b07b678e9a2806c6889 (patch)
treed64ebd0c846f87908fc7531b5503f6b5d88b635a /src/mixer_control.c
parent7dd172efecca315cb5dcbf2e27d06f6a72d361d1 (diff)
downloadmpd-ede828c910f546dfe8ca4b07b678e9a2806c6889.tar.gz
mpd-ede828c910f546dfe8ca4b07b678e9a2806c6889.tar.xz
mpd-ede828c910f546dfe8ca4b07b678e9a2806c6889.zip
mixer_control: allow methods "open" and "close" to be NULL
It's possible to have a mixer implementation which does not explicitly need the methods open() and close().
Diffstat (limited to '')
-rw-r--r--src/mixer_control.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mixer_control.c b/src/mixer_control.c
index df1e43003..7def51cb2 100644
--- a/src/mixer_control.c
+++ b/src/mixer_control.c
@@ -66,6 +66,8 @@ mixer_open(struct mixer *mixer, GError **error_r)
if (mixer->open)
success = true;
+ else if (mixer->plugin->open == NULL)
+ success = mixer->open = true;
else
success = mixer->open = mixer->plugin->open(mixer, error_r);
@@ -83,7 +85,9 @@ mixer_close_internal(struct mixer *mixer)
assert(mixer->plugin != NULL);
assert(mixer->open);
- mixer->plugin->close(mixer);
+ if (mixer->plugin->close != NULL)
+ mixer->plugin->close(mixer);
+
mixer->open = false;
}