2006-02-16 23:11:28 +00:00
|
|
|
#ifndef foointernalhfoo
|
|
|
|
|
#define foointernalhfoo
|
2004-08-14 20:25:32 +00:00
|
|
|
|
2004-08-13 13:24:48 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
This file is part of polypaudio.
|
|
|
|
|
|
|
|
|
|
polypaudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2004-08-13 13:24:48 +00:00
|
|
|
by the Free Software Foundation; either version 2 of the License,
|
|
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
polypaudio 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
|
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2004-08-13 13:24:48 +00:00
|
|
|
along with polypaudio; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
2006-02-16 19:19:58 +00:00
|
|
|
#include <polyp/mainloop-api.h>
|
2006-02-17 12:10:58 +00:00
|
|
|
#include <polyp/context.h>
|
|
|
|
|
#include <polyp/stream.h>
|
|
|
|
|
#include <polyp/operation.h>
|
|
|
|
|
|
2006-02-16 19:19:58 +00:00
|
|
|
#include <polypcore/socket-client.h>
|
|
|
|
|
#include <polypcore/pstream.h>
|
|
|
|
|
#include <polypcore/pdispatch.h>
|
|
|
|
|
#include <polypcore/dynarray.h>
|
|
|
|
|
#include <polypcore/llist.h>
|
|
|
|
|
#include <polypcore/native-common.h>
|
|
|
|
|
#include <polypcore/strlist.h>
|
|
|
|
|
#include <polypcore/mcalign.h>
|
2006-02-17 15:42:47 +00:00
|
|
|
#include <polypcore/memblockq.h>
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-02-17 12:10:58 +00:00
|
|
|
#include "client-conf.h"
|
|
|
|
|
|
2004-09-28 22:47:48 +00:00
|
|
|
#define DEFAULT_TIMEOUT (10)
|
2004-08-13 13:24:48 +00:00
|
|
|
|
|
|
|
|
struct pa_context {
|
2004-08-14 20:25:32 +00:00
|
|
|
int ref;
|
|
|
|
|
|
2004-08-13 13:24:48 +00:00
|
|
|
char *name;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_mainloop_api* mainloop;
|
2004-08-14 20:25:32 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_socket_client *client;
|
|
|
|
|
pa_pstream *pstream;
|
|
|
|
|
pa_pdispatch *pdispatch;
|
2004-08-14 20:25:32 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_dynarray *record_streams, *playback_streams;
|
|
|
|
|
PA_LLIST_HEAD(pa_stream, streams);
|
|
|
|
|
PA_LLIST_HEAD(pa_operation, operations);
|
2004-08-14 20:25:32 +00:00
|
|
|
|
2004-08-13 13:24:48 +00:00
|
|
|
uint32_t ctag;
|
|
|
|
|
uint32_t error;
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_context_state_t state;
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void (*state_callback)(pa_context*c, void *userdata);
|
2004-08-14 20:25:32 +00:00
|
|
|
void *state_userdata;
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
void (*subscribe_callback)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
void *subscribe_userdata;
|
2004-08-17 19:37:29 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_memblock_stat *memblock_stat;
|
2004-09-15 19:16:57 +00:00
|
|
|
|
|
|
|
|
int local;
|
2004-11-11 21:18:33 +00:00
|
|
|
int do_autospawn;
|
|
|
|
|
int autospawn_lock_fd;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_spawn_api spawn_api;
|
2004-11-11 21:18:33 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_strlist *server_list;
|
2004-09-17 19:45:44 +00:00
|
|
|
|
2004-11-17 00:05:25 +00:00
|
|
|
char *server;
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_client_conf *conf;
|
2004-08-13 13:24:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct pa_stream {
|
2004-08-14 20:25:32 +00:00
|
|
|
int ref;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_context *context;
|
|
|
|
|
pa_mainloop_api *mainloop;
|
|
|
|
|
PA_LLIST_FIELDS(pa_stream);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
|
|
|
|
char *name;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_buffer_attr buffer_attr;
|
|
|
|
|
pa_sample_spec sample_spec;
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_channel_map channel_map;
|
2004-08-13 13:24:48 +00:00
|
|
|
uint32_t channel;
|
|
|
|
|
int channel_valid;
|
|
|
|
|
uint32_t device_index;
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_stream_direction_t direction;
|
2004-08-13 13:24:48 +00:00
|
|
|
uint32_t requested_bytes;
|
2004-09-26 17:02:26 +00:00
|
|
|
uint64_t counter;
|
|
|
|
|
pa_usec_t previous_time;
|
2006-01-10 17:51:06 +00:00
|
|
|
pa_usec_t previous_ipol_time;
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_stream_state_t state;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_mcalign *mcalign;
|
2006-02-17 15:42:47 +00:00
|
|
|
pa_memchunk peek_memchunk;
|
|
|
|
|
pa_memblockq *record_memblockq;
|
2004-08-14 20:25:32 +00:00
|
|
|
|
2004-10-27 00:10:12 +00:00
|
|
|
int interpolate;
|
|
|
|
|
int corked;
|
|
|
|
|
|
|
|
|
|
uint32_t ipol_usec;
|
|
|
|
|
struct timeval ipol_timestamp;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_time_event *ipol_event;
|
2004-11-17 23:11:34 +00:00
|
|
|
int ipol_requested;
|
2004-10-27 00:10:12 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void (*state_callback)(pa_stream*c, void *userdata);
|
2004-08-14 20:25:32 +00:00
|
|
|
void *state_userdata;
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-02-17 15:42:47 +00:00
|
|
|
void (*read_callback)(pa_stream *p, size_t length, void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
void *read_userdata;
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void (*write_callback)(pa_stream *p, size_t length, void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
void *write_userdata;
|
|
|
|
|
};
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
typedef void (*pa_operation_callback)(void);
|
|
|
|
|
|
2004-08-14 20:25:32 +00:00
|
|
|
struct pa_operation {
|
|
|
|
|
int ref;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_context *context;
|
|
|
|
|
pa_stream *stream;
|
|
|
|
|
PA_LLIST_FIELDS(pa_operation);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_operation_state_t state;
|
2004-08-14 20:25:32 +00:00
|
|
|
void *userdata;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_operation_callback callback;
|
2004-08-13 13:24:48 +00:00
|
|
|
};
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa_command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
|
|
|
|
void pa_command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
|
|
|
|
void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_operation *pa_operation_new(pa_context *c, pa_stream *s);
|
|
|
|
|
void pa_operation_done(pa_operation *o);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
|
|
|
|
void pa_stream_disconnect_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
|
|
|
|
void pa_context_simple_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
|
|
|
|
void pa_stream_simple_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa_context_fail(pa_context *c, int error);
|
2006-01-27 16:25:31 +00:00
|
|
|
void pa_context_set_state(pa_context *c, pa_context_state_t st);
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t);
|
|
|
|
|
pa_operation* pa_context_send_simple_command(pa_context *c, uint32_t command, void (*internal_callback)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata), void (*cb)(void), void *userdata);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
void pa_stream_set_state(pa_stream *s, pa_stream_state_t st);
|
2004-08-13 13:24:48 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa_stream_trash_ipol(pa_stream *s);
|
2004-10-27 00:10:12 +00:00
|
|
|
|
|
|
|
|
|
2004-08-14 20:25:32 +00:00
|
|
|
#endif
|