diff options
Diffstat (limited to 'src/outputstream.c')
-rw-r--r-- | src/outputstream.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/outputstream.c b/src/outputstream.c index ffec77da..c6681d29 100644 --- a/src/outputstream.c +++ b/src/outputstream.c @@ -14,6 +14,8 @@ struct output_stream* output_stream_new(struct source *s, struct sample_spec *sp 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)); assert(o->memblockq); @@ -39,3 +41,17 @@ void output_stream_free(struct output_stream* o) { 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) { + assert(i); + + if (i->kill) + i->kill(i, i->kill_userdata); +} |