From b24546bedee168778a7aef11200dfb0378dfae43 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 Jun 2004 17:05:03 +0000 Subject: cleanup git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@18 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/source.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/source.c') diff --git a/src/source.c b/src/source.c index a7fc9a64..e01e9f83 100644 --- a/src/source.c +++ b/src/source.c @@ -4,7 +4,7 @@ #include #include "source.h" -#include "outputstream.h" +#include "sourceoutput.h" struct source* source_new(struct core *core, const char *name, const struct sample_spec *spec) { struct source *s; @@ -15,31 +15,31 @@ struct source* source_new(struct core *core, const char *name, const struct samp assert(s); s->name = name ? strdup(name) : NULL; - r = idxset_put(core->sources, s, &s->index); - assert(s->index != IDXSET_INVALID && r >= 0); - s->core = core; s->sample_spec = *spec; - s->output_streams = idxset_new(NULL, NULL); + s->outputs = idxset_new(NULL, NULL); - s->link_change_callback = NULL; + s->notify = NULL; s->userdata = NULL; + r = idxset_put(core->sources, s, &s->index); + assert(s->index != IDXSET_INVALID && r >= 0); + fprintf(stderr, "source: created %u \"%s\"\n", s->index, s->name); return s; } void source_free(struct source *s) { - struct output_stream *o, *j = NULL; + struct source_output *o, *j = NULL; assert(s); - while ((o = idxset_first(s->output_streams, NULL))) { + while ((o = idxset_first(s->outputs, NULL))) { assert(o != j); - output_stream_free(o); + source_output_kill(o); j = o; } - idxset_free(s->output_streams, NULL, NULL); + idxset_free(s->outputs, NULL, NULL); idxset_remove_by_data(s->core->sources, s, NULL); @@ -49,17 +49,24 @@ void source_free(struct source *s) { free(s); } +void source_notify(struct source*s) { + assert(s); + + if (s->notify) + s->notify(s); +} + static int do_post(void *p, uint32_t index, int *del, void*userdata) { struct memchunk *chunk = userdata; - struct output_stream *o = p; - assert(o && o->memblockq && index && del && chunk); + struct source_output *o = p; + assert(o && o->push && index && del && chunk); - memblockq_push(o->memblockq, chunk, 0); + o->push(o, chunk); return 0; } void source_post(struct source*s, struct memchunk *chunk) { assert(s && chunk); - idxset_foreach(s->output_streams, do_post, chunk); + idxset_foreach(s->outputs, do_post, chunk); } -- cgit