[rygel] core: Provide 'importUri' for all items



commit 07e73a63470937b9b506133c2c251ba3e030826e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Jan 26 17:00:57 2010 +0200

    core: Provide 'importUri' for all items

 src/rygel/rygel-http-server.vala |   15 ++++++++++++---
 src/rygel/rygel-media-item.vala  |    7 ++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index c4be370..33ad342 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -66,9 +66,7 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
                                           MediaItem    item)
                                           throws Error {
         if (!this.http_uri_present (item)) {
-            // Create the HTTP proxy URI
-            var uri = this.create_uri_for_item (item, -1, null);
-            item.add_resource (didl_item, uri, this.get_protocol ());
+            this.add_proxy_resource (didl_item, item);
         }
 
         base.add_resources (didl_item, item);
@@ -88,6 +86,17 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
         }
     }
 
+    internal void add_proxy_resource (DIDLLiteItem didl_item,
+                                      MediaItem    item)
+                                      throws Error {
+        var uri = this.create_uri_for_item (item, -1, null);
+
+        item.add_resource (didl_item,
+                           uri.to_string (),
+                           this.get_protocol (),
+                           uri.to_string ());
+    }
+
     private bool http_uri_present (MediaItem item) {
         bool present = false;
 
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index adbbb7b..337eb9f 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -156,7 +156,8 @@ public class Rygel.MediaItem : MediaObject {
 
     internal DIDLLiteResource add_resource (DIDLLiteItem didl_item,
                                             string?      uri,
-                                            string       protocol)
+                                            string       protocol,
+                                            string?      import_uri = null)
                                             throws Error {
         var res = didl_item.add_resource ();
 
@@ -164,6 +165,10 @@ public class Rygel.MediaItem : MediaObject {
             res.uri = uri;
         }
 
+        if (import_uri != null) {
+            res.import_uri = import_uri;
+        }
+
         res.size = this.size;
         res.duration = this.duration;
         res.bitrate = this.bitrate;



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