aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorDavid Guibert <david.guibert@gmail.com>2009-03-06 18:21:23 +0100
committerMax Kellermann <max@duempel.org>2009-03-07 15:59:20 +0100
commit21bb10f4bf6708f4786821eff470cd0c59d04b00 (patch)
treed8956e5b7312eef352583e886691ef8ea9cffc55 /src/output
parenta547d24eb23dafd9f26af781e6fb147c433464b2 (diff)
downloadmpd-21bb10f4bf6708f4786821eff470cd0c59d04b00.tar.gz
mpd-21bb10f4bf6708f4786821eff470cd0c59d04b00.tar.xz
mpd-21bb10f4bf6708f4786821eff470cd0c59d04b00.zip
pulse mixer
This patch introduces the mixer for the pulse output. Technically speaking, the pulse index is needed to get or set the volume. You must define callback fonctions to get this index since the pulse output in mpd is done using the simpe api. The pulse simple api does not provide the index of the newly defined output. So callback fonctions are associated to the pulse context. The list of all the sink input is then retreived. Then we select the name of the mpd pulse output and control its volume by its associated index number. Signed-off-by: Patrice Linel <patnathanael@gmail.com> Signed-off-by: David Guibert <david.guibert@gmail.com> [mk: fixed whitespace errors and broke long lines; removed daemonization changes from main.c]
Diffstat (limited to '')
-rw-r--r--src/output/pulse_plugin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c
index a03275a22..25ef537d6 100644
--- a/src/output/pulse_plugin.c
+++ b/src/output/pulse_plugin.c
@@ -17,6 +17,7 @@
*/
#include "../output_api.h"
+#include "../mixer_api.h"
#include <glib.h>
#include <pulse/simple.h>
@@ -26,6 +27,7 @@
struct pulse_data {
const char *name;
+ struct mixer *mixer;
pa_simple *s;
char *server;
@@ -58,6 +60,7 @@ static void pulse_free_data(struct pulse_data *pd)
g_free(pd->server);
g_free(pd->sink);
g_free(pd);
+ mixer_free(pd->mixer);
}
static void *
@@ -73,6 +76,8 @@ pulse_init(G_GNUC_UNUSED const struct audio_format *audio_format,
pd->sink = param != NULL
? config_dup_block_string(param, "sink", NULL) : NULL;
+ pd->mixer=mixer_new(&pulse_mixer, param);
+
return pd;
}
@@ -83,6 +88,15 @@ static void pulse_finish(void *data)
pulse_free_data(pd);
}
+static struct mixer *
+pulse_get_mixer(void *data)
+{
+ struct pulse_data *pd = data;
+
+ return pd->mixer;
+}
+
+
static bool pulse_test_default_device(void)
{
pa_simple *s;
@@ -131,6 +145,7 @@ pulse_open(void *data, struct audio_format *audio_format, GError **error_r)
pa_strerror(error));
return false;
}
+ mixer_open(pd->mixer);
return true;
}
@@ -173,6 +188,7 @@ const struct audio_output_plugin pulse_plugin = {
.test_default_device = pulse_test_default_device,
.init = pulse_init,
.finish = pulse_finish,
+ .get_mixer = pulse_get_mixer,
.open = pulse_open,
.play = pulse_play,
.cancel = pulse_cancel,