summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-21 09:48:41 +0200
committerMax Kellermann <max@duempel.org>2009-10-21 09:48:41 +0200
commitac32f36e4e1489664e7c202319978b6a9a15ed40 (patch)
treec57ac0a4cc582bbf66727b1e1f2059373923a4da
parentb8ccc885c883a24265cd49de385b61d368a1b66f (diff)
mixer_plugin: pass audio_output pointer to mixer_plugin.init()
This allows the mixer object to access its associated audio output object.
-rw-r--r--src/mixer/alsa_mixer_plugin.c2
-rw-r--r--src/mixer/oss_mixer_plugin.c3
-rw-r--r--src/mixer/pulse_mixer_plugin.c2
-rw-r--r--src/mixer/software_mixer_plugin.c3
-rw-r--r--src/mixer_control.c5
-rw-r--r--src/mixer_control.h3
-rw-r--r--src/mixer_plugin.h5
-rw-r--r--src/output_init.c9
-rw-r--r--test/read_mixer.c2
9 files changed, 21 insertions, 13 deletions
diff --git a/src/mixer/alsa_mixer_plugin.c b/src/mixer/alsa_mixer_plugin.c
index 0f23bc03f..baf12030c 100644
--- a/src/mixer/alsa_mixer_plugin.c
+++ b/src/mixer/alsa_mixer_plugin.c
@@ -52,7 +52,7 @@ alsa_mixer_quark(void)
}
static struct mixer *
-alsa_mixer_init(const struct config_param *param,
+alsa_mixer_init(G_GNUC_UNUSED void *ao, const struct config_param *param,
G_GNUC_UNUSED GError **error_r)
{
struct alsa_mixer *am = g_new(struct alsa_mixer, 1);
diff --git a/src/mixer/oss_mixer_plugin.c b/src/mixer/oss_mixer_plugin.c
index 3b97e38f5..4e169bbc4 100644
--- a/src/mixer/oss_mixer_plugin.c
+++ b/src/mixer/oss_mixer_plugin.c
@@ -74,7 +74,8 @@ oss_find_mixer(const char *name)
}
static struct mixer *
-oss_mixer_init(const struct config_param *param, GError **error_r)
+oss_mixer_init(G_GNUC_UNUSED void *ao, const struct config_param *param,
+ GError **error_r)
{
struct oss_mixer *om = g_new(struct oss_mixer, 1);
diff --git a/src/mixer/pulse_mixer_plugin.c b/src/mixer/pulse_mixer_plugin.c
index 3399d5baa..ecc0fc75b 100644
--- a/src/mixer/pulse_mixer_plugin.c
+++ b/src/mixer/pulse_mixer_plugin.c
@@ -212,7 +212,7 @@ context_state_cb(pa_context *context, void *userdata)
static struct mixer *
-pulse_mixer_init(const struct config_param *param,
+pulse_mixer_init(G_GNUC_UNUSED void *ao, const struct config_param *param,
G_GNUC_UNUSED GError **error_r)
{
struct pulse_mixer *pm = g_new(struct pulse_mixer,1);
diff --git a/src/mixer/software_mixer_plugin.c b/src/mixer/software_mixer_plugin.c
index e81d265cb..2fcacd46d 100644
--- a/src/mixer/software_mixer_plugin.c
+++ b/src/mixer/software_mixer_plugin.c
@@ -37,7 +37,8 @@ struct software_mixer {
};
static struct mixer *
-software_mixer_init(G_GNUC_UNUSED const struct config_param *param,
+software_mixer_init(G_GNUC_UNUSED void *ao,
+ G_GNUC_UNUSED const struct config_param *param,
G_GNUC_UNUSED GError **error_r)
{
struct software_mixer *sm = g_new(struct software_mixer, 1);
diff --git a/src/mixer_control.c b/src/mixer_control.c
index 7ee9fabf0..df1e43003 100644
--- a/src/mixer_control.c
+++ b/src/mixer_control.c
@@ -27,14 +27,15 @@
#define G_LOG_DOMAIN "mixer"
struct mixer *
-mixer_new(const struct mixer_plugin *plugin, const struct config_param *param,
+mixer_new(const struct mixer_plugin *plugin, void *ao,
+ const struct config_param *param,
GError **error_r)
{
struct mixer *mixer;
assert(plugin != NULL);
- mixer = plugin->init(param, error_r);
+ mixer = plugin->init(ao, param, error_r);
assert(mixer == NULL || mixer->plugin == plugin);
diff --git a/src/mixer_control.h b/src/mixer_control.h
index f023317e3..a550e0864 100644
--- a/src/mixer_control.h
+++ b/src/mixer_control.h
@@ -34,7 +34,8 @@ struct mixer_plugin;
struct config_param;
struct mixer *
-mixer_new(const struct mixer_plugin *plugin, const struct config_param *param,
+mixer_new(const struct mixer_plugin *plugin, void *ao,
+ const struct config_param *param,
GError **error_r);
void
diff --git a/src/mixer_plugin.h b/src/mixer_plugin.h
index f3f70e2ef..648c3280c 100644
--- a/src/mixer_plugin.h
+++ b/src/mixer_plugin.h
@@ -38,11 +38,14 @@ struct mixer_plugin {
/**
* Alocates and configures a mixer device.
*
+ * @param ao the pointer returned by audio_output_plugin.init
+ * @param param the configuration section, or NULL if there is
+ * no configuration
* @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)(void *ao, const struct config_param *param,
GError **error_r);
/**
diff --git a/src/output_init.c b/src/output_init.c
index a628a2499..f394066ef 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -89,7 +89,7 @@ audio_output_mixer_type(const struct config_param *param)
}
static struct mixer *
-audio_output_load_mixer(const struct config_param *param,
+audio_output_load_mixer(void *ao, const struct config_param *param,
const struct mixer_plugin *plugin,
struct filter *filter_chain,
GError **error_r)
@@ -105,10 +105,10 @@ audio_output_load_mixer(const struct config_param *param,
if (plugin == NULL)
return NULL;
- return mixer_new(plugin, param, error_r);
+ return mixer_new(plugin, ao, param, error_r);
case MIXER_TYPE_SOFTWARE:
- mixer = mixer_new(&software_mixer_plugin, NULL, NULL);
+ mixer = mixer_new(&software_mixer_plugin, NULL, NULL, NULL);
assert(mixer != NULL);
filter_chain_append(filter_chain,
@@ -200,7 +200,8 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
if (ao->data == NULL)
return false;
- ao->mixer = audio_output_load_mixer(param, plugin->mixer_plugin,
+ ao->mixer = audio_output_load_mixer(ao->data, param,
+ plugin->mixer_plugin,
ao->filter, &error);
if (ao->mixer == NULL && error != NULL) {
g_warning("Failed to initialize hardware mixer for '%s': %s",
diff --git a/test/read_mixer.c b/test/read_mixer.c
index 89ea55356..fdf6b7fe1 100644
--- a/test/read_mixer.c
+++ b/test/read_mixer.c
@@ -58,7 +58,7 @@ int main(int argc, G_GNUC_UNUSED char **argv)
g_thread_init(NULL);
- mixer = mixer_new(&alsa_mixer_plugin, NULL, &error);
+ mixer = mixer_new(&alsa_mixer_plugin, NULL, NULL, &error);
if (mixer == NULL) {
g_printerr("mixer_new() failed: %s\n", error->message);
g_error_free(error);