[rygel] server,renderer: Downgrade renderer as well
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server,renderer: Downgrade renderer as well
- Date: Fri, 25 Jan 2013 15:28:22 +0000 (UTC)
commit d6d265c2b9a39710fc4c5dca5a9cff745dccbdd5
Author: Jens Georg <jensg openismus com>
Date: Wed Jan 23 23:39:05 2013 +0100
server,renderer: Downgrade renderer as well
https://bugzilla.gnome.org/show_bug.cgi?id=675186
src/librygel-core/filelist.am | 3 +-
.../rygel-v1-hacks.vala | 44 +++++++++++++++----
src/librygel-renderer/rygel-av-transport.vala | 2 +
.../rygel-media-renderer-plugin.vala | 11 +++++
src/librygel-server/filelist.am | 1 -
src/librygel-server/rygel-media-server-plugin.vala | 5 ++-
6 files changed, 53 insertions(+), 13 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 75%
rename from src/librygel-server/rygel-v1-hacks.vala
rename to src/librygel-core/rygel-v1-hacks.vala
index 01cffd5..1927e36 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,25 @@ internal class Rygel.V1Hacks : ClientHacks {
return agent_pattern;
}
- public V1Hacks () throws ClientHacksError {
- base (generate_agent_pattern (), null);
+ public V1Hacks (string device_type,
+ string service_type,
+ string service_type_v1) {
+ Object (device_type : device_type,
+ service_type : service_type,
+ service_type_v1 : service_type_v1);
+ }
+
+ 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 +125,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/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..7160252 100644
--- a/src/librygel-renderer/rygel-media-renderer-plugin.vala
+++ b/src/librygel-renderer/rygel-media-renderer-plugin.vala
@@ -34,6 +34,7 @@ public class Rygel.MediaRendererPlugin : Rygel.Plugin {
private static const string MEDIA_RENDERER_DESC_PATH =
BuildConfig.DATA_DIR +
"/xml/MediaRenderer2.xml";
+ private static const string DMR = "urn:schemas-upnp-org:device:MediaRenderer";
private string sink_protocol_info;
private PlayerController controller;
@@ -92,6 +93,16 @@ 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 V1Hacks (DMR,
+ AVTransport.UPNP_TYPE,
+ AVTransport.UPNP_TYPE_V1);
+ 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-server/filelist.am b/src/librygel-server/filelist.am
index e961efd..d5b1c75 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -70,7 +70,6 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
rygel-source-connection-manager.vala \
rygel-subtitle-manager.vala \
rygel-thumbnailer.vala \
- rygel-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..7d1f424 100644
--- a/src/librygel-server/rygel-media-server-plugin.vala
+++ b/src/librygel-server/rygel-media-server-plugin.vala
@@ -28,6 +28,7 @@
* in-process via the librygel-server API.
*/
public abstract class Rygel.MediaServerPlugin : Rygel.Plugin {
+ private static const string DMS = "urn:schemas-upnp-org:device:MediaServer";
private static const string MEDIA_SERVER_DESC_PATH =
BuildConfig.DATA_DIR + "/xml/MediaServer3.xml";
@@ -98,7 +99,9 @@ public abstract class Rygel.MediaServerPlugin : Rygel.Plugin {
string description_path)
throws Error {
// Apply V1 downgrades
- var v1_hacks = new V1Hacks ();
+ var v1_hacks = new V1Hacks (DMS,
+ ContentDirectory.UPNP_TYPE,
+ ContentDirectory.UPNP_TYPE_V1);
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]