[rygel] renderer: Add GetCurrentTransportActions method.



commit e8b38718c68d6f8dd2aa26c46800b36262e9f0ad
Author: Mark Ryan <mark d ryan intel com>
Date:   Mon Oct 22 14:48:59 2012 +0200

    renderer: Add GetCurrentTransportActions method.
    
    The GetCurrentTransportActions method and the CurrentTransportActions state
    variable have been added to the AVTransport interface.  This method and its
    related state variable need to be supported by renderers that support Seek
    to be DLNA compliant.
    
    Slightly modified to match current code. Note that this breaks the UPnP test
    due to X_DLNA_SeekTime capability.
    
    Fixes:
        https://bugzilla.gnome.org/show_bug.cgi?id=686638

 data/xml/AVTransport2.xml.in                       |   21 ++++++++++++++++++++
 src/librygel-renderer/rygel-av-transport.vala      |   19 ++++++++++++++++++
 src/librygel-renderer/rygel-player-controller.vala |   16 +++++++++++++++
 3 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/data/xml/AVTransport2.xml.in b/data/xml/AVTransport2.xml.in
index fdda8ae..b1626af 100644
--- a/data/xml/AVTransport2.xml.in
+++ b/data/xml/AVTransport2.xml.in
@@ -39,6 +39,11 @@
       </stateVariable>
 
       <stateVariable sendEvents="no">
+         <name>CurrentTransportActions</name>
+         <dataType>string</dataType>
+      </stateVariable>
+
+      <stateVariable sendEvents="no">
          <name>PlaybackStorageMedium</name>
          <dataType>string</dataType>
          <allowedValueList>
@@ -487,6 +492,22 @@
       </action>
 
       <action>
+         <name>GetCurrentTransportActions</name>
+         <argumentList>
+            <argument>
+               <name>InstanceID</name>
+               <direction>in</direction>
+               <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>
+            </argument>
+            <argument>
+               <name>Actions</name>
+               <direction>out</direction>
+               <relatedStateVariable>CurrentTransportActions</relatedStateVariable>
+            </argument>
+          </argumentList>
+      </action>
+
+      <action>
          <name>GetPositionInfo</name>
          <argumentList>
             <argument>
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index 74f5099..83c66c6 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -125,6 +125,8 @@ internal class Rygel.AVTransport : Service {
                                         (this.get_device_capabilities_cb);
         action_invoked["GetTransportSettings"].connect
                                         (this.get_transport_settings_cb);
+        action_invoked["GetCurrentTransportActions"].connect
+                                        (this.get_transport_actions_cb);
         action_invoked["Stop"].connect (this.stop_cb);
         action_invoked["Play"].connect (this.play_cb);
         action_invoked["Pause"].connect (this.pause_cb);
@@ -159,6 +161,8 @@ internal class Rygel.AVTransport : Service {
         ChangeLog log = new ChangeLog (null, LAST_CHANGE_NS);
 
         log.log ("TransportState",               this.player.playback_state);
+        log.log ("CurrentTransportActions",
+                 this.controller.current_transport_actions);
         log.log ("TransportStatus",              this.status);
         log.log ("PlaybackStorageMedium",        "NOT_IMPLEMENTED");
         log.log ("RecordStorageMedium",          "NOT_IMPLEMENTED");
@@ -408,6 +412,19 @@ internal class Rygel.AVTransport : Service {
         action.return ();
     }
 
+    private void get_transport_actions_cb (Service       service,
+                                           ServiceAction action) {
+        if (!this.check_instance_id (action)) {
+            return;
+        }
+
+        action.set ("Actions",
+                        typeof (string),
+                        this.controller.current_transport_actions);
+
+        action.return ();
+    }
+
     private void get_position_info_cb (Service       service,
                                        ServiceAction action) {
         if (!this.check_instance_id (action)) {
@@ -590,6 +607,8 @@ internal class Rygel.AVTransport : Service {
     private void notify_state_cb (Object player, ParamSpec p) {
         var state = this.player.playback_state;
         this.changelog.log ("TransportState", state);
+        this.changelog.log ("CurrentTransportActions",
+                            this.controller.current_transport_actions);
     }
 
     private void notify_n_tracks_cb (Object player, ParamSpec p) {
diff --git a/src/librygel-renderer/rygel-player-controller.vala b/src/librygel-renderer/rygel-player-controller.vala
index ab19403..2ac1c35 100644
--- a/src/librygel-renderer/rygel-player-controller.vala
+++ b/src/librygel-renderer/rygel-player-controller.vala
@@ -75,6 +75,22 @@ internal class Rygel.PlayerController : Object {
         default = "";
     }
 
+    public string current_transport_actions {
+        owned get {
+            switch (this._playback_state) {
+                case "PLAYING":
+                case "TRANSITIONING":
+                    return "Stop,Seek,X_DLNA_SeekTime,Pause";
+                case "STOPPED":
+                case "PAUSED_PLAYBACK":
+                    return "Play,Seek,X_DLNA_SeekTime";
+                default:
+                    return "";
+            }
+        }
+    }
+
+    // Private members
     private MediaCollection collection;
     private List<DIDLLiteItem> collection_items;
     private uint timeout_id;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]