| 1 | /*-*- linux-c -*-*/ |
| 2 | |
| 3 | /* |
| 4 | * ALSA <-> PulseAudio plugins |
| 5 | * |
| 6 | * Copyright (c) 2006 by Pierre Ossman <[email protected]> |
| 7 | * |
| 8 | * This library is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Lesser General Public License as |
| 10 | * published by the Free Software Foundation; either version 2.1 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #include <alsa/asoundlib.h> |
| 24 | |
| 25 | #include <pulse/pulseaudio.h> |
| 26 | |
| 27 | #ifndef EBADFD |
| 28 | #define EBADFD EBADF |
| 29 | #endif |
| 30 | |
| 31 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) |
| 32 | |
| 33 | typedef struct snd_pulse { |
| 34 | pa_threaded_mainloop *mainloop; |
| 35 | pa_context *context; |
| 36 | |
| 37 | int thread_fd, main_fd; |
| 38 | } snd_pulse_t; |
| 39 | |
| 40 | int pulse_check_connection(snd_pulse_t * p); |
| 41 | |
| 42 | void pulse_context_success_cb(pa_context * c, int success, void *userdata); |
| 43 | |
| 44 | int pulse_wait_operation(snd_pulse_t * p, pa_operation * o); |
| 45 | |
| 46 | snd_pulse_t *pulse_new(void); |
| 47 | void pulse_free(snd_pulse_t * p); |
| 48 | |
| 49 | int pulse_connect(snd_pulse_t * p, const char *server, int can_fallback); |
| 50 | |
| 51 | void pulse_poll_activate(snd_pulse_t * p); |
| 52 | void pulse_poll_deactivate(snd_pulse_t * p); |