diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:03:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:03:18 +0000 |
commit | 2dd5bc6a074165ddfbd57c4bd52c2d2dac8f47a1 (patch) | |
tree | 465b29cb405d3af0b0ad50c78e1dccc636594fec /src/pulsecore/srbchannel.h | |
parent | Initial commit. (diff) | |
download | pulseaudio-2dd5bc6a074165ddfbd57c4bd52c2d2dac8f47a1.tar.xz pulseaudio-2dd5bc6a074165ddfbd57c4bd52c2d2dac8f47a1.zip |
Adding upstream version 14.2.upstream/14.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/pulsecore/srbchannel.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/pulsecore/srbchannel.h b/src/pulsecore/srbchannel.h new file mode 100644 index 0000000..09193e0 --- /dev/null +++ b/src/pulsecore/srbchannel.h @@ -0,0 +1,57 @@ +#ifndef foopulsesrbchannelhfoo +#define foopulsesrbchannelhfoo + +/*** + This file is part of PulseAudio. + + Copyright 2014 David Henningsson, Canonical Ltd. + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. +***/ + +#include <pulse/mainloop-api.h> +#include <pulsecore/fdsem.h> +#include <pulsecore/memblock.h> + +/* An shm ringbuffer that is used for low overhead server-client communication. + * Signaling is done through eventfd semaphores (pa_fdsem). */ + +typedef struct pa_srbchannel pa_srbchannel; + +typedef struct pa_srbchannel_template { + int readfd, writefd; + pa_memblock *memblock; +} pa_srbchannel_template; + +pa_srbchannel* pa_srbchannel_new(pa_mainloop_api *m, pa_mempool *p); +/* Note: this creates a srbchannel with swapped read and write. */ +pa_srbchannel* pa_srbchannel_new_from_template(pa_mainloop_api *m, pa_srbchannel_template *t); + +void pa_srbchannel_free(pa_srbchannel *sr); + +void pa_srbchannel_export(pa_srbchannel *sr, pa_srbchannel_template *t); + +size_t pa_srbchannel_write(pa_srbchannel *sr, const void *data, size_t l); +size_t pa_srbchannel_read(pa_srbchannel *sr, void *data, size_t l); + +/* Set the callback function that is called whenever data becomes available for reading. + * It can also be called if the output buffer was full and can now be written to. + * + * Return false to abort all processing (e g if the srbchannel has been freed during the callback). + * Otherwise return true. +*/ +typedef bool (*pa_srbchannel_cb_t)(pa_srbchannel *sr, void *userdata); +void pa_srbchannel_set_callback(pa_srbchannel *sr, pa_srbchannel_cb_t callback, void *userdata); + +#endif |