mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
some more work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@23 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
993d1bce74
commit
382e7aefd4
14 changed files with 147 additions and 36 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue