rygel r543 - trunk/src/rygel



Author: zeeshanak
Date: Mon Feb  9 22:28:03 2009
New Revision: 543
URL: http://svn.gnome.org/viewvc/rygel?rev=543&view=rev

Log:
Use root container directly whenever possible.

Modified:
   trunk/src/rygel/rygel-browse.vala
   trunk/src/rygel/rygel-http-request.vala
   trunk/src/rygel/rygel-http-server.vala

Modified: trunk/src/rygel/rygel-browse.vala
==============================================================================
--- trunk/src/rygel/rygel-browse.vala	(original)
+++ trunk/src/rygel/rygel-browse.vala	Mon Feb  9 22:28:03 2009
@@ -50,7 +50,7 @@
     // The media object corresponding to object_id
     MediaObject media_object;
 
-    private unowned ContentDirectory content_dir;
+    private MediaContainer root_container;
     private ServiceAction action;
     private Rygel.DIDLLiteWriter didl_writer;
 
@@ -59,11 +59,11 @@
 
     public Browse (ContentDirectory    content_dir,
                    owned ServiceAction action) {
-        this.content_dir = content_dir;
+        this.root_container = content_dir.root_container;
         this.action = (owned) action;
 
         this.didl_writer =
-                new Rygel.DIDLLiteWriter (this.content_dir.http_server);
+                new Rygel.DIDLLiteWriter (content_dir.http_server);
     }
 
     public void start () {
@@ -87,9 +87,15 @@
     }
 
     private bool fetch_media_object () {
+        if (this.object_id == this.root_container.id) {
+            this.media_object = this.root_container;
+
+            return true;
+        }
+
         try {
             this.media_object =
-                        this.content_dir.find_object_by_id (this.object_id);
+                        this.root_container.find_object_by_id (this.object_id);
         } catch (Error err) {
             this.handle_error (err);
             return false;
@@ -192,7 +198,7 @@
         string didl = this.didl_writer.get_string ();
 
         if (this.update_id == uint32.MAX) {
-            this.update_id = this.content_dir.root_container.update_id;
+            this.update_id = this.root_container.update_id;
         }
 
         /* Set action return arguments */

Modified: trunk/src/rygel/rygel-http-request.vala
==============================================================================
--- trunk/src/rygel/rygel-http-request.vala	(original)
+++ trunk/src/rygel/rygel-http-request.vala	Mon Feb  9 22:28:03 2009
@@ -38,7 +38,7 @@
  * Responsible for handling HTTP client requests.
  */
 public class Rygel.HTTPRequest : GLib.Object {
-    private unowned ContentDirectory content_dir;
+    private MediaContainer root_container;
     private Soup.Server server;
     private Soup.Message msg;
     private HashTable<string,string>? query;
@@ -51,11 +51,11 @@
     private MediaItem item;
     private Seek seek;
 
-    public HTTPRequest (ContentDirectory          content_dir,
+    public HTTPRequest (MediaContainer            root_container,
                         Soup.Server               server,
                         Soup.Message              msg,
                         HashTable<string,string>? query) {
-        this.content_dir = content_dir;
+        this.root_container = root_container;
         this.server = server;
         this.msg = msg;
         this.query = query;
@@ -286,7 +286,7 @@
         MediaObject media_object;
 
         try {
-            media_object = this.content_dir.find_object_by_id (this.item_id);
+            media_object = this.root_container.find_object_by_id (this.item_id);
         } catch (Error error) {
             this.handle_error (error);
             return;

Modified: trunk/src/rygel/rygel-http-server.vala
==============================================================================
--- trunk/src/rygel/rygel-http-server.vala	(original)
+++ trunk/src/rygel/rygel-http-server.vala	Mon Feb  9 22:28:03 2009
@@ -30,14 +30,14 @@
     private const string SERVER_PATH_PREFIX = "/RygelHTTPServer";
     private string path_root;
 
-    // Reference to associated ContentDirectory service
-    private unowned ContentDirectory content_dir;
+    // Reference to root container of associated ContentDirectory
+    private MediaContainer root_container;
     private GUPnP.Context context;
     private ArrayList<HTTPRequest> requests;
 
     public HTTPServer (ContentDirectory content_dir,
                        string           name) {
-        this.content_dir = content_dir;
+        this.root_container = content_dir.root_container;
         this.context = content_dir.context;
         this.requests = new ArrayList<HTTPRequest> ();
 
@@ -74,7 +74,7 @@
                                  string                    server_path,
                                  HashTable<string,string>? query,
                                  Soup.ClientContext        soup_client) {
-        var request = new HTTPRequest (this.content_dir, server, msg, query);
+        var request = new HTTPRequest (this.root_container, server, msg, query);
 
         request.handled += this.on_request_handled;
         this.requests.add (request);



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