rygel r682 - trunk/src/rygel



Author: zeeshanak
Date: Sun Mar 15 19:03:08 2009
New Revision: 682
URL: http://svn.gnome.org/viewvc/rygel?rev=682&view=rev

Log:
Add HTTP resources to the existing list.

Add HTTP resources to the existing list rather than creating a new list.

Modified:
   trunk/src/rygel/rygel-didl-lite-writer.vala
   trunk/src/rygel/rygel-http-server.vala

Modified: trunk/src/rygel/rygel-didl-lite-writer.vala
==============================================================================
--- trunk/src/rygel/rygel-didl-lite-writer.vala	(original)
+++ trunk/src/rygel/rygel-didl-lite-writer.vala	Sun Mar 15 19:03:08 2009
@@ -111,12 +111,8 @@
         var res_list = this.get_original_res_list (item);
 
         /* Now get the transcoded/proxy URIs */
-        var http_res_list = this.http_server.create_resources (item, res_list);
-        foreach (DIDLLiteResource http_res in http_res_list) {
-            this.add_res (http_res);
-        }
+        this.http_server.add_resources (res_list, item);
 
-        /* Add the original resources in the end */
         foreach (DIDLLiteResource res in res_list) {
             this.add_res (res);
         }

Modified: trunk/src/rygel/rygel-http-server.vala
==============================================================================
--- trunk/src/rygel/rygel-http-server.vala	(original)
+++ trunk/src/rygel/rygel-http-server.vala	Sun Mar 15 19:03:08 2009
@@ -55,24 +55,25 @@
         }
     }
 
-    public ArrayList<DIDLLiteResource?>? create_resources
-                                (MediaItem                    item,
-                                 ArrayList<DIDLLiteResource?> orig_res_list)
-                                 throws Error {
-        var resources = new ArrayList<DIDLLiteResource?> ();
-
+    /* We prepend these resources into the original resource list instead of
+     * appending them because some crappy MediaRenderer/ControlPoint
+     * implemenation out there just choose the first one in the list instead of
+     * the one they can handle.
+     */
+    public void add_resources (ArrayList<DIDLLiteResource?> resources,
+                               MediaItem                    item) throws Error {
         // Create the HTTP proxy URI
         var uri = this.create_http_uri_for_item (item, null);
         DIDLLiteResource res = item.create_res (uri);
         res.protocol = "http-get";
 
-        if (!http_res_present (orig_res_list)) {
-            resources.add (res);
+        if (!http_res_present (resources)) {
+            resources.insert (0, res);
         }
 
         if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
             // No  transcoding for images yet :(
-            return resources;
+            return;
         } else {
             // Modify the res for transcoding resources
             res.mime_type = "video/mpeg";
@@ -82,10 +83,8 @@
             res.dlna_operation = DLNAOperation.NONE;
             res.size = -1;
 
-            resources.add (res);
+            resources.insert (1, res);
         }
-
-        return resources;
     }
 
     private bool http_res_present (ArrayList<DIDLLiteResource?> res_list) {



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