From d4d6305d6b665646b7653379a3d6b7d5e3a42dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20R=C3=B6jfors?= Date: Sun, 28 Sep 2014 10:48:20 +0200 Subject: renderer: Allow the controller to expose its play mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the play mode is hardcoded into the AV transport. Since we now support external controllers it makes sense to let them own the play mode since they own the playlist. This patch moves the playmode to the controller. Signed-off-by: Richard Röjfors https://bugzilla.gnome.org/show_bug.cgi?id=737513 --- src/librygel-renderer/rygel-av-transport.vala | 22 +++++++--------------- .../rygel-default-player-controller.vala | 15 +++++++++++++++ src/librygel-renderer/rygel-player-controller.vala | 2 ++ 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'src/librygel-renderer') diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala index 52c5e9bd..2036dd67 100644 --- a/src/librygel-renderer/rygel-av-transport.vala +++ b/src/librygel-renderer/rygel-av-transport.vala @@ -77,19 +77,6 @@ internal class Rygel.AVTransport : Service { } } - private string _mode = "NORMAL"; - public string mode { - get { - return this._mode; - } - - set { - this._mode = value; - - this.changelog.log ("CurrentPlayMode", this._mode); - } - } - private ChangeLog changelog; private MediaPlayer player; private PlayerController controller; @@ -136,6 +123,7 @@ internal class Rygel.AVTransport : Service { this.controller.notify["track-metadata"].connect (this.notify_track_meta_data_cb); this.controller.notify["next-uri"].connect (this.notify_next_uri_cb); this.controller.notify["next-metadata"].connect (this.notify_next_meta_data_cb); + this.controller.notify["play-mode"].connect (this.notify_play_mode_cb); this.player.notify["duration"].connect (this.notify_duration_cb); @@ -164,7 +152,7 @@ internal class Rygel.AVTransport : Service { log.log ("RecordStorageMedium", "NOT_IMPLEMENTED"); log.log ("PossiblePlaybackStorageMedia", "None,Network"); log.log ("PossibleRecordStorageMedia", "NOT_IMPLEMENTED"); - log.log ("CurrentPlayMode", this.mode); + log.log ("CurrentPlayMode", this.controller.play_mode); log.log ("TransportPlaySpeed", this.player.playback_speed); log.log ("RecordMediumWriteStatus", "NOT_IMPLEMENTED"); log.log ("CurrentRecordQualityMode", "NOT_IMPLEMENTED"); @@ -444,7 +432,7 @@ internal class Rygel.AVTransport : Service { action.set ("PlayMode", typeof (string), - this.mode, + this.controller.play_mode, "RecQualityMode", typeof (string), "NOT_IMPLEMENTED"); @@ -687,6 +675,10 @@ internal class Rygel.AVTransport : Service { Markup.escape_text (this.controller.next_metadata)); } + private void notify_play_mode_cb (Object player, ParamSpec p) { + this.changelog.log ("CurrentPlayMode", this.controller.play_mode); + } + private async void handle_playlist (ServiceAction action, string uri, string metadata, diff --git a/src/librygel-renderer/rygel-default-player-controller.vala b/src/librygel-renderer/rygel-default-player-controller.vala index 8c2bd241..056436e7 100644 --- a/src/librygel-renderer/rygel-default-player-controller.vala +++ b/src/librygel-renderer/rygel-default-player-controller.vala @@ -175,6 +175,20 @@ internal class Rygel.DefaultPlayerController : Rygel.PlayerController, Object { } } + [CCode (notify = false)] + public string play_mode { + get { + return this._play_mode; + } + + set { + if (value != this._play_mode) { + this._play_mode = value; + this.notify_property ("play-mode"); + } + } + } + // Private members private List playlist; private uint timeout_id; @@ -189,6 +203,7 @@ internal class Rygel.DefaultPlayerController : Rygel.PlayerController, Object { private uint _n_tracks; private uint _track; private string _playback_state = "NO_MEDIA_PRESENT"; + private string _play_mode = "NORMAL"; public DefaultPlayerController (MediaPlayer player, string protocol_info) { Object (player : player, protocol_info : protocol_info); diff --git a/src/librygel-renderer/rygel-player-controller.vala b/src/librygel-renderer/rygel-player-controller.vala index 93f5a367..491b2bdc 100644 --- a/src/librygel-renderer/rygel-player-controller.vala +++ b/src/librygel-renderer/rygel-player-controller.vala @@ -60,6 +60,8 @@ public interface Rygel.PlayerController : GLib.Object { public abstract string current_transport_actions { owned get; } + public abstract string play_mode { get; set; } + public abstract bool next (); public abstract bool previous (); -- cgit v1.2.1