summaryrefslogtreecommitdiffstats
path: root/src/sourceoutput.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sourceoutput.c')
-rw-r--r--src/sourceoutput.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/src/sourceoutput.c b/src/sourceoutput.c
index c3f68a0e..d4e7a50f 100644
--- a/src/sourceoutput.c
+++ b/src/sourceoutput.c
@@ -2,56 +2,46 @@
#include <stdlib.h>
#include <string.h>
-#include "outputstream.h"
+#include "sourceoutput.h"
-struct output_stream* output_stream_new(struct source *s, struct sample_spec *spec, const char *name) {
- struct output_stream *o;
+struct source_output* source_output_new(struct source *s, struct sample_spec *spec, const char *name) {
+ struct source_output *o;
int r;
assert(s && spec);
- o = malloc(sizeof(struct output_stream));
+ o = malloc(sizeof(struct source_output));
assert(o);
o->name = name ? strdup(name) : NULL;
o->source = s;
o->spec = *spec;
- o->kill = NULL;
- o->kill_userdata = NULL;
- o->memblockq = memblockq_new(bytes_per_second(spec)*5, sample_size(spec), (size_t) -1);
- assert(o->memblockq);
+ o->push = NULL;
+ o->kill = NULL;
+ o->userdata = NULL;
assert(s->core);
- r = idxset_put(s->core->output_streams, o, &o->index);
+ r = idxset_put(s->core->source_outputs, o, &o->index);
assert(r == 0 && o->index != IDXSET_INVALID);
- r = idxset_put(s->output_streams, o, NULL);
+ r = idxset_put(s->outputs, o, NULL);
assert(r == 0);
return o;
}
-void output_stream_free(struct output_stream* o) {
+void source_output_free(struct source_output* 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);
+ idxset_remove_by_data(o->source->core->source_outputs, o, NULL);
+ idxset_remove_by_data(o->source->outputs, o, NULL);
free(o->name);
free(o);
}
-void output_stream_set_kill_callback(struct output_stream *i, void (*kill)(struct output_stream*i, void *userdata), void *userdata) {
- assert(i && kill);
- i->kill = kill;
- i->kill_userdata = userdata;
-}
-
-
-void output_stream_kill(struct output_stream*i) {
+void source_output_kill(struct source_output*i) {
assert(i);
if (i->kill)
- i->kill(i, i->kill_userdata);
+ i->kill(i);
}