[rygel] renderer: Fix GetCurrentConnectionInfo's p-i



commit aa4b20c1ef8b8aa6355fb5a94bf798c585c6fb41
Author: Jens Georg <jensg openismus com>
Date:   Tue Oct 1 12:27:51 2013 +0200

    renderer: Fix GetCurrentConnectionInfo's p-i
    
    We need to supply a proper protocol info in GetCurrentConnectionInfo if we
    have one. This is even required by UPnP.
    
    (Partially) fixes DLNA CTT 7.3.53.2
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706986

 src/librygel-core/rygel-connection-manager.vala    |    6 +++-
 src/librygel-renderer/rygel-media-player.vala      |   29 ++++++++++++++++++++
 .../rygel-sink-connection-manager.vala             |    7 +++++
 3 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-core/rygel-connection-manager.vala b/src/librygel-core/rygel-connection-manager.vala
index b9a4108..3ecd2a5 100644
--- a/src/librygel-core/rygel-connection-manager.vala
+++ b/src/librygel-core/rygel-connection-manager.vala
@@ -64,6 +64,10 @@ public class Rygel.ConnectionManager : Service {
                                         (this.get_current_connection_info_cb);
     }
 
+    public virtual string get_current_protocol_info () {
+        return "";
+    }
+
     private void query_source_protocol_info_cb (Service   cm,
                                                 string    var,
                                                 ref Value val) {
@@ -138,7 +142,7 @@ public class Rygel.ConnectionManager : Service {
                         this.av_transport_id,
                     "ProtocolInfo",
                         typeof (string),
-                        "",
+                        this.get_current_protocol_info (),
                     "PeerConnectionManager",
                         typeof (string),
                         "",
diff --git a/src/librygel-renderer/rygel-media-player.vala b/src/librygel-renderer/rygel-media-player.vala
index 1efcf05..da9adb4 100644
--- a/src/librygel-renderer/rygel-media-player.vala
+++ b/src/librygel-renderer/rygel-media-player.vala
@@ -139,4 +139,33 @@ public interface Rygel.MediaPlayer : GLib.Object {
 
          return double.parse (rational[0]) / double.parse (rational[1]);
     }
+    
+    /// Return the protocol info of the current track's meta-data
+    public string protocol_info {
+        owned get {
+            if (this.metadata == null || this.uri == null) {
+                return "";
+            }
+
+            // Parse meta-data
+            var p = new GUPnP.DIDLLiteParser ();
+            GUPnP.DIDLLiteObject item = null;
+
+            p.item_available.connect ( (object) => { item = object; });
+            try {
+                p.parse_didl (this.metadata);
+            } catch (Error error) {
+                return "";
+            }
+
+            var resources = item.get_resources ();
+            foreach (var resource in resources) {
+                if (resource.uri == this.uri) {
+                    return resource.protocol_info.to_string ();
+                }
+            }
+
+            return "";
+        }
+    }
 }
diff --git a/src/librygel-renderer/rygel-sink-connection-manager.vala 
b/src/librygel-renderer/rygel-sink-connection-manager.vala
index beb30c0..f443738 100644
--- a/src/librygel-renderer/rygel-sink-connection-manager.vala
+++ b/src/librygel-renderer/rygel-sink-connection-manager.vala
@@ -34,4 +34,11 @@ internal class Rygel.SinkConnectionManager : Rygel.ConnectionManager {
         var plugin = this.root_device.resource_factory as MediaRendererPlugin;
         this.sink_protocol_info = plugin.get_protocol_info ();
     }
+
+    public override string get_current_protocol_info () {
+        var plugin = this.root_device.resource_factory as MediaRendererPlugin;
+        var player = plugin.get_player ();
+
+        return player.protocol_info;
+    }
 }


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