rygel r605 - in trunk/src: plugins/dvb plugins/test plugins/tracker rygel



Author: zeeshanak
Date: Mon Feb 16 17:32:54 2009
New Revision: 605
URL: http://svn.gnome.org/viewvc/rygel?rev=605&view=rev

Log:
Each media object gets a weak ref to it's parent container.

Modified:
   trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
   trunk/src/plugins/dvb/rygel-dvb-channel.vala
   trunk/src/plugins/dvb/rygel-dvb-root-container.vala
   trunk/src/plugins/test/rygel-test-audio-item.vala
   trunk/src/plugins/test/rygel-test-item.vala
   trunk/src/plugins/test/rygel-test-root-container.vala
   trunk/src/plugins/test/rygel-test-video-item.vala
   trunk/src/plugins/tracker/rygel-tracker-category.vala
   trunk/src/plugins/tracker/rygel-tracker-image-category.vala
   trunk/src/plugins/tracker/rygel-tracker-item.vala
   trunk/src/plugins/tracker/rygel-tracker-music-category.vala
   trunk/src/plugins/tracker/rygel-tracker-root-container.vala
   trunk/src/plugins/tracker/rygel-tracker-video-category.vala
   trunk/src/rygel/rygel-didl-lite-writer.vala
   trunk/src/rygel/rygel-media-container.vala
   trunk/src/rygel/rygel-media-item.vala
   trunk/src/rygel/rygel-media-object.vala

