summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2011-04-14 15:59:34 +0300
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>2011-04-14 15:59:34 +0300
commit4b96c342cdefb110119195045657a2812a828199 (patch)
tree2ade828273fe305a1d4f2c9f93b868208ae2d8ff
parentaed924766845174bae506b9b203c67775a186041 (diff)
downloadrygel-4b96c342cdefb110119195045657a2812a828199.tar.gz
core: Introducing HTTPSeek.step property
Abstract HTTPSeek class now uses (and requires) a 'step' property. Currently its only used for calculating 'length' from given 'stop' and 'start' values. This also fixes the wrong length calculation for HTTPTimeSeek in case of serving the whole duration of the stream.
-rw-r--r--src/rygel/rygel-http-byte-seek.vala2
-rw-r--r--src/rygel/rygel-http-seek.vala5
-rw-r--r--src/rygel/rygel-http-time-seek.vala4
3 files changed, 7 insertions, 4 deletions
diff --git a/src/rygel/rygel-http-byte-seek.vala b/src/rygel/rygel-http-byte-seek.vala
index 5687d13f..d1b2d34e 100644
--- a/src/rygel/rygel-http-byte-seek.vala
+++ b/src/rygel/rygel-http-byte-seek.vala
@@ -73,7 +73,7 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
}
}
- base (request.msg, start, stop, total_length);
+ base (request.msg, start, stop, 1, total_length);
}
public static bool needed (HTTPGet request) {
diff --git a/src/rygel/rygel-http-seek.vala b/src/rygel/rygel-http-seek.vala
index f93c3a1a..83bf3554 100644
--- a/src/rygel/rygel-http-seek.vala
+++ b/src/rygel/rygel-http-seek.vala
@@ -32,23 +32,26 @@ internal abstract class Rygel.HTTPSeek : GLib.Object {
// These are either number of bytes or microseconds
public int64 start { get; private set; }
public int64 stop { get; private set; }
+ public int64 step { get; private set; }
public int64 length { get; private set; }
public int64 total_length { get; private set; }
public HTTPSeek (Soup.Message msg,
int64 start,
int64 stop,
+ int64 step,
int64 total_length) {
this.msg = msg;
this.start = start;
this.stop = stop;
+ this.length = length;
this.total_length = total_length;
if (length > 0) {
this.stop = stop.clamp (start + 1, length - 1);
}
- this.length = stop + 1 - start;
+ this.length = stop + step - start;
}
public abstract void add_response_headers ();
diff --git a/src/rygel/rygel-http-time-seek.vala b/src/rygel/rygel-http-time-seek.vala
index 720a9b13..c66b9928 100644
--- a/src/rygel/rygel-http-time-seek.vala
+++ b/src/rygel/rygel-http-time-seek.vala
@@ -36,7 +36,7 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
string[] range_tokens;
int64 start = 0;
int64 duration = (request.item as AudioItem).duration * SECOND;
- int64 stop = duration - SECOND;
+ int64 stop = duration - MSECOND;
range = request.msg.request_headers.get_one ("TimeSeekRange.dlna.org");
if (range != null) {
@@ -74,7 +74,7 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
}
}
- base (request.msg, start, stop, duration);
+ base (request.msg, start, stop, MSECOND, duration);
}
public static bool needed (HTTPGet request) {