[rygel/wip/downgrade-renderer] wip: Downgrade renderer
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/downgrade-renderer] wip: Downgrade renderer
- Date: Wed, 23 Jan 2013 23:32:40 +0000 (UTC)
commit a26cfecca5dfc0dea26795e38a68c494d962b7c7
Author: Jens Georg <jensg openismus com>
Date: Wed Jan 23 23:39:05 2013 +0100
wip: Downgrade renderer
https://bugzilla.gnome.org/show_bug.cgi?id=675186
src/librygel-core/filelist.am | 3 +-
.../rygel-v1-hacks.vala | 36 ++++++++++++-----
src/librygel-renderer/filelist.am | 3 +-
src/librygel-renderer/rygel-av-transport.vala | 2 +
.../rygel-media-renderer-plugin.vala | 8 ++++
src/librygel-renderer/rygel-renderer-v1-hacks.vala | 41 +++++++++++++++++++
src/librygel-server/filelist.am | 2 +-
src/librygel-server/rygel-media-server-plugin.vala | 2 +-
src/librygel-server/rygel-server-v1-hacks.vala | 42 ++++++++++++++++++++
9 files changed, 125 insertions(+), 14 deletions(-)
---
diff --git a/src/librygel-core/filelist.am b/src/librygel-core/filelist.am
index a9800fd..a37467e 100644
--- a/src/librygel-core/filelist.am
+++ b/src/librygel-core/filelist.am
@@ -14,7 +14,8 @@ LIBRYGEL_CORE_VAPI_SOURCE_FILES = \
rygel-configuration.vala \
rygel-base-configuration.vala \
rygel-free-desktop-interfaces.vala \
- rygel-state-machine.vala
+ rygel-state-machine.vala \
+ rygel-v1-hacks.vala
LIBRYGEL_CORE_NONVAPI_SOURCE_FILES = \
rygel-icon-info.vala \
diff --git a/src/librygel-server/rygel-v1-hacks.vala b/src/librygel-core/rygel-v1-hacks.vala
similarity index 79%
rename from src/librygel-server/rygel-v1-hacks.vala
rename to src/librygel-core/rygel-v1-hacks.vala
index 01cffd5..ea019bc 100644
--- a/src/librygel-server/rygel-v1-hacks.vala
+++ b/src/librygel-core/rygel-v1-hacks.vala
@@ -30,7 +30,7 @@ using GUPnP;
* ContentDirectory:1 because they ignore that higher versions are
* required to be backwards-compatible.
*/
-internal class Rygel.V1Hacks : ClientHacks {
+public class Rygel.V1Hacks : Object {
private const string[] AGENTS = { "Allegro-Software-WebClient",
"SEC HHP",
"SEC_HHP",
@@ -39,14 +39,27 @@ internal class Rygel.V1Hacks : ClientHacks {
"Reciva",
"FDSSDP" };
- private const string DMS = "urn:schemas-upnp-org:device:MediaServer";
- private const string DMS_V1 = DMS + ":1";
+ private string _device_type;
+ public string device_type {
+ construct set {
+ this._device_type = value;
+ this.device_type_v1 = value + ":1";
+ }
+ get { return this._device_type; }
+ }
+ private string device_type_v1;
+
+ public string service_type { construct; get; }
+ public string service_type_v1 { construct; get; }
+
private const string MATCHING_PATTERN = ".*%s.*";
private static string agent_pattern;
public string description_path;
+ private Regex agent_regex;
+
/**
* Read the user-agent snippets from the config file and generate the
* regular expression string for matching.
@@ -55,7 +68,7 @@ internal class Rygel.V1Hacks : ClientHacks {
* user-agents.
*/
private static string generate_agent_pattern () {
- if (likely (agent_pattern != null)) {
+ if (agent_pattern != null) {
return agent_pattern;
}
@@ -85,13 +98,17 @@ internal class Rygel.V1Hacks : ClientHacks {
return agent_pattern;
}
- public V1Hacks () throws ClientHacksError {
- base (generate_agent_pattern (), null);
+ public override void constructed () {
+ base.constructed ();
+
+ try {
+ this.agent_regex = new Regex (generate_agent_pattern ());
+ } catch (Error error) { assert_not_reached (); }
}
public void apply_on_device (RootDevice device,
string? template_path) throws Error {
- if (!device.get_device_type ().has_prefix (DMS)) {
+ if (!device.get_device_type ().has_prefix (device_type)) {
return;
}
@@ -100,9 +117,8 @@ internal class Rygel.V1Hacks : ClientHacks {
}
var description_file = new DescriptionFile (template_path);
- description_file.set_device_type (DMS_V1);
- description_file.modify_service_type (ContentDirectory.UPNP_TYPE,
- ContentDirectory.UPNP_TYPE_V1);
+ description_file.set_device_type (device_type_v1);
+ description_file.modify_service_type (service_type, service_type_v1);
this.description_path = template_path.replace (".xml", "-v1.xml");
description_file.save (this.description_path);
diff --git a/src/librygel-renderer/filelist.am b/src/librygel-renderer/filelist.am
index 3f5cb08..07b0641 100644
--- a/src/librygel-renderer/filelist.am
+++ b/src/librygel-renderer/filelist.am
@@ -10,4 +10,5 @@ LIBRYGEL_RENDERER_NONVAPI_SOURCE_FILES = \
rygel-sink-connection-manager.vala \
rygel-time-utils.vala \
rygel-changelog.vala \
- rygel-volume.vala
+ rygel-volume.vala \
+ rygel-renderer-v1-hacks.vala
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index 215e65b..ccdd681 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -30,6 +30,8 @@ internal class Rygel.AVTransport : Service {
public const string UPNP_ID = "urn:upnp-org:serviceId:AVTransport";
public const string UPNP_TYPE =
"urn:schemas-upnp-org:service:AVTransport:2";
+ public const string UPNP_TYPE_V1 =
+ "urn:schemas-upnp-org:service:AVTransport:1";
public const string DESCRIPTION_PATH = "xml/AVTransport2.xml";
public const string LAST_CHANGE_NS =
"urn:schemas-upnp-org:metadata-1-0/AVT/";
diff --git a/src/librygel-renderer/rygel-media-renderer-plugin.vala b/src/librygel-renderer/rygel-media-renderer-plugin.vala
index aa93852..2e0ef76 100644
--- a/src/librygel-renderer/rygel-media-renderer-plugin.vala
+++ b/src/librygel-renderer/rygel-media-renderer-plugin.vala
@@ -92,6 +92,14 @@ public class Rygel.MediaRendererPlugin : Rygel.Plugin {
return this.controller;
}
+ public override void apply_hacks (RootDevice device,
+ string description_path)
+ throws Error {
+ var v1_hacks = new RendererV1Hacks ();
+ v1_hacks.apply_on_device (device, description_path);
+ }
+
+
public string get_protocol_info () {
var player = this.get_player ();
if (player == null) {
diff --git a/src/librygel-renderer/rygel-renderer-v1-hacks.vala b/src/librygel-renderer/rygel-renderer-v1-hacks.vala
new file mode 100644
index 0000000..3ab046d
--- /dev/null
+++ b/src/librygel-renderer/rygel-renderer-v1-hacks.vala
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation.
+ * Copyright (C) 2012 Jens Georg.
+ *
+ * Author: Jens Georg <jensg openismus com>
+ * 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;
+
+/**
+ * Various devices that need a downgrade to MediaServer:1 and
+ * ContentDirectory:1 because they ignore that higher versions are
+ * required to be backwards-compatible.
+ */
+internal class Rygel.RendererV1Hacks : Rygel.V1Hacks {
+ private const string DMR = "urn:schemas-upnp-org:device:MediaRenderer";
+
+ public RendererV1Hacks () {
+ Object (device_type : DMR,
+ service_type : AVTransport.UPNP_TYPE,
+ service_type_v1 : AVTransport.UPNP_TYPE_V1);
+ }
+}
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index e961efd..d160a36 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -70,7 +70,7 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
rygel-source-connection-manager.vala \
rygel-subtitle-manager.vala \
rygel-thumbnailer.vala \
- rygel-v1-hacks.vala \
+ rygel-server-v1-hacks.vala \
rygel-wmp-hacks.vala \
rygel-xbmc-hacks.vala \
rygel-xbox-hacks.vala \
diff --git a/src/librygel-server/rygel-media-server-plugin.vala b/src/librygel-server/rygel-media-server-plugin.vala
index 7ae451c..a71b42c 100644
--- a/src/librygel-server/rygel-media-server-plugin.vala
+++ b/src/librygel-server/rygel-media-server-plugin.vala
@@ -98,7 +98,7 @@ public abstract class Rygel.MediaServerPlugin : Rygel.Plugin {
string description_path)
throws Error {
// Apply V1 downgrades
- var v1_hacks = new V1Hacks ();
+ var v1_hacks = new ServerV1Hacks ();
v1_hacks.apply_on_device (device, description_path);
// Apply XBox hacks on top of that
diff --git a/src/librygel-server/rygel-server-v1-hacks.vala b/src/librygel-server/rygel-server-v1-hacks.vala
new file mode 100644
index 0000000..477a550
--- /dev/null
+++ b/src/librygel-server/rygel-server-v1-hacks.vala
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation.
+ * Copyright (C) 2012 Jens Georg.
+ *
+ * Author: Jens Georg <jensg openismus com>
+ * 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;
+
+/**
+ * Various devices that need a downgrade to MediaServer:1 and
+ * ContentDirectory:1 because they ignore that higher versions are
+ * required to be backwards-compatible.
+ */
+internal class Rygel.ServerV1Hacks : Rygel.V1Hacks {
+ private const string DMS = "urn:schemas-upnp-org:device:MediaServer";
+
+ public ServerV1Hacks () {
+ Object (device_type : DMS,
+ service_type : ContentDirectory.UPNP_TYPE,
+ service_type_v1 : ContentDirectory.UPNP_TYPE_V1);
+
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]