1 #ifndef foopstreamhfoo 2 #define foopstreamhfoo 3 4 /*** 5 This file is part of PulseAudio. 6 7 Copyright 2004-2006 Lennart Poettering 8 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB 9 10 PulseAudio is free software; you can redistribute it and/or modify 11 it under the terms of the GNU Lesser General Public License as 12 published by the Free Software Foundation; either version 2.1 of the 13 License, or (at your option) any later version. 14 15 PulseAudio is distributed in the hope that it will be useful, but 16 WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 Lesser General Public License for more details. 19 20 You should have received a copy of the GNU Lesser General Public 21 License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 22 ***/ 23 24 #include <inttypes.h> 25 26 #include <pulse/mainloop-api.h> 27 #include <pulse/def.h> 28 29 #include <pulsecore/packet.h> 30 #include <pulsecore/memblock.h> 31 #include <pulsecore/iochannel.h> 32 #include <pulsecore/srbchannel.h> 33 #include <pulsecore/memchunk.h> 34 #include <pulsecore/creds.h> 35 #include <pulsecore/macro.h> 36 37 typedef struct pa_pstream pa_pstream; 38 39 typedef void (*pa_pstream_packet_cb_t)(pa_pstream *p, pa_packet *packet, pa_cmsg_ancil_data *ancil_data, void *userdata); 40 typedef void (*pa_pstream_memblock_cb_t)(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata); 41 typedef void (*pa_pstream_notify_cb_t)(pa_pstream *p, void *userdata); 42 typedef void (*pa_pstream_block_id_cb_t)(pa_pstream *p, uint32_t block_id, void *userdata); 43 44 pa_pstream* pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *p); 45 46 pa_pstream* pa_pstream_ref(pa_pstream*p); 47 void pa_pstream_unref(pa_pstream*p); 48 49 void pa_pstream_unlink(pa_pstream *p); 50 51 int pa_pstream_attach_memfd_shmid(pa_pstream *p, unsigned shm_id, int memfd_fd); 52 53 void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, pa_cmsg_ancil_data *ancil_data); 54 void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk); 55 void pa_pstream_send_release(pa_pstream *p, uint32_t block_id); 56 void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id); 57 58 void pa_pstream_set_receive_packet_callback(pa_pstream *p, pa_pstream_packet_cb_t cb, void *userdata); 59 void pa_pstream_set_receive_memblock_callback(pa_pstream *p, pa_pstream_memblock_cb_t cb, void *userdata); 60 void pa_pstream_set_drain_callback(pa_pstream *p, pa_pstream_notify_cb_t cb, void *userdata); 61 void pa_pstream_set_die_callback(pa_pstream *p, pa_pstream_notify_cb_t cb, void *userdata); 62 void pa_pstream_set_release_callback(pa_pstream *p, pa_pstream_block_id_cb_t cb, void *userdata); 63 void pa_pstream_set_revoke_callback(pa_pstream *p, pa_pstream_block_id_cb_t cb, void *userdata); 64 65 bool pa_pstream_is_pending(pa_pstream *p); 66 67 void pa_pstream_enable_shm(pa_pstream *p, bool enable); 68 void pa_pstream_enable_memfd(pa_pstream *p); 69 bool pa_pstream_get_shm(pa_pstream *p); 70 bool pa_pstream_get_memfd(pa_pstream *p); 71 72 /* Enables shared ringbuffer channel. Note that the srbchannel is now owned by the pstream. 73 Setting srb to NULL will free any existing srbchannel. */ 74 void pa_pstream_set_srbchannel(pa_pstream *p, pa_srbchannel *srb); 75 76 #endif 77