[rygel] core: Always seek in case of byte seekable media



commit ce7f5c0db293fabcf211914bd0aaa4578d45f614
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Dec 8 19:20:58 2009 +0200

    core: Always seek in case of byte seekable media

 src/rygel/rygel-http-seek.vala |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/rygel/rygel-http-seek.vala b/src/rygel/rygel-http-seek.vala
index a8ccd2f..69de79b 100644
--- a/src/rygel/rygel-http-seek.vala
+++ b/src/rygel/rygel-http-seek.vala
@@ -57,11 +57,22 @@ internal class Rygel.HTTPSeek : GLib.Object {
                                              throws HTTPSeekError {
         string range, pos;
         string[] range_tokens;
-        int64 start = 0, stop = -1;
+        int64 start = 0, length;
+
+        if (request.thumbnail != null) {
+            length = request.thumbnail.size;
+        } else {
+            length = request.item.size;
+        }
+        var stop = length - 1;
 
         range = request.msg.request_headers.get ("Range");
         if (range == null) {
-            return null;
+            return new HTTPSeek (request.msg,
+                                 Format.BYTES,
+                                 start,
+                                 stop,
+                                 length);
         }
 
         // We have a Range header. Parse.
@@ -82,13 +93,6 @@ internal class Rygel.HTTPSeek : GLib.Object {
             throw new HTTPSeekError.INVALID_RANGE ("Invalid Range '%s'", range);
         }
 
-        int64 length;
-        if (request.thumbnail != null) {
-            length = request.thumbnail.size;
-        } else {
-            length = request.item.size;
-        }
-
         // Get last byte position if specified
         pos = range_tokens[1];
         if (pos[0].isdigit ()) {
@@ -97,9 +101,7 @@ internal class Rygel.HTTPSeek : GLib.Object {
                 throw new HTTPSeekError.INVALID_RANGE ("Invalid Range '%s'",
                                                        range);
             }
-        } else if (pos == "") {
-            stop = length - 1;
-        } else {
+        } else if (pos != "") {
             throw new HTTPSeekError.INVALID_RANGE ("Invalid Range '%s'", range);
         }
 



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