[rygel] all: Apply V1 downgrade to each service
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] all: Apply V1 downgrade to each service
- Date: Mon, 4 Mar 2013 08:00:08 +0000 (UTC)
commit 000c054b04a9cdc14d2929ba432a5857a3cd26f5
Author: Jens Georg <jensg openismus com>
Date: Sun Mar 3 14:00:16 2013 +0100
all: Apply V1 downgrade to each service
https://bugzilla.gnome.org/show_bug.cgi?id=694270
src/librygel-core/rygel-v1-hacks.vala | 21 +++++++++++++------
.../rygel-media-renderer-plugin.vala | 7 +++--
src/librygel-server/rygel-media-server-plugin.vala | 6 ++--
3 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/src/librygel-core/rygel-v1-hacks.vala b/src/librygel-core/rygel-v1-hacks.vala
index 1927e36..6b868f4 100644
--- a/src/librygel-core/rygel-v1-hacks.vala
+++ b/src/librygel-core/rygel-v1-hacks.vala
@@ -30,6 +30,7 @@ using GUPnP;
* ContentDirectory:1 because they ignore that higher versions are
* required to be backwards-compatible.
*/
+// FIXME: internal
public class Rygel.V1Hacks : Object {
private const string[] AGENTS = { "Allegro-Software-WebClient",
"SEC HHP",
@@ -49,16 +50,17 @@ public class Rygel.V1Hacks : Object {
}
private string device_type_v1;
- public string service_type { construct; get; }
- public string service_type_v1 { construct; get; }
+ public string[] service_types { construct; get; }
private const string MATCHING_PATTERN = ".*%s.*";
+ private const string SERVICE_TYPE_PATTERN = ":[0-9]+$";
private static string agent_pattern;
public string description_path;
private Regex agent_regex;
+ private Regex service_type_regex;
/**
* Read the user-agent snippets from the config file and generate the
@@ -99,11 +101,9 @@ public class Rygel.V1Hacks : Object {
}
public V1Hacks (string device_type,
- string service_type,
- string service_type_v1) {
+ string[] service_types) {
Object (device_type : device_type,
- service_type : service_type,
- service_type_v1 : service_type_v1);
+ service_types : service_types);
}
public override void constructed () {
@@ -111,6 +111,7 @@ public class Rygel.V1Hacks : Object {
try {
this.agent_regex = new Regex (generate_agent_pattern ());
+ this.service_type_regex = new Regex (SERVICE_TYPE_PATTERN);
} catch (Error error) { assert_not_reached (); }
}
@@ -126,7 +127,13 @@ public class Rygel.V1Hacks : Object {
var description_file = new DescriptionFile (template_path);
description_file.set_device_type (device_type_v1);
- description_file.modify_service_type (service_type, service_type_v1);
+
+ foreach (var service_type in service_types) {
+ var service_type_v1 = this.service_type_regex.replace_literal
+ (service_type, -1, 0, ":1");
+ message (" %s => %s", service_type, service_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/rygel-media-renderer-plugin.vala
b/src/librygel-renderer/rygel-media-renderer-plugin.vala
index 7160252..2e03a99 100644
--- a/src/librygel-renderer/rygel-media-renderer-plugin.vala
+++ b/src/librygel-renderer/rygel-media-renderer-plugin.vala
@@ -96,9 +96,10 @@ public class Rygel.MediaRendererPlugin : Rygel.Plugin {
public override void apply_hacks (RootDevice device,
string description_path)
throws Error {
- var v1_hacks = new V1Hacks (DMR,
- AVTransport.UPNP_TYPE,
- AVTransport.UPNP_TYPE_V1);
+ string[] services = { AVTransport.UPNP_TYPE,
+ RenderingControl.UPNP_TYPE,
+ ConnectionManager.UPNP_TYPE };
+ var v1_hacks = new V1Hacks (DMR, services);
v1_hacks.apply_on_device (device, description_path);
}
diff --git a/src/librygel-server/rygel-media-server-plugin.vala
b/src/librygel-server/rygel-media-server-plugin.vala
index 586a81e..1ee13d2 100644
--- a/src/librygel-server/rygel-media-server-plugin.vala
+++ b/src/librygel-server/rygel-media-server-plugin.vala
@@ -106,9 +106,9 @@ public abstract class Rygel.MediaServerPlugin : Rygel.Plugin {
string description_path)
throws Error {
// Apply V1 downgrades
- var v1_hacks = new V1Hacks (DMS,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.UPNP_TYPE_V1);
+ string[] services = { ContentDirectory.UPNP_TYPE,
+ ConnectionManager.UPNP_TYPE };
+ var v1_hacks = new V1Hacks (DMS, services);
v1_hacks.apply_on_device (device, description_path);
// Apply XBox hacks on top of that
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]