[rygel/wip/cablelabs-integration: 7/18] server: Move code for Samsung subtitles
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/cablelabs-integration: 7/18] server: Move code for Samsung subtitles
- Date: Thu, 20 Nov 2014 20:38:19 +0000 (UTC)
commit 6e44d57e09f7f48888f428de8f2ea1456533ca43
Author: Jens Georg <mail jensge org>
Date: Thu Nov 20 07:59:51 2014 +0100
server: Move code for Samsung subtitles
Move it to Samsung hacks class.
Signed-off-by: Jens Georg <mail jensge org>
src/librygel-server/rygel-client-hacks.vala | 2 ++
src/librygel-server/rygel-http-get-handler.vala | 17 ++++-------------
src/librygel-server/rygel-samsung-tv-hacks.vala | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/src/librygel-server/rygel-client-hacks.vala b/src/librygel-server/rygel-client-hacks.vala
index 8bb9927..32a9013 100644
--- a/src/librygel-server/rygel-client-hacks.vala
+++ b/src/librygel-server/rygel-client-hacks.vala
@@ -95,6 +95,8 @@ internal abstract class Rygel.ClientHacks : GLib.Object {
public virtual bool force_seek () { return false; }
+ public virtual void modify_headers (HTTPRequest request) {}
+
public virtual async MediaObjects? search
(SearchableContainer container,
SearchExpression? expression,
diff --git a/src/librygel-server/rygel-http-get-handler.vala b/src/librygel-server/rygel-http-get-handler.vala
index 83f77da..48638ec 100644
--- a/src/librygel-server/rygel-http-get-handler.vala
+++ b/src/librygel-server/rygel-http-get-handler.vala
@@ -62,19 +62,10 @@ internal abstract class Rygel.HTTPGetHandler: GLib.Object {
"failed to provide the value in response headers");
}
- // Handle Samsung DLNA TV proprietary subtitle headers
- if (request.msg.request_headers.get_one ("getCaptionInfo.sec") != null
- && (request.object is VideoItem)
- && (request.object as VideoItem).subtitles.size > 0) {
- var caption_uri = request.http_server.create_uri_for_item
- (request.object as MediaItem,
- -1,
- 0, // FIXME: offer first subtitle only?
- null,
- null);
-
- request.msg.response_headers.append ("CaptionInfo.sec",
- caption_uri);
+ // Handle device-specific hacks that need to change the response
+ // headers such as Samsung's subtitle stuff.
+ if (request.hack != null) {
+ request.hack.modify_headers (request);
}
request.msg.response_headers.append ("Connection", "close");
diff --git a/src/librygel-server/rygel-samsung-tv-hacks.vala b/src/librygel-server/rygel-samsung-tv-hacks.vala
index 83ea363..e6a35fc 100644
--- a/src/librygel-server/rygel-samsung-tv-hacks.vala
+++ b/src/librygel-server/rygel-samsung-tv-hacks.vala
@@ -52,4 +52,20 @@ internal class Rygel.SamsungTVHacks : ClientHacks {
public override bool force_seek () {
return true;
}
+
+ public override void modify_headers (HTTPRequest request) {
+ if (request.msg.request_headers.get_one ("getCaptionInfo.sec") != null
+ && (request.object is VideoItem)
+ && (request.object as VideoItem).subtitles.size > 0) {
+ var caption_uri = request.http_server.create_uri_for_item
+ (request.object as MediaItem,
+ -1,
+ 0, // FIXME: offer first subtitle only?
+ null,
+ null);
+
+ request.msg.response_headers.append ("CaptionInfo.sec",
+ caption_uri);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]