summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/audio/audio-api.c3
-rw-r--r--plugins/audio/audio-api.h4
-rw-r--r--plugins/audio/audio-pulse.c19
-rw-r--r--plugins/audio/audio-pulse.h10
4 files changed, 24 insertions, 12 deletions
diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c
index ebf78e18..3f80ef02 100644
--- a/plugins/audio/audio-api.c
+++ b/plugins/audio/audio-api.c
@@ -21,6 +21,9 @@
#include "audio-api.h"
#include "audio-alsa.h"
+#ifdef HAVE_PULSE
+#include "audio-pulse.h"
+#endif
#include "afb-plugin.h"
#include "afb-req-itf.h"
diff --git a/plugins/audio/audio-api.h b/plugins/audio/audio-api.h
index bd21b6ab..6edc9357 100644
--- a/plugins/audio/audio-api.h
+++ b/plugins/audio/audio-api.h
@@ -19,10 +19,6 @@
#ifndef AUDIO_API_H
#define AUDIO_API_H
-#ifdef HAVE_PULSE
-#include "audio-pulse.h"
-#endif
-
/* global plugin handle, should store everything we may need */
typedef struct {
int devCount;
diff --git a/plugins/audio/audio-pulse.c b/plugins/audio/audio-pulse.c
index 35de7f9a..31ebdba4 100644
--- a/plugins/audio/audio-pulse.c
+++ b/plugins/audio/audio-pulse.c
@@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define _GNU_SOURCE
+#include <stdio.h>
+
#include "audio-api.h"
#include "audio-pulse.h"
@@ -74,14 +77,14 @@ PUBLIC unsigned char _pulse_init (const char *name, audioCtxHandleT *ctx) {
ctx->mute = (unsigned char)dev_ctx_p[ret]->mute;
ctx->channels = (unsigned int)dev_ctx_p[ret]->volume.channels;
for (i = 0; i < ctx->channels; i++)
- ctx->volume[i] = (int)dev_ctx_p[ret]->volume.values[i];
+ ctx->volume[i] = dev_ctx_p[ret]->volume.values[i];
ctx->idx = ret;
/* open matching sink for playback */
pa_spec = (pa_sample_spec*) malloc (sizeof(pa_sample_spec));
pa_spec->format = PA_SAMPLE_S16LE;
pa_spec->rate = 22050;
- pa_spec->channels = ctx->channels;
+ pa_spec->channels = (uint8_t)ctx->channels;
if (!(pa = pa_simple_new (NULL, "afb-audio-plugin", PA_STREAM_PLAYBACK, dev_ctx_p[ret]->sink_name,
"afb-audio-output", pa_spec, NULL, NULL, &error))) {
@@ -150,19 +153,19 @@ PUBLIC void _pulse_stop (audioCtxHandleT *ctx) {
pthread_join (dev_ctx_p_c->thr, NULL);
}
-PUBLIC int _pulse_get_volume (audioCtxHandleT *ctx, unsigned int channel) {
+PUBLIC unsigned int _pulse_get_volume (audioCtxHandleT *ctx, unsigned int channel) {
dev_ctx_pulse_T* dev_ctx_p_c = (dev_ctx_pulse_T*)ctx->audio_dev;
if (!dev_ctx_p_c)
- return;
+ return 0;
_pulse_refresh_sink (dev_ctx_p_c);
- return (int)dev_ctx_p_c->volume.values[channel];
+ return dev_ctx_p_c->volume.values[channel];
}
-PUBLIC void _pulse_set_volume (audioCtxHandleT *ctx, unsigned int channel, int vol) {
+PUBLIC void _pulse_set_volume (audioCtxHandleT *ctx, unsigned int channel, unsigned int vol) {
dev_ctx_pulse_T* dev_ctx_p_c = (dev_ctx_pulse_T*)ctx->audio_dev;
struct pa_cvolume volume;
@@ -178,7 +181,7 @@ PUBLIC void _pulse_set_volume (audioCtxHandleT *ctx, unsigned int channel, int v
_pulse_refresh_sink (dev_ctx_p_c);
}
-PUBLIC void _pulse_set_volume_all (audioCtxHandleT *ctx, int vol) {
+PUBLIC void _pulse_set_volume_all (audioCtxHandleT *ctx, unsigned int vol) {
dev_ctx_pulse_T* dev_ctx_p_c = (dev_ctx_pulse_T*)ctx->audio_dev;
struct pa_cvolume volume;
@@ -199,7 +202,7 @@ PUBLIC unsigned char _pulse_get_mute (audioCtxHandleT *ctx) {
dev_ctx_pulse_T* dev_ctx_p_c = (dev_ctx_pulse_T*)ctx->audio_dev;
if (!dev_ctx_p_c)
- return;
+ return 0;
_pulse_refresh_sink (dev_ctx_p_c);
diff --git a/plugins/audio/audio-pulse.h b/plugins/audio/audio-pulse.h
index fc18d9c0..7405fb84 100644
--- a/plugins/audio/audio-pulse.h
+++ b/plugins/audio/audio-pulse.h
@@ -49,6 +49,16 @@ struct alsa_info {
char *synonyms;
};
+PUBLIC unsigned char _pulse_init (const char *, audioCtxHandleT *);
+PUBLIC void _pulse_free (audioCtxHandleT *);
+PUBLIC void _pulse_play (audioCtxHandleT *);
+PUBLIC void _pulse_stop (audioCtxHandleT *);
+PUBLIC unsigned int _pulse_get_volume (audioCtxHandleT *, unsigned int);
+PUBLIC void _pulse_set_volume (audioCtxHandleT *, unsigned int, unsigned int);
+PUBLIC void _pulse_set_volume_all (audioCtxHandleT *, unsigned int);
+PUBLIC unsigned char _pulse_get_mute (audioCtxHandleT *);
+PUBLIC void _pulse_set_mute (audioCtxHandleT *, unsigned char);
+
STATIC void _pulse_context_cb (pa_context *, void *);
STATIC void _pulse_sink_list_cb (pa_context *, const pa_sink_info *, int, void *);
STATIC void _pulse_sink_info_cb (pa_context *, const pa_sink_info *, int, void *);