diff options
author | Tanu Kaskinen <tanu.kaskinen@digia.com> | 2011-02-14 13:41:06 +0200 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2011-02-22 20:12:31 +0000 |
commit | 99ddca89cdca9b0b92ab9870764f9211e6a82e31 (patch) | |
tree | caa9634df48e0383a26c7e7e012ee49c5786cf01 /src/pulsecore/cli-text.c | |
parent | fa12d2a8a88c0eed7b460cde033af0573070696b (diff) |
Allow read-only or non-existing sink input volume.
There are two known cases where read-only or non-existing sink input volume is
relevant: passthrough streams and the planned volume sharing logic.
Passthrough streams don't have volume at all, and the volume sharing logic
requires read-only sink input volume. This commit is primarily working towards
the volume sharing feature, but support for non-existing sink input volume is
also added, because it is so closely related to read-only volume.
Some unrelated refactoring in iface-stream.c creeped into this commit too (new
function: stream_to_string()).
Diffstat (limited to 'src/pulsecore/cli-text.c')
-rw-r--r-- | src/pulsecore/cli-text.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index 23a57d37..e6018da2 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -553,8 +553,7 @@ char *pa_sink_input_list_to_string(pa_core *c) { pa_usec_t cl; const char *cmn; pa_cvolume v; - - pa_sink_input_get_volume(i, &v, TRUE); + char *volume_str = NULL; cmn = pa_channel_map_to_pretty_name(&i->channel_map); @@ -565,6 +564,15 @@ char *pa_sink_input_list_to_string(pa_core *c) { pa_assert(i->sink); + if (pa_sink_input_is_volume_readable(i)) { + pa_sink_input_get_volume(i, &v, TRUE); + volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f", + pa_cvolume_snprint(cv, sizeof(cv), &v), + pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v), + pa_cvolume_get_balance(&v, &i->channel_map)); + } else + volume_str = pa_xstrdup("n/a"); + pa_strbuf_printf( s, " index: %u\n" @@ -573,8 +581,6 @@ char *pa_sink_input_list_to_string(pa_core *c) { "\tstate: %s\n" "\tsink: %u <%s>\n" "\tvolume: %s\n" - "\t %s\n" - "\t balance %0.2f\n" "\tmuted: %s\n" "\tcurrent latency: %0.2f ms\n" "\trequested latency: %s\n" @@ -596,9 +602,7 @@ char *pa_sink_input_list_to_string(pa_core *c) { i->flags & PA_SINK_INPUT_KILL_ON_SUSPEND ? "KILL_ON_SUSPEND " : "", state_table[pa_sink_input_get_state(i)], i->sink->index, i->sink->name, - pa_cvolume_snprint(cv, sizeof(cv), &v), - pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v), - pa_cvolume_get_balance(&v, &i->channel_map), + volume_str, pa_yes_no(pa_sink_input_get_mute(i)), (double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC, clt, @@ -608,6 +612,8 @@ char *pa_sink_input_list_to_string(pa_core *c) { cmn ? cmn : "", pa_resample_method_to_string(pa_sink_input_get_resample_method(i))); + pa_xfree(volume_str); + if (i->module) pa_strbuf_printf(s, "\tmodule: %u\n", i->module->index); if (i->client) |