rygel r358 - trunk/src/rygel



Author: zeeshanak
Date: Tue Dec 16 14:31:38 2008
New Revision: 358
URL: http://svn.gnome.org/viewvc/rygel?rev=358&view=rev

Log:
Allow URIs of protocols other than HTTP.

We don't assume the protocol to be HTTP anymore but guess it from URI.

Modified:
   trunk/src/rygel/rygel-media-item.vala

Modified: trunk/src/rygel/rygel-media-item.vala
==============================================================================
--- trunk/src/rygel/rygel-media-item.vala	(original)
+++ trunk/src/rygel/rygel-media-item.vala	Tue Dec 16 14:31:38 2008
@@ -24,6 +24,10 @@
 
 using GUPnP;
 
+public errordomain Rygel.MediaItemError {
+    UNKNOWN_URI_TYPE
+}
+
 /**
  * Represents a media (Music, Video and Image) item. Provides basic
  * serialization (to DIDLLiteWriter) implementation.
@@ -121,7 +125,8 @@
         res.uri = uri;
 
         /* Protocol info */
-        res.protocol = "http-get";
+        string protocol = get_protocol_for_uri (uri);
+        res.protocol = protocol;
         res.mime_type = mime;
         res.dlna_profile = "MP3"; /* FIXME */
         res.dlna_operation = GUPnP.DLNAOperation.RANGE;
@@ -138,4 +143,18 @@
         /* End of item */
         didl_writer.end_item ();
     }
+
+    private string get_protocol_for_uri (string uri) throws Error {
+        if (uri.has_prefix ("http")) {
+            return "http-get";
+        } else if (uri.has_prefix ("file")) {
+            return "internal";
+        } else if (uri.has_prefix ("rtsp")) {
+            // FIXME: Assuming that RTSP is always accompanied with RTP over UDP
+            return "rtsp-rtp-udp";
+        } else {
+            throw new MediaItemError.UNKNOWN_URI_TYPE
+                            ("Failed to probe protocol for URI %s", uri);
+        }
+    }
 }



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