[rygel] core: Introducing HTTPSeek.step property
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Introducing HTTPSeek.step property
- Date: Thu, 14 Apr 2011 13:27:17 +0000 (UTC)
commit 4b96c342cdefb110119195045657a2812a828199
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Apr 14 15:59:34 2011 +0300
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.
src/rygel/rygel-http-byte-seek.vala | 2 +-
src/rygel/rygel-http-seek.vala | 5 ++++-
src/rygel/rygel-http-time-seek.vala | 4 ++--
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 5687d13..d1b2d34 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 f93c3a1..83bf355 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 720a9b1..c66b992 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]