From a7d5b6cc6b8e7eabc297a01212bbdc31ec9197e1 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Fri, 20 Aug 2010 22:36:37 +0300 Subject: [PATCH] core: Add MediaItem.streamable() Differential between items that are streamable and should be streamed. --- src/rygel/rygel-http-get.vala | 2 +- src/rygel/rygel-media-item.vala | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala index 1530c23..b783102 100644 --- a/src/rygel/rygel-http-get.vala +++ b/src/rygel/rygel-http-get.vala @@ -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); diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala index e1431ac..8fd777e 100644 --- a/src/rygel/rygel-media-item.vala +++ b/src/rygel/rygel-media-item.vala @@ -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 -- 2.7.4