From 382e7aefd471a4600010a04e6497d4bfd2fd8663 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 18 Jun 2004 17:12:50 +0000 Subject: some more work git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@23 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/sinkinput.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/sinkinput.c') 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 #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; +} -- cgit