core: Add MediaItem.streamable()
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 20 Aug 2010 19:36:37 +0000 (22:36 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 20 Aug 2010 19:43:59 +0000 (22:43 +0300)
Differential between items that are streamable and should be streamed.

src/rygel/rygel-http-get.vala
src/rygel/rygel-media-item.vala

index 1530c23..b783102 100644 (file)
@@ -130,7 +130,7 @@ internal class Rygel.HTTPGet : HTTPRequest {
         switch (mode) {
         case "Streaming":
             correct = this.handler is HTTPTranscodeHandler ||
-                      (this.item.should_stream () &&
+                      (this.item.streamable () &&
                        this.subtitle == null &&
                        this.thumbnail == null);
 
index e1431ac..8fd777e 100644 (file)
@@ -111,9 +111,13 @@ public class Rygel.MediaItem : MediaObject {
     // Return true if item should be streamed as a live response with
     // time based seeking, or false to serve directly with byte range
     // seeking.
-    public virtual bool should_stream () {
+    public bool should_stream () {
         // Simple heuristic: if size is known and its not image, serve directly.
-        return !this.upnp_class.has_prefix (IMAGE_CLASS) && this.size <= 0;
+        return this.streamable () && this.size <= 0;
+    }
+
+    public bool streamable () {
+        return !this.upnp_class.has_prefix (IMAGE_CLASS);
     }
 
     // Adds URI to MediaItem. You can either provide the associated thumbnail or