[rygel] core: Expose transcode formats in the ProtocolInfo



commit dfd092249147c580703420876f50b2398d6b171c
Author: James Henstridge <james jamesh id au>
Date:   Tue Jul 28 19:02:39 2009 +0800

    core: Expose transcode formats in the ProtocolInfo
    
    Some media players (e.g. certain Sony Bravia models) won't talk to media
    servers that don't advertise a DLNA profile they understand, so this is
    necessary to talk to such devices.

 src/rygel/rygel-connection-manager.vala |   27 +++++++++++++++++++++++++--
 src/rygel/rygel-root-device.vala        |    2 +-
 src/rygel/rygel-transcode-manager.vala  |   10 ++++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/src/rygel/rygel-connection-manager.vala b/src/rygel/rygel-connection-manager.vala
index 384f3c9..91e7a0b 100644
--- a/src/rygel/rygel-connection-manager.vala
+++ b/src/rygel/rygel-connection-manager.vala
@@ -34,14 +34,37 @@ public class Rygel.ConnectionManager : Service {
                     "urn:schemas-upnp-org:service:ConnectionManager:2";
     public const string DESCRIPTION_PATH = "xml/ConnectionManager.xml";
 
-    protected string source_protocol_info;
     protected string sink_protocol_info;
     protected string connection_ids;
 
+    private TranscodeManager? get_transcode_manager () {
+        var root_device = (Rygel.RootDevice) this.root_device;
+
+        // Find the ContentDirectory service attached to this root device.
+        foreach (var service in root_device.services) {
+            if (service.get_type().is_a (typeof (Rygel.ContentDirectory))) {
+                var content_directory = (Rygel.ContentDirectory) service;
+                return (TranscodeManager) content_directory.http_server;
+            }
+        }
+        return null;
+    }
+
+    protected string source_protocol_info {
+        owned get {
+            string protocol_info = "http-get:*:*:*";
+            TranscodeManager tm = get_transcode_manager ();
+
+            if (tm != null) {
+                protocol_info += tm.get_transcoder_protocol_info ();
+            }
+            return protocol_info;
+        }
+    }
+
     public override void constructed () {
         this.sink_protocol_info   = "";
         this.connection_ids       = "0";
-        this.source_protocol_info = "http-get:*:*:*";
 
         this.query_variable["SourceProtocolInfo"] +=
                         this.query_source_protocol_info_cb;
diff --git a/src/rygel/rygel-root-device.vala b/src/rygel/rygel-root-device.vala
index 4e70dc5..080ee1b 100644
--- a/src/rygel/rygel-root-device.vala
+++ b/src/rygel/rygel-root-device.vala
@@ -29,7 +29,7 @@ using Gee;
  * Represents a Root device.
  */
 public class Rygel.RootDevice: GUPnP.RootDevice {
-    private ArrayList<ServiceInfo> services;   /* Services we implement */
+    internal ArrayList<ServiceInfo> services;   /* Services we implement */
 
     public RootDevice (GUPnP.Context context,
                        Plugin        plugin,
diff --git a/src/rygel/rygel-transcode-manager.vala b/src/rygel/rygel-transcode-manager.vala
index 1063647..126bea5 100644
--- a/src/rygel/rygel-transcode-manager.vala
+++ b/src/rygel/rygel-transcode-manager.vala
@@ -98,5 +98,15 @@ internal abstract class Rygel.TranscodeManager : GLib.Object {
 
         return transcoder;
     }
+
+    public string get_transcoder_protocol_info () {
+        string protocol_info = "";
+
+        foreach (var transcoder in this.transcoders) {
+            protocol_info += ",http-get:*:%s:DLNA.ORG_PN=%s".printf (
+                transcoder.mime_type, transcoder.dlna_profile);
+        }
+        return protocol_info;
+    }
 }
 



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