make native playback work

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@38 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-06-27 20:00:26 +00:00
parent 57dc42709f
commit 010378643e
4 changed files with 22 additions and 17 deletions

View file

@ -116,7 +116,7 @@ void iochannel_free(struct iochannel*io) {
if (io->input_source)
io->mainloop->cancel_io(io->mainloop, io->input_source);
if (io->output_source && io->output_source != io->input_source)
if (io->output_source && (io->output_source != io->input_source))
io->mainloop->cancel_io(io->mainloop, io->output_source);
free(io);

View file

@ -98,7 +98,7 @@ void ioline_set_callback(struct ioline*l, void (*callback)(struct ioline*io, con
static int do_read(struct ioline *l) {
ssize_t r;
size_t m, len;
char *p, *e;
char *e;
assert(l);
if (!iochannel_is_readable(l->io))
@ -135,21 +135,26 @@ static int do_read(struct ioline *l) {
e = memchr(l->rbuf+l->rbuf_index+l->rbuf_valid_length, '\n', r);
l->rbuf_valid_length += r;
if (!e && l->rbuf_valid_length >= BUFFER_LIMIT)
if (!e &&l->rbuf_valid_length >= BUFFER_LIMIT)
e = l->rbuf+BUFFER_LIMIT-1;
if (e) {
char *p;
*e = 0;
p = l->rbuf+l->rbuf_index;
m = strlen(p);
*e = 0;
p = l->rbuf+l->rbuf_index;
m = strlen(p);
if (l->callback)
l->callback(l, p, l->userdata);
if (l->callback)
l->callback(l, p, l->userdata);
l->rbuf_index += m+1;
l->rbuf_valid_length -= m+1;
l->rbuf_index += m+1;
l->rbuf_valid_length -= m+1;
if (l->rbuf_valid_length == 0)
l->rbuf_index = 0;
if (l->rbuf_valid_length == 0)
l->rbuf_index = 0;
}
return 0;
}
@ -184,7 +189,7 @@ static void io_callback(struct iochannel*io, void *userdata) {
return;
fail:
l->dead = 1;
if (l->callback)
l->callback(l, NULL, l->userdata);
l->dead = 1;
}

View file

@ -267,7 +267,7 @@ static int command_request(struct pdispatch *pd, uint32_t command, uint32_t tag,
return -1;
}
fprintf(stderr, "Requested %u bytes\n", bytes);
/*fprintf(stderr, "Requested %u bytes\n", bytes);*/
s->requested_bytes += bytes;
@ -426,7 +426,7 @@ void pa_stream_write(struct pa_stream *s, const void *data, size_t length) {
pstream_send_memblock(s->context->pstream, s->channel, 0, &chunk);
memblock_unref(chunk.memblock);
fprintf(stderr, "Sent %u bytes\n", length);
/*fprintf(stderr, "Sent %u bytes\n", length);*/
if (length < s->requested_bytes)
s->requested_bytes -= length;

View file

@ -157,7 +157,7 @@ static void request_bytes(struct playback_stream *s) {
tagstruct_putu32(t, l);
pstream_send_tagstruct(s->connection->pstream, t);
fprintf(stderr, "Requesting %u bytes\n", l);
/* fprintf(stderr, "Requesting %u bytes\n", l);*/
}
/*** sinkinput callbacks ***/
@ -327,7 +327,7 @@ static int memblock_callback(struct pstream *p, uint32_t channel, int32_t delta,
assert(stream->sink_input);
sink_notify(stream->sink_input->sink);
fprintf(stderr, "Recieved %u bytes.\n", chunk->length);
/*fprintf(stderr, "Recieved %u bytes.\n", chunk->length);*/
return 0;
}