[rygel] server: Accept invalid seek requests for some devices
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Accept invalid seek requests for some devices
- Date: Sat, 13 Apr 2013 12:15:15 +0000 (UTC)
commit 639ac7c0311a2c7e538b396ef8e5d2b4ce529aae
Author: Jens Georg <jensg openismus com>
Date: Sun Mar 10 12:55:33 2013 +0100
server: Accept invalid seek requests for some devices
https://bugzilla.gnome.org/show_bug.cgi?id=674736
src/librygel-server/filelist.am | 1 +
src/librygel-server/rygel-client-hacks.vala | 7 ++++
src/librygel-server/rygel-http-byte-seek.vala | 13 ++++--
src/librygel-server/rygel-http-time-seek.vala | 11 ++++-
src/librygel-server/rygel-samsung-tv-hacks.vala | 4 ++
src/librygel-server/rygel-seek-hacks.vala | 53 +++++++++++++++++++++++++
src/librygel-server/rygel-xbmc-hacks.vala | 4 ++
7 files changed, 87 insertions(+), 6 deletions(-)
---
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index 6d200a5..dec2e1e 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -66,6 +66,7 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
rygel-media-receiver-registrar.vala \
rygel-panasonic-hacks.vala \
rygel-samsung-tv-hacks.vala \
+ rygel-seek-hacks.vala \
rygel-search-criteria-parser.vala \
rygel-search.vala \
rygel-serializer.vala \
diff --git a/src/librygel-server/rygel-client-hacks.vala b/src/librygel-server/rygel-client-hacks.vala
index c6b53be..a001b67 100644
--- a/src/librygel-server/rygel-client-hacks.vala
+++ b/src/librygel-server/rygel-client-hacks.vala
@@ -75,6 +75,11 @@ internal abstract class Rygel.ClientHacks : GLib.Object {
return new SamsungTVHacks (message);
} catch (Error error) { }
+ try {
+ return new SeekHacks (message);
+ } catch (Error error) { }
+
+
return new XBMCHacks (message);
}
@@ -85,6 +90,8 @@ internal abstract class Rygel.ClientHacks : GLib.Object {
public virtual void filter_sort_criteria (ref string sort_criteria) {}
+ public virtual bool force_seek () { return false; }
+
public virtual async MediaObjects? search
(SearchableContainer container,
SearchExpression? expression,
diff --git a/src/librygel-server/rygel-http-byte-seek.vala b/src/librygel-server/rygel-http-byte-seek.vala
index 9be0f36..590a1ae 100644
--- a/src/librygel-server/rygel-http-byte-seek.vala
+++ b/src/librygel-server/rygel-http-byte-seek.vala
@@ -61,13 +61,18 @@ internal class Rygel.HTTPByteSeek : Rygel.HTTPSeek {
}
public static bool needed (HTTPGet request) {
- return !(request.object is MediaContainer) && ((request.object as MediaItem).size > 0 &&
+ bool force_seek = false;
+
+ try {
+ var hack = ClientHacks.create (request.msg);
+ force_seek = hack.force_seek ();
+ } catch (Error error) { }
+
+ return force_seek || (!(request.object is MediaContainer) && ((request.object as MediaItem).size > 0
&&
request.handler is HTTPIdentityHandler) ||
(request.thumbnail != null &&
request.thumbnail.size > 0) ||
- (request.subtitle != null && request.subtitle.size > 0) ||
- request.msg.request_headers.get_one ("User-Agent") ==
- "PLAYSTATION 3";
+ (request.subtitle != null && request.subtitle.size > 0));
}
public static bool requested (HTTPGet request) {
diff --git a/src/librygel-server/rygel-http-time-seek.vala b/src/librygel-server/rygel-http-time-seek.vala
index 7fed78e..ac18982 100644
--- a/src/librygel-server/rygel-http-time-seek.vala
+++ b/src/librygel-server/rygel-http-time-seek.vala
@@ -90,12 +90,19 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
}
public static bool needed (HTTPGet request) {
- return request.object is AudioItem &&
+ bool force_seek = false;
+
+ try {
+ var hack = ClientHacks.create (request.msg);
+ force_seek = hack.force_seek ();
+ } catch (Error error) { }
+
+ return force_seek || (request.object is AudioItem &&
(request.object as AudioItem).duration > 0 &&
(request.handler is HTTPTranscodeHandler ||
(request.thumbnail == null &&
request.subtitle == null &&
- (request.object as MediaItem).is_live_stream ()));
+ (request.object as MediaItem).is_live_stream ())));
}
public static bool requested (HTTPGet request) {
diff --git a/src/librygel-server/rygel-samsung-tv-hacks.vala b/src/librygel-server/rygel-samsung-tv-hacks.vala
index 452382e..f276edc 100644
--- a/src/librygel-server/rygel-samsung-tv-hacks.vala
+++ b/src/librygel-server/rygel-samsung-tv-hacks.vala
@@ -33,4 +33,8 @@ internal class Rygel.SamsungTVHacks : ClientHacks {
item.mime_type = "video/x-mkv";
}
}
+
+ public override bool force_seek () {
+ return true;
+ }
}
diff --git a/src/librygel-server/rygel-seek-hacks.vala b/src/librygel-server/rygel-seek-hacks.vala
new file mode 100644
index 0000000..d1e45fa
--- /dev/null
+++ b/src/librygel-server/rygel-seek-hacks.vala
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Jens Georg <mail jensge org>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+using Soup;
+using GUPnP;
+
+/**
+ * Hacks class to accept seeks that are invalid according to DLNA.
+ *
+ * Some devices always request the full range on a non-seekable stream, be it
+ * transcoded or live, regardless of what DLNA.ORG_OP says. This hack just
+ * accepts this seek request.
+ *
+ * Supported devices are:
+ * - Onkyo (Mediabolic-IMHTTP)
+ * - PS3
+ * - Sharp TVs
+ * - WD TV Live (alphanetworks)
+ *
+ * Samsung devices are also affected but they need other hacks as well to
+ * that's handled in the Samsung-specific class.
+ */
+internal class Rygel.SeekHacks : ClientHacks {
+ private const string AGENT = ".*Mediabolic-IMHTTP.*|" +
+ ".*PLAYSTATION 3.*|" +
+ ".*SHARP-AQUOS-DMP.*|" +
+ ".*alphanetworks.*";
+
+ public SeekHacks (Message? message = null) throws ClientHacksError {
+ base (AGENT, message);
+ }
+
+ public override bool force_seek () {
+ return true;
+ }
+}
diff --git a/src/librygel-server/rygel-xbmc-hacks.vala b/src/librygel-server/rygel-xbmc-hacks.vala
index 8659c9b..d38f8bc 100644
--- a/src/librygel-server/rygel-xbmc-hacks.vala
+++ b/src/librygel-server/rygel-xbmc-hacks.vala
@@ -39,4 +39,8 @@ internal class Rygel.XBMCHacks : ClientHacks {
item.mime_type = "audio/aac";
}
}
+
+ public override bool force_seek () {
+ return true;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]