[rygel] core: HTTPRequest keeps only 1 instance of HTTPSeek



commit c024b5798f4f6bd69d9d1cf35d54acadf561145a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Dec 8 19:15:13 2009 +0200

    core: HTTPRequest keeps only 1 instance of HTTPSeek
    
    No need to keep two instances of seek when in reality we will only have
    one of them for each HTTP request.

 src/rygel/rygel-http-identity-handler.vala  |   16 +++++-----------
 src/rygel/rygel-http-request.vala           |   10 ++++++----
 src/rygel/rygel-http-transcode-handler.vala |    6 +++---
 3 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/src/rygel/rygel-http-identity-handler.vala b/src/rygel/rygel-http-identity-handler.vala
index 4a681bb..7152d26 100644
--- a/src/rygel/rygel-http-identity-handler.vala
+++ b/src/rygel/rygel-http-identity-handler.vala
@@ -40,14 +40,8 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
                                                  request.item.mime_type);
         }
 
-        if (request.thumbnail == null && request.item.should_stream ()) {
-            if (request.time_range != null) {
-                request.time_range.add_response_headers ();
-            }
-        } else {
-            if (request.byte_range != null) {
-                request.byte_range.add_response_headers ();
-            }
+        if (request.seek != null) {
+            request.seek.add_response_headers ();
         }
 
         // Chain-up
@@ -80,7 +74,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
             return new SeekableResponse (request.server,
                                          request.msg,
                                          request.thumbnail.uri,
-                                         request.byte_range,
+                                         request.seek,
                                          request.thumbnail.size,
                                          this.cancellable);
         }
@@ -97,7 +91,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
                                      request.msg,
                                      "RygelLiveResponse",
                                      src,
-                                     request.time_range,
+                                     request.seek,
                                      this.cancellable);
         } else {
             if (item.uris.size == 0) {
@@ -109,7 +103,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
             return new SeekableResponse (request.server,
                                          request.msg,
                                          item.uris.get (0),
-                                         request.byte_range,
+                                         request.seek,
                                          item.size,
                                          this.cancellable);
         }
diff --git a/src/rygel/rygel-http-request.vala b/src/rygel/rygel-http-request.vala
index 1c8ea44..f755f0d 100644
--- a/src/rygel/rygel-http-request.vala
+++ b/src/rygel/rygel-http-request.vala
@@ -49,8 +49,7 @@ internal class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
     private int thumbnail_index;
     public MediaItem item;
     public Thumbnail thumbnail;
-    public HTTPSeek byte_range;
-    public HTTPSeek time_range;
+    public HTTPSeek seek;
 
     private HTTPRequestHandler request_handler;
 
@@ -132,8 +131,11 @@ internal class Rygel.HTTPRequest : GLib.Object, Rygel.StateMachine {
 
     private async void handle_item_request () {
         try {
-            this.byte_range = HTTPSeek.from_byte_range (this);
-            this.time_range = HTTPSeek.from_time_range (this);
+            if (this.thumbnail == null && this.item.should_stream ()) {
+                this.seek = HTTPSeek.from_time_range (this);
+            } else {
+                this.seek = HTTPSeek.from_byte_range (this);
+            }
 
             // Add headers
             this.request_handler.add_response_headers (this);
diff --git a/src/rygel/rygel-http-transcode-handler.vala b/src/rygel/rygel-http-transcode-handler.vala
index 5cb43de..149e5e0 100644
--- a/src/rygel/rygel-http-transcode-handler.vala
+++ b/src/rygel/rygel-http-transcode-handler.vala
@@ -40,8 +40,8 @@ internal class Rygel.HTTPTranscodeHandler : HTTPRequestHandler {
                                                throws HTTPRequestError {
         request.msg.response_headers.append ("Content-Type",
                                              this.transcoder.mime_type);
-        if (request.time_range != null) {
-            request.time_range.add_response_headers ();
+        if (request.seek != null) {
+            request.seek.add_response_headers ();
         }
 
         // Chain-up
@@ -63,7 +63,7 @@ internal class Rygel.HTTPTranscodeHandler : HTTPRequestHandler {
                                      request.msg,
                                      "RygelLiveResponse",
                                      src,
-                                     request.time_range,
+                                     request.seek,
                                      this.cancellable);
         } catch (GLib.Error err) {
             throw new HTTPRequestError.NOT_FOUND (err.message);



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