diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-06-08 23:54:24 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-06-08 23:54:24 +0000 |
commit | 9cb0b933e260008c6a03e24a4a149f726b8d86b2 (patch) | |
tree | b54651bafe32d1a817e779f884d1628176465bf0 /src/outputstream.c | |
parent | b1c00dcd0ae51d201f772e7f5fa61acae436a2cf (diff) |
initial commit
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@3 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/outputstream.c')
-rw-r--r-- | src/outputstream.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/outputstream.c b/src/outputstream.c new file mode 100644 index 00000000..ffec77da --- /dev/null +++ b/src/outputstream.c @@ -0,0 +1,41 @@ +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "outputstream.h" + +struct output_stream* output_stream_new(struct source *s, struct sample_spec *spec, const char *name) { + struct output_stream *o; + int r; + assert(s && spec); + + o = malloc(sizeof(struct output_stream)); + assert(o); + o->name = name ? strdup(name) : NULL; + o->source = s; + o->spec = *spec; + + o->memblockq = memblockq_new(bytes_per_second(spec)*5, sample_size(spec)); + assert(o->memblockq); + + assert(s->core); + r = idxset_put(s->core->output_streams, o, &o->index); + assert(r == 0 && o->index != IDXSET_INVALID); + r = idxset_put(s->output_streams, o, NULL); + assert(r == 0); + + return o; +} + +void output_stream_free(struct output_stream* o) { + assert(o); + + memblockq_free(o->memblockq); + + assert(o->source && o->source->core); + idxset_remove_by_data(o->source->core->output_streams, o, NULL); + idxset_remove_by_data(o->source->output_streams, o, NULL); + + free(o->name); + free(o); +} |