From 99ddca89cdca9b0b92ab9870764f9211e6a82e31 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Mon, 14 Feb 2011 13:41:06 +0200 Subject: 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()). --- src/pulsecore/cli-command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/pulsecore/cli-command.c') diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index a18ebd33..18dfb4c3 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -579,11 +579,16 @@ static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strb return -1; } - if (!(si = pa_idxset_get_by_index(c->sink_inputs, (uint32_t) idx))) { + if (!(si = pa_idxset_get_by_index(c->sink_inputs, idx))) { pa_strbuf_puts(buf, "No sink input found with this index.\n"); return -1; } + if (!pa_sink_input_is_volume_writable(si)) { + pa_strbuf_puts(buf, "This sink input's volume can't be changed.\n"); + return -1; + } + pa_cvolume_set(&cvolume, 1, volume); pa_sink_input_set_volume(si, &cvolume, TRUE, TRUE); return 0; -- cgit