1 #ifndef foortphfoo 2 #define foortphfoo 3 4 /*** 5 This file is part of PulseAudio. 6 7 Copyright 2006 Lennart Poettering 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 <inttypes.h> 24 #include <sys/socket.h> 25 #include <sys/types.h> 26 #include <pulsecore/memblockq.h> 27 #include <pulsecore/memchunk.h> 28 #include <pulsecore/rtpoll.h> 29 30 typedef struct pa_rtp_context pa_rtp_context; 31 32 int pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint8_t payload, size_t mtu, size_t frame_size); 33 pa_rtp_context* pa_rtp_context_new_send(int fd, uint8_t payload, size_t mtu, const pa_sample_spec *ss, bool enable_opus); 34 35 /* If the memblockq doesn't have a silence memchunk set, then the caller must 36 * guarantee that the current read index doesn't point to a hole. */ 37 int pa_rtp_send(pa_rtp_context *c, pa_memblockq *q); 38 39 pa_rtp_context* pa_rtp_context_new_recv(int fd, uint8_t payload, const pa_sample_spec *ss, bool enable_opus); 40 int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, uint32_t *rtp_tstamp, struct timeval *tstamp); 41 42 void pa_rtp_context_free(pa_rtp_context *c); 43 44 size_t pa_rtp_context_get_frame_size(pa_rtp_context *c); 45 pa_rtpoll_item* pa_rtp_context_get_rtpoll_item(pa_rtp_context *c, pa_rtpoll *rtpoll); 46 47 pa_sample_spec* pa_rtp_sample_spec_fixup(pa_sample_spec *ss, bool enable_opus); 48 int pa_rtp_sample_spec_valid(const pa_sample_spec *ss); 49 50 uint8_t pa_rtp_payload_from_sample_spec(const pa_sample_spec *ss); 51 pa_sample_spec *pa_rtp_sample_spec_from_payload(uint8_t payload, pa_sample_spec *ss); 52 53 const char* pa_rtp_format_to_string(pa_sample_format_t f); 54 pa_sample_format_t pa_rtp_string_to_format(const char *s, bool enable_opus); 55 56 #endif 57