From e945a42f2c28c271a56ce0546d38f0c33c4b8125 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 29 May 2006 12:19:46 +0200 Subject: Update Polypaudio plug-in to the 0.9.0 API The new version of Polypaudio includes a threading abstraction that allows application of a more synchronous nature to use the API more easily. Using this, the complexity of the Polypaudio plug-in is greatly reduced and also removes the risk of stalling the communications layer. Signed-off-by: Pierre Ossman --- polyp/polyp.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'polyp/polyp.h') diff --git a/polyp/polyp.h b/polyp/polyp.h index 8c2ab95..f210e18 100644 --- a/polyp/polyp.h +++ b/polyp/polyp.h @@ -21,32 +21,27 @@ #include #include -#include #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) typedef struct snd_polyp { - pa_mainloop *mainloop; + pa_threaded_mainloop *mainloop; pa_context *context; int thread_fd, main_fd; - pthread_t thread; - int thread_running; - enum { POLYP_STATE_INIT, - POLYP_STATE_CONNECTED, POLYP_STATE_READY, - POLYP_STATE_POLLING, } state; } snd_polyp_t; -int polyp_start_poll(snd_polyp_t *p); -int polyp_finish_poll(snd_polyp_t *p); - int polyp_check_connection(snd_polyp_t *p); +void polyp_stream_state_cb(pa_stream *s, void * userdata); +void polyp_stream_success_cb(pa_stream *s, int success, void *userdata); +void polyp_context_success_cb(pa_context *c, int success, void *userdata); + int polyp_wait_operation(snd_polyp_t *p, pa_operation *o); int polyp_wait_stream_state(snd_polyp_t *p, pa_stream *stream, pa_stream_state_t target); @@ -54,8 +49,9 @@ snd_polyp_t *polyp_new(); void polyp_free(snd_polyp_t *p); int polyp_connect(snd_polyp_t *p, const char *server); -int polyp_start_thread(snd_polyp_t *p); +void polyp_poll_activate(snd_polyp_t *p); +void polyp_poll_deactivate(snd_polyp_t *p); int polyp_poll_descriptors_count(snd_polyp_t *p); int polyp_poll_descriptors(snd_polyp_t *p, struct pollfd *pfd, unsigned int space); int polyp_poll_revents(snd_polyp_t *p, struct pollfd *pfd, unsigned int nfds, unsigned short *revents); -- cgit