aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-09 22:25:24 +0100
committerMax Kellermann <max@duempel.org>2013-01-09 22:25:24 +0100
commitd3e1b72d381dc7dd01926188b6d62729788b76b9 (patch)
treeebea31783d45b5f5a8e8e99d3e50c315af3b9e8f /src/mixer
parentb5e1bd5705842fe73bbb12e5ff771e42e10cb004 (diff)
downloadmpd-d3e1b72d381dc7dd01926188b6d62729788b76b9.tar.gz
mpd-d3e1b72d381dc7dd01926188b6d62729788b76b9.tar.xz
mpd-d3e1b72d381dc7dd01926188b6d62729788b76b9.zip
mixer/{alsa,pulse}: convert to C++
Diffstat (limited to 'src/mixer')
-rw-r--r--src/mixer/AlsaMixerPlugin.cxx (renamed from src/mixer/alsa_mixer_plugin.c)34
-rw-r--r--src/mixer/PulseMixerPlugin.cxx (renamed from src/mixer/pulse_mixer_plugin.c)24
-rw-r--r--src/mixer/PulseMixerPlugin.h (renamed from src/mixer/pulse_mixer_plugin.h)10
3 files changed, 40 insertions, 28 deletions
diff --git a/src/mixer/alsa_mixer_plugin.c b/src/mixer/AlsaMixerPlugin.cxx
index 22e4e22bd..6623d12ec 100644
--- a/src/mixer/alsa_mixer_plugin.c
+++ b/src/mixer/AlsaMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -77,7 +77,7 @@ find_fd(GSList **list_r, int fd)
if (list == NULL)
return NULL;
- GPollFD *p = list->data;
+ GPollFD *p = (GPollFD *)list->data;
if (p->fd == fd)
return list_r;
@@ -103,7 +103,7 @@ alsa_mixer_update_fd(struct alsa_mixer_source *source, const struct pollfd *p,
GSList *found = *found_r;
*found_r = found->next;
- GPollFD *q = found->data;
+ GPollFD *q = (GPollFD *)found->data;
if (q->events != p->events) {
/* refresh events */
g_source_remove_poll(&source->source, q);
@@ -135,7 +135,7 @@ alsa_mixer_update_fds(struct alsa_mixer_source *source)
g_free(pfds);
for (; old != NULL; old = old->next) {
- GPollFD *q = old->data;
+ GPollFD *q = (GPollFD *)old->data;
g_source_remove_poll(&source->source, q);
g_free(q);
}
@@ -163,7 +163,7 @@ alsa_mixer_source_check(GSource *_source)
struct alsa_mixer_source *source = (struct alsa_mixer_source *)_source;
for (const GSList *i = source->fds; i != NULL; i = i->next) {
- const GPollFD *poll_fd = i->data;
+ const GPollFD *poll_fd = (GPollFD *)i->data;
if (poll_fd->revents != 0)
return true;
}
@@ -194,10 +194,12 @@ alsa_mixer_source_finalize(GSource *_source)
}
static GSourceFuncs alsa_mixer_source_funcs = {
- .prepare = alsa_mixer_source_prepare,
- .check = alsa_mixer_source_check,
- .dispatch = alsa_mixer_source_dispatch,
- .finalize = alsa_mixer_source_finalize,
+ alsa_mixer_source_prepare,
+ alsa_mixer_source_check,
+ alsa_mixer_source_dispatch,
+ alsa_mixer_source_finalize,
+ nullptr,
+ nullptr,
};
/*
@@ -421,11 +423,11 @@ alsa_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
}
const struct mixer_plugin alsa_mixer_plugin = {
- .init = alsa_mixer_init,
- .finish = alsa_mixer_finish,
- .open = alsa_mixer_open,
- .close = alsa_mixer_close,
- .get_volume = alsa_mixer_get_volume,
- .set_volume = alsa_mixer_set_volume,
- .global = true,
+ alsa_mixer_init,
+ alsa_mixer_finish,
+ alsa_mixer_open,
+ alsa_mixer_close,
+ alsa_mixer_get_volume,
+ alsa_mixer_set_volume,
+ true,
};
diff --git a/src/mixer/pulse_mixer_plugin.c b/src/mixer/PulseMixerPlugin.cxx
index a82c032b3..509b91bc8 100644
--- a/src/mixer/pulse_mixer_plugin.c
+++ b/src/mixer/PulseMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
*/
#include "config.h"
-#include "pulse_mixer_plugin.h"
+#include "PulseMixerPlugin.h"
#include "mixer_api.h"
#include "output/pulse_output_plugin.h"
#include "conf.h"
@@ -77,7 +77,7 @@ static void
pulse_mixer_volume_cb(G_GNUC_UNUSED pa_context *context, const pa_sink_input_info *i,
int eol, void *userdata)
{
- struct pulse_mixer *pm = userdata;
+ struct pulse_mixer *pm = (struct pulse_mixer *)userdata;
if (eol)
return;
@@ -153,16 +153,15 @@ static struct mixer *
pulse_mixer_init(void *ao, G_GNUC_UNUSED const struct config_param *param,
GError **error_r)
{
- struct pulse_mixer *pm;
- struct pulse_output *po = ao;
+ struct pulse_output *po = (struct pulse_output *)ao;
if (ao == NULL) {
g_set_error(error_r, pulse_mixer_quark(), 0,
"The pulse mixer cannot work without the audio output");
- return false;
+ return nullptr;
}
- pm = g_new(struct pulse_mixer,1);
+ struct pulse_mixer *pm = g_new(struct pulse_mixer,1);
mixer_init(&pm->base, &pulse_mixer_plugin);
pm->online = false;
@@ -229,8 +228,11 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
}
const struct mixer_plugin pulse_mixer_plugin = {
- .init = pulse_mixer_init,
- .finish = pulse_mixer_finish,
- .get_volume = pulse_mixer_get_volume,
- .set_volume = pulse_mixer_set_volume,
+ pulse_mixer_init,
+ pulse_mixer_finish,
+ nullptr,
+ nullptr,
+ pulse_mixer_get_volume,
+ pulse_mixer_set_volume,
+ false,
};
diff --git a/src/mixer/pulse_mixer_plugin.h b/src/mixer/PulseMixerPlugin.h
index 461633d37..f432c44a0 100644
--- a/src/mixer/pulse_mixer_plugin.h
+++ b/src/mixer/PulseMixerPlugin.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,10 @@ struct pulse_mixer;
struct pa_context;
struct pa_stream;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void
pulse_mixer_on_connect(struct pulse_mixer *pm, struct pa_context *context);
@@ -36,4 +40,8 @@ void
pulse_mixer_on_change(struct pulse_mixer *pm,
struct pa_context *context, struct pa_stream *stream);
+#ifdef __cplusplus
+}
+#endif
+
#endif