[rygel] core: ProtocolInfo provided by TranscodeManager



commit 92dc6c4687d3dd51ccbc4fe4b46c6b7d1485cff9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jul 29 00:51:12 2009 +0300

    core: ProtocolInfo provided by TranscodeManager
    
    ProtocolInfo is now completely provided by TranscodeManager and it's
    deriving classes.

 src/rygel/rygel-connection-manager.vala |   17 +++++------------
 src/rygel/rygel-http-server.vala        |   10 ++++++++++
 src/rygel/rygel-transcode-manager.vala  |    7 +++++--
 3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/rygel/rygel-connection-manager.vala b/src/rygel/rygel-connection-manager.vala
index 2b2bdbe..f378131 100644
--- a/src/rygel/rygel-connection-manager.vala
+++ b/src/rygel/rygel-connection-manager.vala
@@ -39,14 +39,7 @@ public class Rygel.ConnectionManager : Service {
 
     protected string source_protocol_info {
         owned get {
-            var protocol_info = "http-get:*:*:*";
-            TranscodeManager tm = get_transcode_manager ();
-
-            if (tm != null) {
-                protocol_info += tm.get_protocol_info ();
-            }
-
-            return protocol_info;
+            return this.get_http_server ().get_protocol_info ();
         }
     }
 
@@ -126,8 +119,8 @@ public class Rygel.ConnectionManager : Service {
         action.return ();
     }
 
-    private TranscodeManager? get_transcode_manager () {
-        TranscodeManager manager = null;
+    private HTTPServer get_http_server () {
+        HTTPServer server = null;
 
         var root_device = (Rygel.RootDevice) this.root_device;
 
@@ -135,10 +128,10 @@ public class Rygel.ConnectionManager : Service {
         foreach (var service in root_device.services) {
             if (service.get_type().is_a (typeof (Rygel.ContentDirectory))) {
                 var content_directory = (Rygel.ContentDirectory) service;
-                manager = (TranscodeManager) content_directory.http_server;
+                server = content_directory.http_server;
             }
         }
 
-        return manager;
+        return server;
     }
 }
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index c27bd41..829ba94 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -124,6 +124,16 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
         return create_uri_for_path (query);
     }
 
+    internal override string get_protocol_info () {
+        var protocol_info = "http-get:*:*:*";
+        var base_info = base.get_protocol_info ();
+
+        if (base_info != "")
+            protocol_info += "," + base_info;
+
+        return protocol_info;
+    }
+
     private void on_request_completed (HTTPRequest request) {
         /* Remove the request from our list. */
         this.requests.remove (request);
diff --git a/src/rygel/rygel-transcode-manager.vala b/src/rygel/rygel-transcode-manager.vala
index c376d2b..fa37105 100644
--- a/src/rygel/rygel-transcode-manager.vala
+++ b/src/rygel/rygel-transcode-manager.vala
@@ -99,11 +99,14 @@ internal abstract class Rygel.TranscodeManager : GLib.Object {
         return transcoder;
     }
 
-    public string get_protocol_info () {
+    internal virtual string get_protocol_info () {
         string protocol_info = "";
 
         foreach (var transcoder in this.transcoders) {
-            protocol_info += ",http-get:*:" + transcoder.mime_type +
+            if (protocol_info != "")   // No comma before the first one
+                protocol_info += ",";
+
+            protocol_info += "http-get:*:" + transcoder.mime_type +
                              ":DLNA.ORG_PN=" + transcoder.dlna_profile;
         }
 



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