2 * Copyright (C) 2016 "IoT.bzh"
3 * Author "Manuel Bachmann"
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
22 #include <pulse/pulseaudio.h>
23 #include <pulse/simple.h>
24 #include <pulse/error.h>
26 #include "audio-alsa.h"
27 #include "local-def.h"
29 typedef struct dev_ctx_pulse dev_ctx_pulse_T;
30 typedef struct alsa_info alsa_info_T;
32 struct dev_ctx_pulse {
36 pa_context *pa_context;
40 unsigned char refresh;
42 unsigned char thr_should_run;
43 unsigned char thr_finished;
51 PUBLIC unsigned char _pulse_init (const char *, audioCtxHandleT *);
52 PUBLIC void _pulse_free (audioCtxHandleT *);
53 PUBLIC void _pulse_play (audioCtxHandleT *);
54 PUBLIC void _pulse_stop (audioCtxHandleT *);
55 PUBLIC unsigned int _pulse_get_volume (audioCtxHandleT *, unsigned int);
56 PUBLIC void _pulse_set_volume (audioCtxHandleT *, unsigned int, unsigned int);
57 PUBLIC void _pulse_set_volume_all (audioCtxHandleT *, unsigned int);
58 PUBLIC unsigned char _pulse_get_mute (audioCtxHandleT *);
59 PUBLIC void _pulse_set_mute (audioCtxHandleT *, unsigned char);
61 STATIC void _pulse_context_cb (pa_context *, void *);
62 STATIC void _pulse_sink_list_cb (pa_context *, const pa_sink_info *, int, void *);
63 STATIC void _pulse_sink_info_cb (pa_context *, const pa_sink_info *, int, void *);
64 STATIC void* _pulse_play_thread_fn (void *);
65 PUBLIC void _pulse_refresh_sink (dev_ctx_pulse_T *);
67 static struct alsa_info **alsa_info = NULL;
68 static struct dev_ctx_pulse **dev_ctx_p = NULL;
69 static unsigned int client_count = 0;
71 #endif /* AUDIO_PULSE_H */