aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer_api.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-25 17:45:16 +0100
committerMax Kellermann <max@duempel.org>2009-01-25 17:45:16 +0100
commit936449c6225624102d0a6cb78f9bb4da84375d60 (patch)
tree790c03c5f7769197bc81e058055921a0d246af26 /src/mixer_api.c
parentdc575106c296435940482cc2655804c71ee2d934 (diff)
downloadmpd-936449c6225624102d0a6cb78f9bb4da84375d60.tar.gz
mpd-936449c6225624102d0a6cb78f9bb4da84375d60.tar.xz
mpd-936449c6225624102d0a6cb78f9bb4da84375d60.zip
mixer_api: removed struct mixer_data
The mixer plugins should re-use the mixer struct and incorporate it in their object class.
Diffstat (limited to 'src/mixer_api.c')
-rw-r--r--src/mixer_api.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mixer_api.c b/src/mixer_api.c
index 0cf4e0c92..b0905bc5e 100644
--- a/src/mixer_api.c
+++ b/src/mixer_api.c
@@ -21,14 +21,6 @@
#include "mixer_api.h"
-void mixer_finish(struct mixer *mixer)
-{
- assert(mixer != NULL && mixer->plugin != NULL);
- mixer->plugin->finish(mixer->data);
- mixer->data = NULL;
- mixer->plugin = NULL;
-}
-
struct mixer *
mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
{
@@ -36,33 +28,36 @@ mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
assert(plugin != NULL);
- mixer = g_new(struct mixer, 1);
- mixer->plugin = plugin;
- mixer->data = mixer->plugin->init(param);
+ mixer = plugin->init(param);
+
+ assert(mixer->plugin == plugin);
+
return mixer;
}
void
mixer_free(struct mixer *mixer)
{
- mixer_finish(mixer);
- g_free(mixer);
+ assert(mixer != NULL);
+ assert(mixer->plugin != NULL);
+
+ mixer->plugin->finish(mixer);
}
bool mixer_open(struct mixer *mixer)
{
assert(mixer != NULL && mixer->plugin != NULL);
- return mixer->plugin->open(mixer->data);
+ return mixer->plugin->open(mixer);
}
bool mixer_control(struct mixer *mixer, int cmd, void *arg)
{
assert(mixer != NULL && mixer->plugin != NULL);
- return mixer->plugin->control(mixer->data, cmd, arg);
+ return mixer->plugin->control(mixer, cmd, arg);
}
void mixer_close(struct mixer *mixer)
{
assert(mixer != NULL && mixer->plugin != NULL);
- mixer->plugin->close(mixer->data);
+ mixer->plugin->close(mixer);
}