From: Zeeshan Ali (Khattak) Date: Fri, 21 Jan 2011 16:51:18 +0000 (+0200) Subject: core: HTTPSeekableResponse.priority -> HTTPResponse X-Git-Tag: RYGEL_0_9_9~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf0b1f7626175e374a1ee41e8a3b1d1bd80148a6;p=profile%2Fivi%2Frygel.git core: HTTPSeekableResponse.priority -> HTTPResponse Move determination of message/stream priority from HTTPSeekableResponse to parent HTTPResponse class. Also 'priority' is now a GObject property. --- diff --git a/src/rygel/rygel-http-response.vala b/src/rygel/rygel-http-response.vala index 0a52594..c91adac 100644 --- a/src/rygel/rygel-http-response.vala +++ b/src/rygel/rygel-http-response.vala @@ -30,6 +30,29 @@ internal abstract class Rygel.HTTPResponse : GLib.Object, Rygel.StateMachine { public Cancellable cancellable { get; set; } protected SourceFunc run_continue; + private int _priority = -1; + protected int priority { + get { + if (this._priority != -1) { + return this._priority; + } + + var mode = this.msg.request_headers.get_one + ("transferMode.dlna.org"); + + if (mode == null || mode == "Interactive") { + this._priority = Priority.DEFAULT; + } else if (mode == "Streaming") { + this._priority = Priority.HIGH; + } else if (mode == "Background") { + this._priority = Priority.LOW; + } else { + this._priority = Priority.DEFAULT; + } + + return _priority; + } + } public HTTPResponse (Soup.Server server, Soup.Message msg, diff --git a/src/rygel/rygel-http-seekable-response.vala b/src/rygel/rygel-http-seekable-response.vala index e538f17..f72ac01 100644 --- a/src/rygel/rygel-http-seekable-response.vala +++ b/src/rygel/rygel-http-seekable-response.vala @@ -34,8 +34,6 @@ internal class Rygel.HTTPSeekableResponse : Rygel.HTTPResponse { private uint8[] buffer; private size_t total_length; - int priority; - public HTTPSeekableResponse (Soup.Server server, Soup.Message msg, string uri, @@ -47,7 +45,6 @@ internal class Rygel.HTTPSeekableResponse : Rygel.HTTPResponse { base (server, msg, partial, cancellable); this.seek = seek; - this.priority = this.get_requested_priority (); this.total_length = (size_t) seek.length; this.buffer = new uint8[HTTPSeekableResponse.BUFFER_LENGTH]; @@ -152,19 +149,5 @@ internal class Rygel.HTTPSeekableResponse : Rygel.HTTPResponse { this.end (false, Soup.KnownStatusCode.NONE); } } - - private int get_requested_priority () { - var mode = this.msg.request_headers.get_one ("transferMode.dlna.org"); - - if (mode == null || mode == "Interactive") { - return Priority.DEFAULT; - } else if (mode == "Streaming") { - return Priority.HIGH; - } else if (mode == "Background") { - return Priority.LOW; - } else { - return Priority.DEFAULT; - } - } }