[rygel/rygel-0-20] librygel-renderer: Allow underlying player to notify on volume changes
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/rygel-0-20] librygel-renderer: Allow underlying player to notify on volume changes
- Date: Mon, 14 Oct 2013 10:12:37 +0000 (UTC)
commit fc0ddf7054fb34141f45f3879de13d05567784a3
Author: Richard Röjfors <richard rojfors gmail com>
Date: Sat Oct 5 22:26:52 2013 +0200
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>
src/librygel-renderer/rygel-rendering-control.vala | 18 ++++++++++++++++++
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 bbbca37..01e727b 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");
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]