[pulseaudio-commits] src/pulsecore

David Henningsson diwic at kemper.freedesktop.org
Tue Oct 16 07:10:32 PDT 2012


 src/pulsecore/cli-text.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 9e1627e2a3d06f2e2deed3d32e0cc503abdb3f80
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Tue Oct 16 16:05:52 2012 +0200

    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 <daniel.manrique at canonical.com>
    Reported-by: Brendan Donegan <brendan.donegan at canonical.com>
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 0df17e5..238fbd8 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -37,6 +37,7 @@
 #include <pulsecore/core-scache.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/namereg.h>
 
 #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,



More information about the pulseaudio-commits mailing list