From 5da6e0be3c9d1162b9a39802157b1fd4facce86c Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Wed, 6 May 2009 15:39:45 +0300 Subject: [PATCH] Protocol to uknown URI is same as it's scheme If the protocol of a URI is uknown to us, assume it to be the same as the scheme of the URI. --- src/rygel/rygel-didl-lite-writer.vala | 1 - src/rygel/rygel-media-item.vala | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/rygel/rygel-didl-lite-writer.vala b/src/rygel/rygel-didl-lite-writer.vala index a30b7cb..bc6fc3f 100644 --- a/src/rygel/rygel-didl-lite-writer.vala +++ b/src/rygel/rygel-didl-lite-writer.vala @@ -25,7 +25,6 @@ using GUPnP; using Gee; internal errordomain Rygel.DIDLLiteWriterError { - UNKNOWN_URI_TYPE, UNSUPPORTED_OBJECT } diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala index 816f37a..145df9a 100644 --- a/src/rygel/rygel-media-item.vala +++ b/src/rygel/rygel-media-item.vala @@ -23,6 +23,10 @@ using GUPnP; using Gee; +private errordomain Rygel.MediaItemError { + BAD_URI +} + /** * Represents a media (Music, Video and Image) item. */ @@ -121,11 +125,16 @@ public class Rygel.MediaItem : MediaObject { } else if (uri.has_prefix ("rtsp")) { // FIXME: Assuming that RTSP is always accompanied with RTP over UDP return "rtsp-rtp-udp"; - } else if (uri.has_prefix ("mms")) { - return "mms"; } else { - throw new DIDLLiteWriterError.UNKNOWN_URI_TYPE - ("Failed to probe protocol for URI %s", uri); + warning ("Failed to probe protocol for URI %s", uri); + + // Assume the protocol to be the scheme of the URI + var tokens = uri.split (":", 2); + if (tokens[0] == null) { + throw new MediaItemError.BAD_URI ("Bad URI: %s", uri); + } + + return tokens[0]; } } } -- 2.7.4