by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
along with polypaudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
along with polypaudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
struct pa_source_output *source_output;
struct pa_memblockq *input_memblockq, *output_memblockq;
struct pa_defer_event *defer_event;
struct pa_source_output *source_output;
struct pa_memblockq *input_memblockq, *output_memblockq;
struct pa_defer_event *defer_event;
struct {
struct pa_memblock *current_memblock;
size_t memblock_index, fragment_size;
} playback;
struct {
struct pa_memblock *current_memblock;
size_t memblock_index, fragment_size;
} playback;
static int sink_input_peek_cb(struct pa_sink_input *i, struct pa_memchunk *chunk);
static void sink_input_kill_cb(struct pa_sink_input *i);
static pa_usec_t sink_input_get_latency_cb(struct pa_sink_input *i);
static int sink_input_peek_cb(struct pa_sink_input *i, struct pa_memchunk *chunk);
static void sink_input_kill_cb(struct pa_sink_input *i);
static pa_usec_t sink_input_get_latency_cb(struct pa_sink_input *i);
static void source_output_push_cb(struct pa_source_output *o, const struct pa_memchunk *chunk);
static void source_output_kill_cb(struct pa_source_output *o);
static void source_output_push_cb(struct pa_source_output *o, const struct pa_memchunk *chunk);
static void source_output_kill_cb(struct pa_source_output *o);
static int esd_proto_sample_cache(struct connection *c, esd_proto_t request, const void *data, size_t length);
static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t request, const void *data, size_t length);
static int esd_proto_sample_get_id(struct connection *c, esd_proto_t request, const void *data, size_t length);
static int esd_proto_sample_cache(struct connection *c, esd_proto_t request, const void *data, size_t length);
static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t request, const void *data, size_t length);
static int esd_proto_sample_get_id(struct connection *c, esd_proto_t request, const void *data, size_t length);
{ ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream rec" },
{ ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream mon" },
{ ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream rec" },
{ ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream mon" },
- { ESD_NAME_MAX + 3 * sizeof(int), esd_proto_sample_cache, "sample cache" },
+ { ESD_NAME_MAX + 3 * sizeof(int), esd_proto_sample_cache, "sample cache" }, /* 6 */
{ sizeof(int), esd_proto_sample_free_or_play, "sample free" },
{ sizeof(int), esd_proto_sample_free_or_play, "sample free" },
- { sizeof(int), esd_proto_sample_free_or_play, "sample play" },
+ { sizeof(int), esd_proto_sample_free_or_play, "sample play" }, /* 8 */
{ sizeof(int), NULL, "sample loop" },
{ sizeof(int), NULL, "sample stop" },
{ -1, NULL, "TODO: sample kill" },
{ sizeof(int), NULL, "sample loop" },
{ sizeof(int), NULL, "sample stop" },
{ -1, NULL, "TODO: sample kill" },
- { ESD_KEY_LEN + sizeof(int), NULL, "standby" },
- { ESD_KEY_LEN + sizeof(int), NULL, "resume" },
+ { ESD_KEY_LEN + sizeof(int), esd_proto_standby_or_resume, "standby" }, /* NOOP! */
+ { ESD_KEY_LEN + sizeof(int), esd_proto_standby_or_resume, "resume" }, /* NOOP! */ /* 13 */
- { ESD_NAME_MAX, esd_proto_sample_get_id, "sample getid" },
+ { ESD_NAME_MAX, esd_proto_sample_get_id, "sample getid" }, /* 14 */
{ ESD_NAME_MAX + 2 * sizeof(int), NULL, "stream filter" },
{ sizeof(int), esd_proto_server_info, "server info" },
{ ESD_NAME_MAX + 2 * sizeof(int), NULL, "stream filter" },
{ sizeof(int), esd_proto_server_info, "server info" },
- if (c->scache_memchunk.memblock)
- pa_memblock_unref(c->scache_memchunk.memblock);
- pa_xfree(c->scache_name);
+ if (c->scache.memchunk.memblock)
+ pa_memblock_unref(c->scache.memchunk.memblock);
+ pa_xfree(c->scache.name);
strncpy(name, (char*) data + sizeof(int)*2, sizeof(name));
name[sizeof(name)-1] = 0;
strncpy(name, (char*) data + sizeof(int)*2, sizeof(name));
name[sizeof(name)-1] = 0;
- c->sink_input = pa_sink_input_new(sink, name, &ss, 0);
+ c->sink_input = pa_sink_input_new(sink, name, &ss, 0, -1);
strncpy(name, (char*) data + sizeof(int)*2, sizeof(name));
name[sizeof(name)-1] = 0;
strncpy(name, (char*) data + sizeof(int)*2, sizeof(name));
name[sizeof(name)-1] = 0;
pa_iochannel_socket_set_sndbuf(c->io, l/RECORD_BUFFER_FRAGMENTS*2);
assert(!c->source_output);
pa_iochannel_socket_set_sndbuf(c->io, l/RECORD_BUFFER_FRAGMENTS*2);
assert(!c->source_output);
- c->source_output = pa_source_output_new(source, name, &ss);
+ c->source_output = pa_source_output_new(source, name, &ss, -1);
assert(c->source_output);
c->source_output->owner = c->protocol->module;
c->source_output->client = c->client;
c->source_output->push = source_output_push_cb;
c->source_output->kill = source_output_kill_cb;
assert(c->source_output);
c->source_output->owner = c->protocol->module;
c->source_output->client = c->client;
c->source_output->push = source_output_push_cb;
c->source_output->kill = source_output_kill_cb;
strncpy(name+sizeof(SCACHE_PREFIX)-1, (char*) data+3*sizeof(int), ESD_NAME_MAX);
name[sizeof(name)-1] = 0;
strncpy(name+sizeof(SCACHE_PREFIX)-1, (char*) data+3*sizeof(int), ESD_NAME_MAX);
name[sizeof(name)-1] = 0;
- assert(!c->scache_memchunk.memblock);
- c->scache_memchunk.memblock = pa_memblock_new(sc_length, c->protocol->core->memblock_stat);
- c->scache_memchunk.index = 0;
- c->scache_memchunk.length = sc_length;
- c->scache_sample_spec = ss;
- assert(!c->scache_name);
- c->scache_name = pa_xstrdup(name);
+ assert(!c->scache.memchunk.memblock);
+ c->scache.memchunk.memblock = pa_memblock_new(sc_length, c->protocol->core->memblock_stat);
+ c->scache.memchunk.index = 0;
+ c->scache.memchunk.length = sc_length;
+ c->scache.sample_spec = ss;
+ assert(!c->scache.name);
+ c->scache.name = pa_xstrdup(name);
- pa_scache_add_item(c->protocol->core, c->scache_name, NULL, NULL, &index, 0);
+ pa_scache_add_item(c->protocol->core, c->scache.name, NULL, NULL, &index);
- if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache_memchunk.memblock->data+c->scache_memchunk.index, c->scache_memchunk.length-c->scache_memchunk.index)) <= 0) {
+ if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache.memchunk.memblock->data+c->scache.memchunk.index, c->scache.memchunk.length-c->scache.memchunk.index)) <= 0) {
- c->scache_memchunk.index = 0;
- pa_scache_add_item(c->protocol->core, c->scache_name, &c->scache_sample_spec, &c->scache_memchunk, &index, 0);
+ c->scache.memchunk.index = 0;
+ pa_scache_add_item(c->protocol->core, c->scache.name, &c->scache.sample_spec, &c->scache.memchunk, &index);
- pa_memblock_unref(c->scache_memchunk.memblock);
- c->scache_memchunk.memblock = NULL;
- c->scache_memchunk.index = c->scache_memchunk.length = 0;
+ pa_memblock_unref(c->scache.memchunk.memblock);
+ c->scache.memchunk.memblock = NULL;
+ c->scache.memchunk.index = c->scache.memchunk.length = 0;
assert(c->protocol && c->protocol->core && c->protocol->core->mainloop && c->protocol->core->mainloop->defer_enable);
c->protocol->core->mainloop->defer_enable(c->defer_event, 0);
assert(c->protocol && c->protocol->core && c->protocol->core->mainloop && c->protocol->core->mainloop->defer_enable);
c->protocol->core->mainloop->defer_enable(c->defer_event, 0);
}
static void io_callback(struct pa_iochannel*io, void *userdata) {
struct connection *c = userdata;
assert(io && c && c->io == io);
}
static void io_callback(struct pa_iochannel*io, void *userdata) {
struct connection *c = userdata;
assert(io && c && c->io == io);
pa_memblockq_drop(c->input_memblockq, chunk, length);
/* do something */
assert(c->protocol && c->protocol->core && c->protocol->core->mainloop && c->protocol->core->mainloop->defer_enable);
pa_memblockq_drop(c->input_memblockq, chunk, length);
/* do something */
assert(c->protocol && c->protocol->core && c->protocol->core->mainloop && c->protocol->core->mainloop->defer_enable);
static pa_usec_t sink_input_get_latency_cb(struct pa_sink_input *i) {
struct connection*c = i->userdata;
assert(i && c);
static pa_usec_t sink_input_get_latency_cb(struct pa_sink_input *i) {
struct connection*c = i->userdata;
assert(i && c);
/*** socket server callback ***/
static void on_connection(struct pa_socket_server*s, struct pa_iochannel *io, void *userdata) {
/*** socket server callback ***/
static void on_connection(struct pa_socket_server*s, struct pa_iochannel *io, void *userdata) {
c->defer_event = c->protocol->core->mainloop->defer_new(c->protocol->core->mainloop, defer_callback, c);
assert(c->defer_event);
c->defer_event = c->protocol->core->mainloop->defer_new(c->protocol->core->mainloop, defer_callback, c);
assert(c->defer_event);