[rygel] renderer: Allow the controller to expose its play mode
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] renderer: Allow the controller to expose its play mode
- Date: Sun, 9 Nov 2014 14:24:28 +0000 (UTC)
commit d4d6305d6b665646b7653379a3d6b7d5e3a42dfd
Author: Richard Röjfors <richard rojfors gmail com>
Date: Sun Sep 28 10:48:20 2014 +0200
renderer: Allow the controller to expose its play mode
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 <richard rojfors gmail com>
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(-)
---
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index 52c5e9b..2036dd6 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 8c2bd24..056436e 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<DIDLLiteItem> 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 93f5a36..491b2bd 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]