Modified: trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	Mon Feb 16 17:32:54 2009
@@ -45,10 +45,10 @@
 
     public DVBChannelGroup (uint                gid,
                             string              title,
-                            string              parent_id,
+                            MediaContainer      parent,
                             dynamic DBus.Object channel_list) {
         base (GID_PREFIX + gid.to_string (), // UPnP ID
-              parent_id,
+              parent,
               title,
               0);
         this.gid = gid;
@@ -140,7 +140,7 @@
             // Create Channels
             try {
                 var channel = new DVBChannel (channel_id,
-                                              this.id,
+                                              this,
                                               channel_list);
                 this.channels.add (channel);
             } catch (GLib.Error error) {

Modified: trunk/src/plugins/dvb/rygel-dvb-channel.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-channel.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-channel.vala	Mon Feb 16 17:32:54 2009
@@ -35,12 +35,12 @@
     private uint cid; /* The DVB Daemon Channel ID */
 
     public DVBChannel (uint                cid,
-                       string              parent_id,
+                       MediaContainer      parent,
                        dynamic DBus.Object channel_list) throws GLib.Error {
-        string id = parent_id + ":" + cid.to_string (); /* UPnP ID */
+        string id = parent.id + ":" + cid.to_string (); /* UPnP ID */
 
         base (id,
-              parent_id,
+              parent,
               "Unknown",        /* Title Unknown at this point */
               "Unknown");       /* UPnP Class Unknown at this point */
 

Modified: trunk/src/plugins/dvb/rygel-dvb-root-container.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-root-container.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-root-container.vala	Mon Feb 16 17:32:54 2009
@@ -130,7 +130,7 @@
             // Create ChannelGroup for each registered device group
             this.groups.add (new DVBChannelGroup (group_id,
                                                   group_name,
-                                                  this.id,
+                                                  this,
                                                   channel_list));
         }
 

Modified: trunk/src/plugins/test/rygel-test-audio-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-audio-item.vala	(original)
+++ trunk/src/plugins/test/rygel-test-audio-item.vala	Mon Feb 16 17:32:54 2009
@@ -33,11 +33,11 @@
 public class Rygel.TestAudioItem : Rygel.TestItem {
     const string TEST_MIMETYPE = "audio/x-wav";
 
-    public TestAudioItem (string id,
-                          string parent_id,
-                          string title) {
+    public TestAudioItem (string         id,
+                          MediaContainer parent,
+                          string         title) {
         base (id,
-              parent_id,
+              parent,
               title,
               TEST_MIMETYPE,
               MediaItem.AUDIO_CLASS);

Modified: trunk/src/plugins/test/rygel-test-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-item.vala	(original)
+++ trunk/src/plugins/test/rygel-test-item.vala	Mon Feb 16 17:32:54 2009
@@ -32,12 +32,12 @@
 public abstract class Rygel.TestItem : Rygel.MediaItem {
     const string TEST_AUTHOR = "Zeeshan Ali (Khattak)";
 
-    public TestItem (string id,
-                     string parent_id,
-                     string title,
-                     string mime,
-                     string upnp_class) {
-        base (id, parent_id, title, upnp_class);
+    public TestItem (string         id,
+                     MediaContainer parent,
+                     string         title,
+                     string         mime,
+                     string         upnp_class) {
+        base (id, parent, title, upnp_class);
 
         this.mime_type = mime;
         this.author = TEST_AUTHOR;

Modified: trunk/src/plugins/test/rygel-test-root-container.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-root-container.vala	(original)
+++ trunk/src/plugins/test/rygel-test-root-container.vala	Mon Feb 16 17:32:54 2009
@@ -38,10 +38,10 @@
 
         this.items = new ArrayList<MediaItem> ();
         this.items.add (new TestAudioItem ("sinewave",
-                                           this.id,
+                                           this,
                                            "Sine Wave"));
         this.items.add (new TestVideoItem ("smtpe",
-                                           this.id,
+                                           this,
                                            "SMTPE"));
 
         // Now we know how many top-level items we have

Modified: trunk/src/plugins/test/rygel-test-video-item.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-video-item.vala	(original)
+++ trunk/src/plugins/test/rygel-test-video-item.vala	Mon Feb 16 17:32:54 2009
@@ -33,11 +33,11 @@
 public class Rygel.TestVideoItem : Rygel.TestItem {
     const string TEST_MIMETYPE = "video/mpeg";
 
-    public TestVideoItem (string id,
-                          string parent_id,
-                          string title) {
+    public TestVideoItem (string         id,
+                          MediaContainer parent,
+                          string         title) {
         base (id,
-              parent_id,
+              parent,
               title,
               TEST_MIMETYPE,
               MediaItem.VIDEO_CLASS);

Modified: trunk/src/plugins/tracker/rygel-tracker-category.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-category.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-category.vala	Mon Feb 16 17:32:54 2009
@@ -50,12 +50,12 @@
 
     Gee.List<AsyncResult> results;
 
-    public TrackerCategory (string id,
-                            string parent_id,
-                            string title,
-                            string category,
-                            string child_class) {
-        base (id, parent_id, title, 0);
+    public TrackerCategory (string         id,
+                            MediaContainer parent,
+                            string         title,
+                            string         category,
+                            string         child_class) {
+        base (id, parent, title, 0);
 
         this.category = category;
         this.child_class = child_class;

Modified: trunk/src/plugins/tracker/rygel-tracker-image-category.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-image-category.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-image-category.vala	Mon Feb 16 17:32:54 2009
@@ -27,10 +27,10 @@
  * Represents Tracker Image category.
  */
 public class Rygel.TrackerImageCategory : Rygel.TrackerCategory {
-    public TrackerImageCategory (string id,
-                                 string parent_id,
-                                 string title) {
-        base (id, parent_id, title, "Images", MediaItem.IMAGE_CLASS);
+    public TrackerImageCategory (string         id,
+                                 MediaContainer parent,
+                                 string         title) {
+        base (id, parent, title, "Images", MediaItem.IMAGE_CLASS);
     }
 
     protected override string[] get_metadata_keys () {

Modified: trunk/src/plugins/tracker/rygel-tracker-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-item.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-item.vala	Mon Feb 16 17:32:54 2009
@@ -35,7 +35,7 @@
                         string          path,
                         TrackerCategory parent,
                         string[]        metadata) {
-        base (id, parent.id, "", parent.child_class);
+        base (id, parent, "", parent.child_class);
 
         this.path = path;
 

Modified: trunk/src/plugins/tracker/rygel-tracker-music-category.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-music-category.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-music-category.vala	Mon Feb 16 17:32:54 2009
@@ -27,10 +27,10 @@
  * Represents Tracker Music category.
  */
 public class Rygel.TrackerMusicCategory : Rygel.TrackerCategory {
-    public TrackerMusicCategory (string id,
-                                 string parent_id,
-                                 string title) {
-        base (id, parent_id, title, "Music", MediaItem.MUSIC_CLASS);
+    public TrackerMusicCategory (string         id,
+                                 MediaContainer parent,
+                                 string         title) {
+        base (id, parent, title, "Music", MediaItem.MUSIC_CLASS);
     }
 
     protected override string[] get_metadata_keys () {

Modified: trunk/src/plugins/tracker/rygel-tracker-root-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-root-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-root-container.vala	Mon Feb 16 17:32:54 2009
@@ -40,15 +40,15 @@
         this.categories = new ArrayList<TrackerCategory> ();
         this.categories.add
                         (new TrackerImageCategory ("16",
-                                                   this.id,
+                                                   this,
                                                    "All Images"));
         this.categories.add
                         (new TrackerMusicCategory ("14",
-                                                   this.id,
+                                                   this,
                                                    "All Music"));
         this.categories.add
                         (new TrackerVideoCategory ("15",
-                                                   this.id,
+                                                   this,
                                                    "All Videos"));
 
         // Now we know how many top-level containers we have

Modified: trunk/src/plugins/tracker/rygel-tracker-video-category.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-video-category.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-video-category.vala	Mon Feb 16 17:32:54 2009
@@ -27,10 +27,10 @@
  * Represents Tracker Video category.
  */
 public class Rygel.TrackerVideoCategory : Rygel.TrackerCategory {
-    public TrackerVideoCategory (string id,
-                                 string parent_id,
-                                 string title) {
-        base (id, parent_id, title, "Videos", MediaItem.VIDEO_CLASS);
+    public TrackerVideoCategory (string         id,
+                                 MediaContainer parent,
+                                 string         title) {
+        base (id, parent, title, "Videos", MediaItem.VIDEO_CLASS);
     }
 
     protected override string[] get_metadata_keys () {

Modified: trunk/src/rygel/rygel-didl-lite-writer.vala
==============================================================================
--- trunk/src/rygel/rygel-didl-lite-writer.vala	(original)
+++ trunk/src/rygel/rygel-didl-lite-writer.vala	Mon Feb 16 17:32:54 2009
@@ -52,7 +52,7 @@
 
     private void serialize_item (MediaItem item) throws Error {
         this.start_item (item.id,
-                                item.parent_id,
+                                item.parent.id,
                                 null,
                                 false);
 
@@ -127,7 +127,7 @@
 
     private void serialize_container (MediaContainer container) throws Error {
         this.start_container (container.id,
-                              container.parent_id,
+                              container.parent.id,
                               (int) container.child_count,
                               false,
                               false);

Modified: trunk/src/rygel/rygel-media-container.vala
==============================================================================
--- trunk/src/rygel/rygel-media-container.vala	(original)
+++ trunk/src/rygel/rygel-media-container.vala	Mon Feb 16 17:32:54 2009
@@ -32,12 +32,12 @@
     public uint child_count;
     public uint32 update_id;
 
-    public MediaContainer (string id,
-                           string parent_id,
-                           string title,
-                           uint   child_count) {
+    public MediaContainer (string          id,
+                           MediaContainer? parent,
+                           string          title,
+                           uint            child_count) {
         this.id = id;
-        this.parent_id = parent_id;
+        this.parent = parent;
         this.title = title;
         this.child_count = child_count;
         this.update_id = uint32.MAX; // undefined for non-root containers
@@ -45,7 +45,7 @@
 
     public MediaContainer.root (string title,
                                 uint   child_count) {
-        this ("0", "-1", title, child_count);
+        this ("0", null, title, child_count);
         this.update_id = 0;
     }
 

Modified: trunk/src/rygel/rygel-media-item.vala
==============================================================================
--- trunk/src/rygel/rygel-media-item.vala	(original)
+++ trunk/src/rygel/rygel-media-item.vala	Mon Feb 16 17:32:54 2009
@@ -55,12 +55,12 @@
     public int height = -1;
     public int color_depth = -1;
 
-    public MediaItem (string id,
-                      string parent_id,
-                      string title,
-                      string upnp_class) {
+    public MediaItem (string         id,
+                      MediaContainer parent,
+                      string         title,
+                      string         upnp_class) {
         this.id = id;
-        this.parent_id = parent_id;
+        this.parent = parent;
         this.title = title;
         this.upnp_class = upnp_class;
     }

Modified: trunk/src/rygel/rygel-media-object.vala
==============================================================================
--- trunk/src/rygel/rygel-media-object.vala	(original)
+++ trunk/src/rygel/rygel-media-object.vala	Mon Feb 16 17:32:54 2009
@@ -27,6 +27,7 @@
  */
 public abstract class Rygel.MediaObject : GLib.Object {
     public string id;
-    public string parent_id;
     public string title;
+
+    public unowned MediaContainer parent;
 }



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