[rygel/wip/cablelabs-integration: 18/18] WIP



commit 1dd54239f50f9d2ed4fe31703f9bbf538c6840cd
Author: Jens Georg <mail jensge org>
Date:   Thu Nov 20 21:37:20 2014 +0100

    WIP

 src/librygel-server/rygel-image-item.vala  |    9 +++++-
 src/librygel-server/rygel-video-item.vala  |    2 -
 src/librygel-server/rygel-visual-item.vala |   44 ++++++++++++++++++++-------
 3 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/src/librygel-server/rygel-image-item.vala b/src/librygel-server/rygel-image-item.vala
index 219dac3..e230ff6 100644
--- a/src/librygel-server/rygel-image-item.vala
+++ b/src/librygel-server/rygel-image-item.vala
@@ -92,7 +92,7 @@ public class Rygel.ImageItem : MediaFileItem, VisualItem {
                                           throws Error {
         base.add_resources (didl_item, allow_internal);
 
-        this.add_thumbnail_resources (didl_item, allow_internal);
+//        this.add_thumbnail_resources (didl_item, allow_internal);
     }
 
     internal override DIDLLiteResource add_resource
@@ -127,4 +127,11 @@ public class Rygel.ImageItem : MediaFileItem, VisualItem {
 
         return protocol_info;
     }
+
+    internal override void add_additional_resources (HTTPServer server) {
+        base.add_additional_resources (server);
+
+        this.add_thumbnail_resources (server);
+    }
+
 }
diff --git a/src/librygel-server/rygel-video-item.vala b/src/librygel-server/rygel-video-item.vala
index c9d3a16..0583415 100644
--- a/src/librygel-server/rygel-video-item.vala
+++ b/src/librygel-server/rygel-video-item.vala
@@ -113,8 +113,6 @@ public class Rygel.VideoItem : AudioItem, VisualItem {
         }
 
         base.add_resources (didl_item, allow_internal);
-
-        this.add_thumbnail_resources (didl_item, allow_internal);
     }
 
     internal override DIDLLiteResource add_resource
diff --git a/src/librygel-server/rygel-visual-item.vala b/src/librygel-server/rygel-visual-item.vala
index 2ab8897..a5c9d8c 100644
--- a/src/librygel-server/rygel-visual-item.vala
+++ b/src/librygel-server/rygel-visual-item.vala
@@ -71,18 +71,6 @@ public interface Rygel.VisualItem : MediaFileItem {
         }
     }
 
-    internal void add_thumbnail_resources (DIDLLiteItem didl_item,
-                                           bool         allow_internal)
-                                           throws Error {
-        foreach (var thumbnail in this.thumbnails) {
-            var protocol = this.get_protocol_for_uri (thumbnail.uri);
-
-            if (allow_internal || protocol != "internal") {
-                thumbnail.add_resource (didl_item, protocol);
-            }
-        }
-    }
-
     internal void add_visual_props (DIDLLiteResource res) {
         res.width = this.width;
         res.height = this.height;
@@ -109,4 +97,36 @@ public interface Rygel.VisualItem : MediaFileItem {
             }
         }
     }
+
+    internal void add_thumbnail_resources (HTTPServer http_server) {
+        foreach (var thumbnail in this.thumbnails) {
+            if (!this.place_holder) {
+                // Add the defined thumbnail uri unconditionally
+                //  (it will be filtered out if the request is remote)
+                string protocol;
+                try {
+                    protocol = this.get_protocol_for_uri (thumbnail.uri);
+                } catch (Error e) {
+                    message ("Could not determine protocol for " + thumbnail.uri);
+                    continue;
+                }
+
+                var thumb_res = thumbnail.get_resource (protocol);
+                this.get_resource_list ().add (thumb_res);
+                if (http_server.need_proxy (thumbnail.uri)) {
+                    var http_thumb_res = thumbnail.get_resource (http_server.get_protocol ());
+
+                    var index = this.thumbnails.index_of (thumbnail);
+                    // Make a http uri for the thumbnail
+                    http_thumb_res.uri = http_server.create_uri_for_object
+                                                 (this,
+                                                  index,
+                                                  -1,
+                                                  null,
+                                                  null);
+                    this.get_resource_list ().add (http_thumb_res);
+                }
+            }
+        }
+    }
 }


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