[rygel] engine-simple: Pass on non-file resourcs as-is



commit 468d7f073455ec6c39b8521c6ae49cf823238be6
Author: Jens Georg <mail jensge org>
Date:   Wed Jun 22 23:04:15 2016 +0200

    engine-simple: Pass on non-file resourcs as-is
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../simple/rygel-simple-media-engine.vala          |   32 ++++++++++---------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/media-engines/simple/rygel-simple-media-engine.vala 
b/src/media-engines/simple/rygel-simple-media-engine.vala
index 19eebe3..a52a2bc 100644
--- a/src/media-engines/simple/rygel-simple-media-engine.vala
+++ b/src/media-engines/simple/rygel-simple-media-engine.vala
@@ -62,27 +62,29 @@ internal class Rygel.SimpleMediaEngine : MediaEngine {
         var item = object as MediaFileItem;
 
         // For MediaFileItems, uri 0 is the file URI referring directly to the content
-        var source_uri = item.get_primary_uri ();
-        if (!source_uri.has_prefix ("file://")) {
-            warning (_("Can't process non-file URI %s"), source_uri);
-        }
 
+        var source_uri = item.get_primary_uri ();
         debug ("get_resources_for_item (%s)", source_uri);
 
         var resources = new Gee.ArrayList<MediaResource> ();
         var primary_res = item.get_primary_resource ();
 
-        // The SimpleMediaEngine supports only byte-based seek
-        primary_res.dlna_operation = GUPnP.DLNAOperation.RANGE;
-
-        // The SimpleMediaEngine supports connection stalling on
-        primary_res.dlna_flags |= DLNAFlags.CONNECTION_STALL;
-
-        // Add a resource for http consumption (as SimpleMediaEngine can handle http)
-        var http_res = new MediaResource.from_resource ("primary_http",
-                                                        primary_res);
-        http_res.uri = ""; // The URI needs to be assigned by the MediaServer
-        resources.add (http_res);
+        // For file:// uris, we can offer a HTTP proxy. Other URIs are passed
+        // on as-is.
+        if (source_uri.has_prefix ("file://")) {
+            // The SimpleMediaEngine supports only byte-based seek
+            primary_res.dlna_operation = GUPnP.DLNAOperation.RANGE;
+
+            // The SimpleMediaEngine supports connection stalling on
+            primary_res.dlna_flags |= DLNAFlags.CONNECTION_STALL;
+
+            // Add a resource for http consumption (as SimpleMediaEngine can
+            // handle http)
+            var http_res = new MediaResource.from_resource ("primary_http",
+                                                            primary_res);
+            http_res.uri = ""; // The URI needs to be assigned by the MediaServer
+            resources.add (http_res);
+        }
         resources.add (primary_res);
 
         return resources;


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