aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-17 19:50:36 +0200
committerMax Kellermann <max@duempel.org>2011-09-17 19:50:36 +0200
commit3934d2d30cf97271dc7b33e3b77b101f09f916e7 (patch)
tree5a4370440c19e60f90caa9b050804a37ab3e7e69 /src/output
parent423ce9557a7d2068292a95ceedc6c57982a231a0 (diff)
downloadmpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.tar.gz
mpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.tar.xz
mpd-3934d2d30cf97271dc7b33e3b77b101f09f916e7.zip
output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer plugin.
Diffstat (limited to '')
-rw-r--r--src/output/pulse_output_plugin.c43
-rw-r--r--src/output/pulse_output_plugin.h37
2 files changed, 49 insertions, 31 deletions
diff --git a/src/output/pulse_output_plugin.c b/src/output/pulse_output_plugin.c
index 62f27967a..12b68fc3c 100644
--- a/src/output/pulse_output_plugin.c
+++ b/src/output/pulse_output_plugin.c
@@ -31,11 +31,42 @@
#include <pulse/introspect.h>
#include <pulse/subscribe.h>
#include <pulse/error.h>
+#include <pulse/version.h>
#include <assert.h>
+#include <stddef.h>
#define MPD_PULSE_NAME "Music Player Daemon"
+#if !defined(PA_CHECK_VERSION)
+/**
+ * This macro was implemented in libpulse 0.9.16.
+ */
+#define PA_CHECK_VERSION(a,b,c) false
+#endif
+
+struct pulse_output {
+ const char *name;
+ const char *server;
+ const char *sink;
+
+ struct pulse_mixer *mixer;
+
+ struct pa_threaded_mainloop *mainloop;
+ struct pa_context *context;
+ struct pa_stream *stream;
+
+ size_t writable;
+
+#if !PA_CHECK_VERSION(0,9,11)
+ /**
+ * We need this variable because pa_stream_is_corked() wasn't
+ * added before 0.9.11.
+ */
+ bool pause;
+#endif
+};
+
/**
* The quark used for GError.domain.
*/
@@ -46,6 +77,18 @@ pulse_output_quark(void)
}
void
+pulse_output_lock(struct pulse_output *po)
+{
+ pa_threaded_mainloop_lock(po->mainloop);
+}
+
+void
+pulse_output_unlock(struct pulse_output *po)
+{
+ pa_threaded_mainloop_unlock(po->mainloop);
+}
+
+void
pulse_output_set_mixer(struct pulse_output *po, struct pulse_mixer *pm)
{
assert(po != NULL);
diff --git a/src/output/pulse_output_plugin.h b/src/output/pulse_output_plugin.h
index 2261175d5..3f260238f 100644
--- a/src/output/pulse_output_plugin.h
+++ b/src/output/pulse_output_plugin.h
@@ -21,43 +21,18 @@
#define MPD_PULSE_OUTPUT_PLUGIN_H
#include <stdbool.h>
-#include <stddef.h>
#include <glib.h>
-#include <pulse/version.h>
-
-#if !defined(PA_CHECK_VERSION)
-/**
- * This macro was implemented in libpulse 0.9.16.
- */
-#define PA_CHECK_VERSION(a,b,c) false
-#endif
-
-struct pa_operation;
+struct pulse_output;
+struct pulse_mixer;
struct pa_cvolume;
-struct pulse_output {
- const char *name;
- const char *server;
- const char *sink;
-
- struct pulse_mixer *mixer;
-
- struct pa_threaded_mainloop *mainloop;
- struct pa_context *context;
- struct pa_stream *stream;
-
- size_t writable;
+void
+pulse_output_lock(struct pulse_output *po);
-#if !PA_CHECK_VERSION(0,9,11)
- /**
- * We need this variable because pa_stream_is_corked() wasn't
- * added before 0.9.11.
- */
- bool pause;
-#endif
-};
+void
+pulse_output_unlock(struct pulse_output *po);
void
pulse_output_set_mixer(struct pulse_output *po, struct pulse_mixer *pm);