8 struct sink_input* sink_input_new(struct sink *s, struct sample_spec *spec, const char *name) {
13 i = malloc(sizeof(struct sink_input));
15 i->name = name ? strdup(name) : NULL;
22 i->get_latency = NULL;
28 r = idxset_put(s->core->sink_inputs, i, &i->index);
29 assert(r == 0 && i->index != IDXSET_INVALID);
30 r = idxset_put(s->inputs, i, NULL);
36 void sink_input_free(struct sink_input* i) {
39 assert(i->sink && i->sink->core);
40 idxset_remove_by_data(i->sink->core->sink_inputs, i, NULL);
41 idxset_remove_by_data(i->sink->inputs, i, NULL);
47 void sink_input_kill(struct sink_input*i) {
54 char *sink_input_list_to_string(struct core *c) {
57 uint32_t index = IDXSET_INVALID;
63 strbuf_printf(s, "%u sink input(s) available.\n", idxset_ncontents(c->sink_inputs));
65 for (i = idxset_first(c->sink_inputs, &index); i; i = idxset_next(c->sink_inputs, &index)) {
67 strbuf_printf(s, " index: %u, name: <%s>, sink: <%u>; volume: <0x%02x>, latency: <%u usec>\n",
72 sink_input_get_latency(i));
75 return strbuf_tostring_free(s);
78 uint32_t sink_input_get_latency(struct sink_input *i) {
83 l += i->get_latency(i);
86 l += sink_get_latency(i->sink);