summaryrefslogtreecommitdiffstats
path: root/src/modules/module-stream-restore.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@digia.com>2011-02-14 13:41:06 +0200
committerColin Guthrie <cguthrie@mandriva.org>2011-02-22 20:12:31 +0000
commit99ddca89cdca9b0b92ab9870764f9211e6a82e31 (patch)
treecaa9634df48e0383a26c7e7e012ee49c5786cf01 /src/modules/module-stream-restore.c
parentfa12d2a8a88c0eed7b460cde033af0573070696b (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/modules/module-stream-restore.c')
-rw-r--r--src/modules/module-stream-restore.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index f8fecd89..f4e4a55c 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1168,6 +1168,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
}
if (sink_input->save_volume) {
+ pa_assert(pa_sink_input_is_volume_writable(sink_input));
+
entry.channel_map = sink_input->channel_map;
pa_sink_input_get_volume(sink_input, &entry.volume, FALSE);
entry.volume_valid = TRUE;
@@ -1327,8 +1329,11 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
if ((e = read_entry(u, name))) {
if (u->restore_volume && e->volume_valid) {
-
- if (!new_data->volume_is_set) {
+ if (!pa_sink_input_new_data_is_volume_writable(new_data))
+ pa_log_debug("Not restoring volume for sink input %s, because its volume can't be changed.", name);
+ else if (new_data->volume_is_set)
+ pa_log_debug("Not restoring volume for sink input %s, because already set.", name);
+ else {
pa_cvolume v;
pa_log_info("Restoring volume for sink input %s.", name);
@@ -1339,8 +1344,7 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu
new_data->volume_is_absolute = FALSE;
new_data->save_volume = TRUE;
- } else
- pa_log_debug("Not restoring volume for sink input %s, because already set.", name);
+ }
}
if (u->restore_muted && e->muted_valid) {
@@ -1615,7 +1619,7 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
}
pa_xfree(n);
- if (u->restore_volume && e->volume_valid) {
+ if (u->restore_volume && e->volume_valid && pa_sink_input_is_volume_writable(si)) {
pa_cvolume v;
v = e->volume;