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()).
This commit is contained in:
Tanu Kaskinen 2011-02-14 13:41:06 +02:00 committed by Colin Guthrie
parent fa12d2a8a8
commit 99ddca89cd
9 changed files with 156 additions and 63 deletions

View file

@ -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;