From 9e1627e2a3d06f2e2deed3d32e0cc503abdb3f80 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Tue, 16 Oct 2012 16:05:52 +0200 Subject: [PATCH] cli: Output asterisk when default sink/source is found These days we don't set core->default_sink/source as soon as somebody asks for it. To retain consistent behaviour (i e the asterisk), we need to call pa_namereg_get_default_sink/source. Reported-by: Daniel Manrique Reported-by: Brendan Donegan Signed-off-by: David Henningsson --- src/pulsecore/cli-text.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index 0df17e5a..238fbd8a 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "cli-text.h" @@ -233,7 +234,7 @@ static const char *source_state_to_string(pa_source_state_t state) { char *pa_sink_list_to_string(pa_core *c) { pa_strbuf *s; - pa_sink *sink; + pa_sink *sink, *default_sink; uint32_t idx = PA_IDXSET_INVALID; pa_assert(c); @@ -241,6 +242,8 @@ char *pa_sink_list_to_string(pa_core *c) { pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_size(c->sinks)); + default_sink = pa_namereg_get_default_sink(c); + PA_IDXSET_FOREACH(sink, c->sinks, idx) { char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], @@ -275,7 +278,7 @@ char *pa_sink_list_to_string(pa_core *c) { "\tchannel map: %s%s%s\n" "\tused by: %u\n" "\tlinked by: %u\n", - sink == c->default_sink ? '*' : ' ', + sink == default_sink ? '*' : ' ', sink->index, sink->name, sink->driver, @@ -352,7 +355,7 @@ char *pa_sink_list_to_string(pa_core *c) { char *pa_source_list_to_string(pa_core *c) { pa_strbuf *s; - pa_source *source; + pa_source *source, *default_source; uint32_t idx = PA_IDXSET_INVALID; pa_assert(c); @@ -360,6 +363,8 @@ char *pa_source_list_to_string(pa_core *c) { pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_size(c->sources)); + default_source = pa_namereg_get_default_source(c); + PA_IDXSET_FOREACH(source, c->sources, idx) { char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], @@ -391,7 +396,7 @@ char *pa_source_list_to_string(pa_core *c) { "\tchannel map: %s%s%s\n" "\tused by: %u\n" "\tlinked by: %u\n", - c->default_source == source ? '*' : ' ', + source == default_source ? '*' : ' ', source->index, source->name, source->driver, -- 2.39.2