1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
From ba9a3b553e6099ebba6185edad28b7147e70b212 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Marc-Andr=C3=A9=20Lureau?= <marc-andre.lureau@nokia.com>
Date: Tue, 10 Mar 2009 20:08:59 +0200
Subject: [PATCH 26/85] pulsecore: notify flatten upstream slaved sink of volume change
---
src/pulsecore/sink.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 02405cb..b9b8ae2 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1201,6 +1201,30 @@ void pa_sink_propagate_flat_volume(pa_sink *s) {
propagate_flat_volume(s, s);
}
+static void post_virtual_volume_changed(pa_sink *s) {
+ pa_cvolume new_virtual_volume;
+ pa_sink_input *i;
+ uint32_t idx;
+
+ pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+
+ if (!(s->flags & PA_SINK_FLAT_VOLUME))
+ return;
+
+ for (i = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); i; i = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) {
+ if (!i->origin_sink)
+ continue;
+
+ new_virtual_volume = s->virtual_volume;
+ pa_cvolume_remap(&new_virtual_volume, &s->channel_map, &i->origin_sink->channel_map);
+
+ if (!pa_cvolume_equal(&new_virtual_volume, &i->origin_sink->virtual_volume)) {
+ i->origin_sink->virtual_volume = new_virtual_volume;
+ post_virtual_volume_changed(i->origin_sink);
+ }
+ }
+}
+
/* Called from main thread */
void pa_sink_set_volume(pa_sink *s, const pa_cvolume *volume, pa_bool_t propagate, pa_bool_t sendmsg, pa_bool_t become_reference) {
pa_bool_t virtual_volume_changed;
@@ -1256,7 +1280,7 @@ void pa_sink_set_volume(pa_sink *s, const pa_cvolume *volume, pa_bool_t propagat
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_SET_VOLUME, NULL, 0, NULL) == 0);
if (virtual_volume_changed)
- pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
+ post_virtual_volume_changed(s);
}
/* Called from main thread. Only to be called by sink implementor */
--
1.6.3.3
|