[rygel] core: Only provide import URI for place-holder items



commit 9b8e6c2be538170402a98dc0408109a66c2a0f63
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Sep 22 22:14:31 2010 +0300

    core: Only provide import URI for place-holder items

 src/rygel/rygel-image-item.vala |    6 ++++--
 src/rygel/rygel-media-item.vala |   13 ++++++++++---
 src/rygel/rygel-music-item.vala |    4 +++-
 src/rygel/rygel-video-item.vala |   16 +++++++++++-----
 4 files changed, 28 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-image-item.vala b/src/rygel/rygel-image-item.vala
index a8cdd63..e3626dc 100644
--- a/src/rygel/rygel-image-item.vala
+++ b/src/rygel/rygel-image-item.vala
@@ -84,8 +84,10 @@ public class Rygel.ImageItem : MediaItem, VisualItem {
                                                 throws Error {
         base.add_proxy_resources (server, didl_item);
 
-        // Thumbnails comes in the end
-        this.add_thumbnail_proxy_resources (server, didl_item);
+        if (!this.place_holder) {
+            // Thumbnails comes in the end
+            this.add_thumbnail_proxy_resources (server, didl_item);
+        }
     }
 
     protected override ProtocolInfo get_protocol_info (string? uri,
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 6a34453..e03381a 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -123,8 +123,13 @@ public abstract class Rygel.MediaItem : MediaObject {
                                         throws Error {
         var res = didl_item.add_resource ();
 
-        if (uri != null) {
+        if (uri != null && !this.place_holder) {
             res.uri = uri;
+        } else {
+            // Set empty string otherwise gupnp-av (libxml actually) will add
+            // a self-enclosing node in the DIDL-Lite which is not very much
+            // appreciated by UPnP devices using crappy XML parsers.
+            res.uri = "";
         }
 
         if (import_uri != null) {
@@ -194,8 +199,10 @@ public abstract class Rygel.MediaItem : MediaObject {
         // Proxy resource for the original resources
         server.add_proxy_resource (didl_item, this);
 
-        // Transcoding resources
-        server.add_resources (didl_item, this);
+        if (!this.place_holder) {
+            // Transcoding resources
+            server.add_resources (didl_item, this);
+        }
     }
 
     protected virtual ProtocolInfo get_protocol_info (string? uri,
diff --git a/src/rygel/rygel-music-item.vala b/src/rygel/rygel-music-item.vala
index 4cc71b5..84bbd65 100644
--- a/src/rygel/rygel-music-item.vala
+++ b/src/rygel/rygel-music-item.vala
@@ -121,7 +121,9 @@ public class Rygel.MusicItem : AudioItem {
         base.add_proxy_resources (server, didl_item);
 
         // Album-art URI comes in the end
-        if (this.album_art != null && server.need_proxy (this.album_art.uri)) {
+        if (!this.place_holder &&
+            this.album_art != null &&
+            server.need_proxy (this.album_art.uri)) {
             var uri = album_art.uri; // Save the original URI
 
             album_art.uri = server.create_uri_for_item (this, 0, -1, null);
diff --git a/src/rygel/rygel-video-item.vala b/src/rygel/rygel-video-item.vala
index 0d9dc06..734b3e7 100644
--- a/src/rygel/rygel-video-item.vala
+++ b/src/rygel/rygel-video-item.vala
@@ -133,9 +133,13 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
     internal override void add_proxy_resources (HTTPServer   server,
                                                 DIDLLiteItem didl_item)
                                                 throws Error {
-        // Subtitles first
-        foreach (var subtitle in this.subtitles) {
-            if (server.need_proxy (subtitle.uri)) {
+        if (!this.place_holder) {
+            // Subtitles first
+            foreach (var subtitle in this.subtitles) {
+                if (!server.need_proxy (subtitle.uri)) {
+                    continue;
+                }
+
                 var uri = subtitle.uri; // Save the original URI
                 var index = this.subtitles.index_of (subtitle);
 
@@ -152,7 +156,9 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
 
         base.add_proxy_resources (server, didl_item);
 
-        // Thumbnails comes in the end
-        this.add_thumbnail_proxy_resources (server, didl_item);
+        if (!this.place_holder) {
+            // Thumbnails comes in the end
+            this.add_thumbnail_proxy_resources (server, didl_item);
+        }
     }
 }



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