aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_api.c
diff options
context:
space:
mode:
authorViliam Mateicka <viliam.mateicka@gmail.com>2009-01-10 17:53:33 +0100
committerMax Kellermann <max@duempel.org>2009-01-10 17:55:38 +0100
commit11c29cccb3409fb4d0fea5171a56230253583864 (patch)
tree6ab080de10e9f0d3c4acf48b24815689f9fc4be5 /src/mixer_api.c
parent8ebe7bfb250f2b1048d6e7f6c2477717daaad8e9 (diff)
downloadmpd-11c29cccb3409fb4d0fea5171a56230253583864.tar.gz
mpd-11c29cccb3409fb4d0fea5171a56230253583864.tar.xz
mpd-11c29cccb3409fb4d0fea5171a56230253583864.zip
Introducing mixer api
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in alsa and oss output plugin
Diffstat (limited to '')
-rw-r--r--src/mixer_api.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mixer_api.c b/src/mixer_api.c
new file mode 100644
index 000000000..f77f764cf
--- /dev/null
+++ b/src/mixer_api.c
@@ -0,0 +1,45 @@
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "mixer_api.h"
+
+void mixer_init(struct mixer *mixer, struct mixer_plugin *plugin)
+{
+ assert(plugin != NULL);
+ assert(mixer != NULL);
+ mixer->plugin = plugin;
+ mixer->data = mixer->plugin->init();
+}
+
+void mixer_finish(struct mixer *mixer)
+{
+ assert(mixer != NULL && mixer->plugin != NULL);
+ mixer->plugin->finish(mixer->data);
+ mixer->data = NULL;
+ mixer->plugin = NULL;
+}
+
+void mixer_configure(struct mixer *mixer, ConfigParam *param)
+{
+ assert(mixer != NULL && mixer->plugin != NULL);
+ mixer->plugin->configure(mixer->data, param);
+}
+
+bool mixer_open(struct mixer *mixer)
+{
+ assert(mixer != NULL && mixer->plugin != NULL);
+ return mixer->plugin->open(mixer->data);
+}
+
+bool mixer_control(struct mixer *mixer, int cmd, void *arg)
+{
+ assert(mixer != NULL && mixer->plugin != NULL);
+ return mixer->plugin->control(mixer->data, cmd, arg);
+}
+
+void mixer_close(struct mixer *mixer)
+{
+ assert(mixer != NULL && mixer->plugin != NULL);
+ mixer->plugin->close(mixer->data);
+}