Commit 639ac7c0 authored by Jens Georg's avatar Jens Georg
Browse files

server: Accept invalid seek requests for some devices

https://bugzilla.gnome.org/show_bug.cgi?id=674736
parent 64f65d14
......@@ -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 \
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -33,4 +33,8 @@ internal class Rygel.SamsungTVHacks : ClientHacks {
item.mime_type = "video/x-mkv";
}
}
public override bool force_seek () {
return true;
}
}
/*
* 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;
}
}
......@@ -39,4 +39,8 @@ internal class Rygel.XBMCHacks : ClientHacks {
item.mime_type = "audio/aac";
}
}
public override bool force_seek () {
return true;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment