From 1a5060720d67fa6e4d4cb3b08c5067ec5216b0fd Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 Jun 2004 00:29:01 +0000 Subject: oss output works git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@15 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/inputstream.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/inputstream.c') diff --git a/src/inputstream.c b/src/inputstream.c index 81719288..7ece3b5c 100644 --- a/src/inputstream.c +++ b/src/inputstream.c @@ -14,10 +14,13 @@ struct input_stream* input_stream_new(struct sink *s, struct sample_spec *spec, i->name = name ? strdup(name) : NULL; i->sink = s; i->spec = *spec; + i->kill = NULL; i->kill_userdata = NULL; + i->notify = NULL; + i->notify_userdata = NULL; - i->memblockq = memblockq_new(bytes_per_second(spec)*5, sample_size(spec)); + i->memblockq = memblockq_new(bytes_per_second(spec)*5, sample_size(spec), (size_t) -1); assert(i->memblockq); assert(s->core); @@ -45,7 +48,7 @@ void input_stream_free(struct input_stream* i) { void input_stream_notify_sink(struct input_stream *i) { assert(i); - if (memblockq_is_empty(i->memblockq)) + if (!memblockq_is_readable(i->memblockq)) return; sink_notify(i->sink); @@ -64,3 +67,16 @@ void input_stream_kill(struct input_stream*i) { if (i->kill) i->kill(i, i->kill_userdata); } + +void input_stream_set_notify_callback(struct input_stream *i, void (*notify)(struct input_stream*i, void *userdata), void *userdata) { + assert(i && notify); + + i->notify = notify; + i->notify_userdata = userdata; +} + +void input_stream_notify(struct input_stream *i) { + assert(i); + if (i->notify) + i->notify(i, i->notify_userdata); +} -- cgit