1 #ifndef fooraopclientfoo 2 #define fooraopclientfoo 3 4 /*** 5 This file is part of PulseAudio. 6 7 Copyright 2008 Colin Guthrie 8 9 PulseAudio is free software; you can redistribute it and/or modify 10 it under the terms of the GNU Lesser General Public License as published 11 by the Free Software Foundation; either version 2.1 of the License, 12 or (at your option) any later version. 13 14 PulseAudio is distributed in the hope that it will be useful, but 15 WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public License 20 along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 21 ***/ 22 23 #include <pulse/volume.h> 24 25 #include <pulsecore/core.h> 26 #include <pulsecore/memchunk.h> 27 #include <pulsecore/rtpoll.h> 28 29 typedef enum pa_raop_protocol { 30 PA_RAOP_PROTOCOL_TCP, 31 PA_RAOP_PROTOCOL_UDP 32 } pa_raop_protocol_t; 33 34 typedef enum pa_raop_encryption { 35 PA_RAOP_ENCRYPTION_NONE, 36 PA_RAOP_ENCRYPTION_RSA, 37 PA_RAOP_ENCRYPTION_FAIRPLAY, 38 PA_RAOP_ENCRYPTION_MFISAP, 39 PA_RAOP_ENCRYPTION_FAIRPLAY_SAP25 40 } pa_raop_encryption_t; 41 42 typedef enum pa_raop_codec { 43 PA_RAOP_CODEC_PCM, 44 PA_RAOP_CODEC_ALAC, 45 PA_RAOP_CODEC_AAC, 46 PA_RAOP_CODEC_AAC_ELD 47 } pa_raop_codec_t; 48 49 typedef struct pa_raop_client pa_raop_client; 50 51 typedef enum pa_raop_state { 52 PA_RAOP_INVALID_STATE, 53 PA_RAOP_AUTHENTICATED, 54 PA_RAOP_CONNECTED, 55 PA_RAOP_RECORDING, 56 PA_RAOP_DISCONNECTED 57 } pa_raop_state_t; 58 59 pa_raop_client* pa_raop_client_new(pa_core *core, const char *host, pa_raop_protocol_t protocol, 60 pa_raop_encryption_t encryption, pa_raop_codec_t codec, bool autoreconnect); 61 void pa_raop_client_free(pa_raop_client *c); 62 63 int pa_raop_client_authenticate(pa_raop_client *c, const char *password); 64 bool pa_raop_client_is_authenticated(pa_raop_client *c); 65 66 int pa_raop_client_announce(pa_raop_client *c); 67 bool pa_raop_client_is_alive(pa_raop_client *c); 68 bool pa_raop_client_is_recording(pa_raop_client *c); 69 bool pa_raop_client_can_stream(pa_raop_client *c); 70 int pa_raop_client_stream(pa_raop_client *c); 71 int pa_raop_client_set_volume(pa_raop_client *c, pa_volume_t volume); 72 int pa_raop_client_flush(pa_raop_client *c); 73 int pa_raop_client_teardown(pa_raop_client *c); 74 void pa_raop_client_disconnect(pa_raop_client *c); 75 76 void pa_raop_client_get_frames_per_block(pa_raop_client *c, size_t *size); 77 bool pa_raop_client_register_pollfd(pa_raop_client *c, pa_rtpoll *poll, pa_rtpoll_item **poll_item); 78 bool pa_raop_client_is_timing_fd(pa_raop_client *c, const int fd); 79 pa_volume_t pa_raop_client_adjust_volume(pa_raop_client *c, pa_volume_t volume); 80 void pa_raop_client_handle_oob_packet(pa_raop_client *c, const int fd, const uint8_t packet[], ssize_t size); 81 ssize_t pa_raop_client_send_audio_packet(pa_raop_client *c, pa_memchunk *block, size_t offset); 82 83 typedef void (*pa_raop_client_state_cb_t)(pa_raop_state_t state, void *userdata); 84 void pa_raop_client_set_state_callback(pa_raop_client *c, pa_raop_client_state_cb_t callback, void *userdata); 85 86 #endif 87