summaryrefslogtreecommitdiffstats
path: root/src/sinkinput.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-06-18 17:12:50 +0000
committerLennart Poettering <lennart@poettering.net>2004-06-18 17:12:50 +0000
commit382e7aefd471a4600010a04e6497d4bfd2fd8663 (patch)
treeadd805dc36fdc446c11a46a0e598e8053ebd8c77 /src/sinkinput.c
parent993d1bce74f4cc5be2bfa69a467aae106e2194ab (diff)
some more work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@23 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/sinkinput.c')
-rw-r--r--src/sinkinput.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/sinkinput.c b/src/sinkinput.c
index ae7b27ff..f589b4d9 100644
--- a/src/sinkinput.c
+++ b/src/sinkinput.c
@@ -3,6 +3,7 @@
#include <string.h>
#include "sinkinput.h"
+#include "strbuf.h"
struct sink_input* sink_input_new(struct sink *s, struct sample_spec *spec, const char *name) {
struct sink_input *i;
@@ -18,6 +19,7 @@ struct sink_input* sink_input_new(struct sink *s, struct sample_spec *spec, cons
i->peek = NULL;
i->drop = NULL;
i->kill = NULL;
+ i->get_latency = NULL;
i->userdata = NULL;
assert(s->core);
@@ -46,3 +48,40 @@ void sink_input_kill(struct sink_input*i) {
if (i->kill)
i->kill(i);
}
+
+char *sink_input_list_to_string(struct core *c) {
+ struct strbuf *s;
+ struct sink_input *i;
+ uint32_t index = IDXSET_INVALID;
+ assert(c);
+
+ s = strbuf_new();
+ assert(s);
+
+ strbuf_printf(s, "%u sink input(s) available.\n", idxset_ncontents(c->sink_inputs));
+
+ for (i = idxset_first(c->sink_inputs, &index); i; i = idxset_next(c->sink_inputs, &index)) {
+ assert(i->sink);
+ strbuf_printf(s, " index: %u, name: <%s>, sink: <%u>; volume: <0x%02x>, latency: <%u usec>\n",
+ i->index,
+ i->name,
+ i->sink->index,
+ (unsigned) i->volume,
+ sink_input_get_latency(i));
+ }
+
+ return strbuf_tostring_free(s);
+}
+
+uint32_t sink_input_get_latency(struct sink_input *i) {
+ uint32_t l = 0;
+
+ assert(i);
+ if (i->get_latency)
+ l += i->get_latency(i);
+
+ assert(i->sink);
+ l += sink_get_latency(i->sink);
+
+ return l;
+}