MediaItem adds transcoded resources to the DIDL.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Thu, 25 Dec 2008 11:59:05 +0000 (11:59 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Thu, 25 Dec 2008 11:59:05 +0000 (11:59 +0000)
ATM it's just the HTTP URI that the new Streamer API creates for us.

svn path=/trunk/; revision=362

src/rygel/rygel-media-item.vala

index 8704d0a..57fe6a7 100644 (file)
@@ -144,6 +144,12 @@ public class Rygel.MediaItem : MediaObject {
 
         didl_writer.add_res (res);
 
+        /* Now get the transcoded/proxy URIs */
+        var res_list = this.get_transcoded_resources (res);
+        foreach (DIDLLiteResource res in res_list) {
+            didl_writer.add_res (res);
+        }
+
         /* End of item */
         didl_writer.end_item ();
     }
@@ -161,4 +167,24 @@ public class Rygel.MediaItem : MediaObject {
                             ("Failed to probe protocol for URI %s", uri);
         }
     }
+
+    // FIXME: We only proxy URIs through our HTTP server for now
+    private List<DIDLLiteResource?>? get_transcoded_resources
+                                            (DIDLLiteResource orig_res) {
+        if (orig_res.protocol == "http-get")
+            return null;
+
+        List<DIDLLiteResource?> resources = new List<DIDLLiteResource?> ();
+        // Copy the original res first
+        DIDLLiteResource res = orig_res;
+
+        // Then modify the URI and protocol
+        string *uri = this.streamer.create_http_uri_for_uri (res.uri);
+        res.uri = uri;
+        res.protocol = "http-get";
+
+        resources.append (res);
+
+        return resources;
+    }
 }