1 #ifndef foopolyplibinternalhfoo
2 #define foopolyplibinternalhfoo
7 This file is part of polypaudio.
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include "mainloop-api.h"
26 #include "socket-client.h"
28 #include "pdispatch.h"
31 #include "polyplib-context.h"
32 #include "polyplib-stream.h"
33 #include "polyplib-operation.h"
35 #include "native-common.h"
36 #include "client-conf.h"
40 #define DEFAULT_TIMEOUT (10)
46 pa_mainloop_api
* mainloop
;
48 pa_socket_client
*client
;
50 pa_pdispatch
*pdispatch
;
52 pa_dynarray
*record_streams
, *playback_streams
;
53 PA_LLIST_HEAD(pa_stream
, streams
);
54 PA_LLIST_HEAD(pa_operation
, operations
);
58 pa_context_state_t state
;
60 void (*state_callback
)(pa_context
*c
, void *userdata
);
63 void (*subscribe_callback
)(pa_context
*c
, pa_subscription_event_type_t t
, uint32_t idx
, void *userdata
);
64 void *subscribe_userdata
;
66 pa_memblock_stat
*memblock_stat
;
70 int autospawn_lock_fd
;
71 pa_spawn_api spawn_api
;
73 pa_strlist
*server_list
;
83 pa_mainloop_api
*mainloop
;
84 PA_LLIST_FIELDS(pa_stream
);
87 pa_buffer_attr buffer_attr
;
88 pa_sample_spec sample_spec
;
89 pa_channel_map channel_map
;
92 uint32_t device_index
;
93 pa_stream_direction_t direction
;
94 uint32_t requested_bytes
;
96 pa_usec_t previous_time
;
97 pa_usec_t previous_ipol_time
;
98 pa_stream_state_t state
;
105 struct timeval ipol_timestamp
;
106 pa_time_event
*ipol_event
;
109 void (*state_callback
)(pa_stream
*c
, void *userdata
);
110 void *state_userdata
;
112 void (*read_callback
)(pa_stream
*p
, const void*data
, size_t length
, void *userdata
);
115 void (*write_callback
)(pa_stream
*p
, size_t length
, void *userdata
);
116 void *write_userdata
;
119 typedef void (*pa_operation_callback
)(void);
121 struct pa_operation
{
125 PA_LLIST_FIELDS(pa_operation
);
127 pa_operation_state_t state
;
129 pa_operation_callback callback
;
132 void pa_command_request(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
133 void pa_command_stream_killed(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
134 void pa_command_subscribe_event(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
136 pa_operation
*pa_operation_new(pa_context
*c
, pa_stream
*s
);
137 void pa_operation_done(pa_operation
*o
);
139 void pa_create_stream_callback(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
140 void pa_stream_disconnect_callback(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
141 void pa_context_simple_ack_callback(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
142 void pa_stream_simple_ack_callback(pa_pdispatch
*pd
, uint32_t command
, uint32_t tag
, pa_tagstruct
*t
, void *userdata
);
144 void pa_context_fail(pa_context
*c
, int error
);
145 void pa_context_set_state(pa_context
*c
, pa_context_state_t st
);
146 int pa_context_handle_error(pa_context
*c
, uint32_t command
, pa_tagstruct
*t
);
147 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
);
149 void pa_stream_set_state(pa_stream
*s
, pa_stream_state_t st
);
151 void pa_stream_trash_ipol(pa_stream
*s
);