[rygel] core: Move seeking decision to Seek classes



commit f7631225245a8afd1b2e4e9c048423e80f726f84
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 9 01:34:36 2009 +0200

    core: Move seeking decision to Seek classes

 src/rygel/rygel-http-byte-seek.vala |    4 ++++
 src/rygel/rygel-http-request.vala   |    4 ++--
 src/rygel/rygel-http-time-seek.vala |    4 ++++
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-http-byte-seek.vala b/src/rygel/rygel-http-byte-seek.vala
index 96e8241..72a701b 100644
--- a/src/rygel/rygel-http-byte-seek.vala
+++ b/src/rygel/rygel-http-byte-seek.vala
@@ -80,6 +80,10 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
               length);
     }
 
+    public static bool needed (HTTPRequest request) {
+        return true;
+    }
+
     public override void add_response_headers () {
         // Content-Range: bytes START_BYTE-STOP_BYTE/TOTAL_LENGTH
         var range = "bytes ";
diff --git a/src/rygel/rygel-http-request.vala b/src/rygel/rygel-http-request.vala
index ac834a8..30e2e60 100644
--- a/src/rygel/rygel-http-request.vala
+++ b/src/rygel/rygel-http-request.vala
@@ -131,9 +131,9 @@ internal class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
 
     private async void handle_item_request () {
         try {
-            if (this.thumbnail == null && this.item.should_stream ()) {
+            if (HTTPTimeSeek.needed (this)) {
                 this.seek = new HTTPTimeSeek (this);
-            } else {
+            } else if (HTTPByteSeek.needed (this)) {
                 this.seek = new HTTPByteSeek (this);
             }
 
diff --git a/src/rygel/rygel-http-time-seek.vala b/src/rygel/rygel-http-time-seek.vala
index 789202a..bd3e17c 100644
--- a/src/rygel/rygel-http-time-seek.vala
+++ b/src/rygel/rygel-http-time-seek.vala
@@ -77,6 +77,10 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
               request.item.duration);
     }
 
+    public static bool needed (HTTPRequest request) {
+        return request.thumbnail == null && request.item.should_stream ();
+    }
+
     public override void add_response_headers () {
         // TimeSeekRange.dlna.org: npt=START_TIME-END_TIME/DURATION
         var range = "npt=";



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