2014-04-15 17:20:05 +02:00
|
|
|
#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
|
2014-11-26 14:14:51 +01:00
|
|
|
License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
2014-04-15 17:20:05 +02:00
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
#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.
|
2014-08-06 07:34:24 +05:30
|
|
|
* Signaling is done through eventfd semaphores (pa_fdsem). */
|
2014-04-15 17:20:05 +02:00
|
|
|
|
|
|
|
|
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.
|
2014-08-06 07:34:24 +05:30
|
|
|
* 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.
|
2014-04-15 17:20:05 +02:00
|
|
|
*/
|
|
|
|
|
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
|