summaryrefslogtreecommitdiff
path: root/src/librygel-renderer/rygel-rendering-control.vala
diff options
context:
space:
mode:
authorRichard Röjfors <richard.rojfors@gmail.com>2013-10-05 22:26:52 +0200
committerJens Georg <jensg@openismus.com>2013-10-07 16:58:22 +0200
commit34113f46a5bf3232a8112a00b4b3f9a3bc30c770 (patch)
tree17c80cec106ea89ed7bff5e2cd8e49e924a42768 /src/librygel-renderer/rygel-rendering-control.vala
parent82bfc8ddeac1cc775c3ba91f0120f49a73db0701 (diff)
downloadrygel-34113f46a5bf3232a8112a00b4b3f9a3bc30c770.tar.gz
librygel-renderer: Allow underlying player to notify on volume changes
Currently there is no notification support on volume. The last set value of the volume (via upnp) is cached in rygel-rendering-control. But if the volume of the underlying renderer can be changed in another way, for instance on a local UI. Such change is not picked up by rygel-rendering-control and any control point would not be aware of the volume change. This patch adds notification support for volume. Signed-off-by: Richard Röjfors <richard.rojfors@gmail.com>
Diffstat (limited to 'src/librygel-renderer/rygel-rendering-control.vala')
-rw-r--r--src/librygel-renderer/rygel-rendering-control.vala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/librygel-renderer/rygel-rendering-control.vala b/src/librygel-renderer/rygel-rendering-control.vala
index bbbca37f..01e727b9 100644
--- a/src/librygel-renderer/rygel-rendering-control.vala
+++ b/src/librygel-renderer/rygel-rendering-control.vala
@@ -92,6 +92,8 @@ internal class Rygel.RenderingControl : Service {
action_invoked["GetVolume"].connect (this.get_volume_cb);
action_invoked["SetVolume"].connect (this.set_volume_cb);
+ this.player.notify["volume"].connect (this.notify_volume_cb);
+
this._mute = this.player.volume == 0;
this._volume = Volume.to_percentage (this.player.volume);
}
@@ -273,4 +275,20 @@ internal class Rygel.RenderingControl : Service {
action.return ();
}
+
+ private void notify_volume_cb (Object player, ParamSpec p) {
+ this._volume = Volume.to_percentage (this.player.volume);
+
+ if (this._mute && this.player.volume > 0) {
+ // We are not muted anymore...
+ this._mute = false;
+ this.changelog.log_with_channel ("Mute",
+ "0",
+ "Master");
+ }
+
+ this.changelog.log_with_channel ("Volume",
+ this.volume.to_string (),
+ "Master");
+ }
}