sad

simple audio daemon
git clone git://git.2f30.org/sad
Log | Files | Refs | LICENSE

commit cec480df0a6a6083a02b3d54dbe547c5372360a7
parent 5c3a17fdc67f0cd079e3a11736c21f63fd783e08
Author: sin <sin@2f30.org>
Date:   Sat, 27 Dec 2014 11:36:57 +0000

Add close output functions

Diffstat:
Moutput.c | 25+++++++++++++++++++++++++
Msad.h | 2++
2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/output.c b/output.c @@ -44,6 +44,31 @@ openoutput(const char *name) } int +closeoutput(const char *name) +{ + int i; + + for (i = 0; i < LEN(outputs); i++) { + if (!outputs[i].enabled) + continue; + if (strcmp(outputs[i].name, name)) + continue; + return outputs[i].output->close(); + } +} + +int +closeoutputs(void) +{ + int i, r = 0; + + for (i = 0; i < LEN(outputs); i++) + if (closeoutput(outputs[i].name) < 0) + r = -1; + return r; +} + +int openoutputs(void) { int i, r = 0; diff --git a/sad.h b/sad.h @@ -92,5 +92,7 @@ Decoder *matchdecoder(const char *); /* output.c */ int openoutput(const char *); int openoutputs(void); +int closeoutput(const char *); +int closeoutputs(void); int playoutput(void *, size_t); int voloutput(int);