rygel r529 - trunk/src/rygel



Author: zeeshanak
Date: Thu Jan 29 12:55:12 2009
New Revision: 529
URL: http://svn.gnome.org/viewvc/rygel?rev=529&view=rev

Log:
MediaContainer keeps it's update_id.

This also implies that system_update_id is now the same as update_id of
the root contianer in the ContentDirectory.

Modified:
   trunk/src/rygel/rygel-content-directory.vala
   trunk/src/rygel/rygel-media-container.vala

Modified: trunk/src/rygel/rygel-content-directory.vala
==============================================================================
--- trunk/src/rygel/rygel-content-directory.vala	(original)
+++ trunk/src/rygel/rygel-content-directory.vala	Thu Jan 29 12:55:12 2009
@@ -61,7 +61,6 @@
 
     public const int MAX_REQUESTED_COUNT = 128;
 
-    protected uint32 system_update_id;
     protected string feature_list;
     protected string search_caps;
     protected string sort_caps;
@@ -84,7 +83,6 @@
 
         this.http_server.item_requested += this.on_item_requested;
 
-        this.system_update_id = 0;
         this.feature_list =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
             "<Features xmlns=\"urn:schemas-upnp-org:av:avs\" " +
@@ -173,7 +171,7 @@
     private void get_system_update_id_cb (ContentDirectory content_dir,
                                           ServiceAction    action) {
         /* Set action return arguments */
-        action.set ("Id", typeof (uint32), this.system_update_id);
+        action.set ("Id", typeof (uint32), this.root_container.update_id);
 
         action.return ();
     }
@@ -184,7 +182,7 @@
                                          ref GLib.Value   value) {
         /* Set action return arguments */
         value.init (typeof (uint32));
-        value.set_uint (this.system_update_id);
+        value.set_uint (this.root_container.update_id);
     }
 
     /* action GetSearchCapabilities implementation */
@@ -246,7 +244,12 @@
 
         media_object.serialize (didl_writer);
 
-        args.update_id = uint32.MAX;
+        if (media_object is MediaContainer) {
+            args.update_id = ((MediaContainer) media_object).update_id;
+        } else {
+            args.update_id = uint32.MAX;
+        }
+
         args.number_returned = 1;
         args.total_matches = 1;
     }
@@ -260,13 +263,13 @@
         children = this.get_children (args.object_id,
                                       args.index,
                                       args.requested_count,
-                                      out args.total_matches);
+                                      out args.total_matches,
+                                      out args.update_id);
         /* Iterate through all items */
         for (int i = 0; i < children.size; i++) {
             children[i].serialize (didl_writer);
         }
 
-        args.update_id = uint32.MAX;
         args.number_returned = children.size;
     }
 
@@ -309,7 +312,7 @@
                                   string        didl,
                                   BrowseArgs    args) {
         if (args.update_id == uint32.MAX) {
-            args.update_id = this.system_update_id;
+            args.update_id = this.root_container.update_id;
         }
 
         /* Set action return arguments */
@@ -324,7 +327,8 @@
     private Gee.List<MediaObject> get_children (string   container_id,
                                                 uint     offset,
                                                 uint     max_count,
-                                                out uint child_count)
+                                                out uint child_count,
+                                                out uint update_id)
                                                 throws GLib.Error {
         var media_object = this.find_object_by_id (container_id);
         if (!(media_object is MediaContainer)) {
@@ -343,6 +347,8 @@
             throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
         }
 
+        update_id = ((MediaContainer) media_object).update_id;
+
         return children;
     }
 

Modified: trunk/src/rygel/rygel-media-container.vala
==============================================================================
--- trunk/src/rygel/rygel-media-container.vala	(original)
+++ trunk/src/rygel/rygel-media-container.vala	Thu Jan 29 12:55:12 2009
@@ -30,6 +30,7 @@
  */
 public abstract class Rygel.MediaContainer : MediaObject {
     public uint child_count;
+    public uint32 update_id;
 
     public MediaContainer (string id,
                            string parent_id,
@@ -39,11 +40,13 @@
         this.parent_id = parent_id;
         this.title = title;
         this.child_count = child_count;
+        this.update_id = uint32.MAX; // undefined for non-root containers
     }
 
     public MediaContainer.root (string title,
                                 uint   child_count) {
         this ("0", "-1", title, child_count);
+        this.update_id = 0;
     }
 
    /**



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