[rygel] core: Introducing SourceConnectionManager



commit ab6d3fe0dc5ff8f111abb459fc7c9db3b1dac04b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Oct 4 20:58:17 2009 +0300

    core: Introducing SourceConnectionManager
    
    Separate ConnectionManager implemenation for MediaServer usage.

 src/rygel/Makefile.am                          |    1 +
 src/rygel/rygel-connection-manager.vala        |   24 +----------
 src/rygel/rygel-plugin.vala                    |    2 +-
 src/rygel/rygel-source-connection-manager.vala |   52 ++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 23 deletions(-)
---
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index b7a2661..2804256 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -47,6 +47,7 @@ VAPI_SOURCE_FILES = rygel-configuration.vala \
 		    rygel-cmdline-config.vala \
 		    rygel-content-directory.vala \
 		    rygel-connection-manager.vala \
+		    rygel-source-connection-manager.vala \
 		    rygel-transcode-manager.vala \
 		    rygel-http-server.vala \
 		    rygel-state-machine.vala \
diff --git a/src/rygel/rygel-connection-manager.vala b/src/rygel/rygel-connection-manager.vala
index f378131..980a332 100644
--- a/src/rygel/rygel-connection-manager.vala
+++ b/src/rygel/rygel-connection-manager.vala
@@ -36,15 +36,11 @@ public class Rygel.ConnectionManager : Service {
 
     protected string sink_protocol_info;
     protected string connection_ids;
-
-    protected string source_protocol_info {
-        owned get {
-            return this.get_http_server ().get_protocol_info ();
-        }
-    }
+    protected string source_protocol_info;
 
     public override void constructed () {
         this.sink_protocol_info   = "";
+        this.source_protocol_info = "";
         this.connection_ids       = "0";
 
         this.query_variable["SourceProtocolInfo"] +=
@@ -118,20 +114,4 @@ public class Rygel.ConnectionManager : Service {
 
         action.return ();
     }
-
-    private HTTPServer get_http_server () {
-        HTTPServer server = null;
-
-        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;
-                server = content_directory.http_server;
-            }
-        }
-
-        return server;
-    }
 }
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index a433e77..fa7dc8d 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -77,7 +77,7 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
         resource_info = new ResourceInfo (ConnectionManager.UPNP_ID,
                                           ConnectionManager.UPNP_TYPE,
                                           ConnectionManager.DESCRIPTION_PATH,
-                                          typeof (ConnectionManager));
+                                          typeof (SourceConnectionManager));
         this.add_resource (resource_info);
     }
 
diff --git a/src/rygel/rygel-source-connection-manager.vala b/src/rygel/rygel-source-connection-manager.vala
new file mode 100644
index 0000000..aabbbbb
--- /dev/null
+++ b/src/rygel/rygel-source-connection-manager.vala
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation.
+ * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak gnome org>.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using GUPnP;
+
+/**
+ * UPnP ConnectionManager service for serving end-points (MediaServer).
+ */
+public class Rygel.SourceConnectionManager : Rygel.ConnectionManager {
+    public override void constructed () {
+        base.constructed ();
+
+        var server = this.get_http_server ();
+        this.source_protocol_info = server.get_protocol_info ();
+    }
+
+    private HTTPServer get_http_server () {
+        HTTPServer server = null;
+
+        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;
+                server = content_directory.http_server;
+            }
+        }
+
+        return server;
+    }
+}



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