[rygel/wip/basic-management: 136/138] core: Add a config flag for enabling BasicManagement
- From: Jussi Kukkonen <jussik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/basic-management: 136/138] core: Add a config flag for enabling BasicManagement
- Date: Tue, 10 Sep 2013 07:33:07 +0000 (UTC)
commit 83e4271d7a67f25300a6a7ab06f69561b5c058c3
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date: Mon Jun 24 15:10:37 2013 +0300
core: Add a config flag for enabling BasicManagement
Remove the coupling to MediaRenderer: allow BasicManagement on any
rygel plugin, provided the configuration specifies that diagnostics
should be started.
Add a "+DIAGE+" capability that is exposed in the device description
when diagnostics is enabled.
This change means that by default the service will not run. Add this to
rygel.conf to enable:
[Playbin]
diagnostics=true
src/librygel-core/rygel-description-file.vala | 4 ++++
src/librygel-core/rygel-plugin.vala | 20 +++++++++++++++++++-
.../rygel-media-renderer-plugin.vala | 10 +---------
3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/src/librygel-core/rygel-description-file.vala b/src/librygel-core/rygel-description-file.vala
index 37978de..4c1e82d 100644
--- a/src/librygel-core/rygel-description-file.vala
+++ b/src/librygel-core/rygel-description-file.vala
@@ -231,6 +231,10 @@ public class Rygel.DescriptionFile : Object {
flags += "create-child-container";
}
+ if (PluginCapabilities.DIAGNOSTICS in capabilities) {
+ flags += "+DIAGE+";
+ }
+
// Set the flags we found; otherwise remove whatever is in the
// template.
if (flags.length > 0) {
diff --git a/src/librygel-core/rygel-plugin.vala b/src/librygel-core/rygel-plugin.vala
index cee238b..ddaa842 100644
--- a/src/librygel-core/rygel-plugin.vala
+++ b/src/librygel-core/rygel-plugin.vala
@@ -49,9 +49,12 @@ public enum Rygel.PluginCapabilities {
TRACK_CHANGES,
/// Server supports container creation
- CREATE_CONTAINERS
+ CREATE_CONTAINERS,
/* Renderer caps */
+
+ /* Diagnostics (DIAGE) support */
+ DIAGNOSTICS,
}
/**
@@ -146,6 +149,21 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
}
this.resource_infos = new ArrayList<ResourceInfo> ();
+
+ /* Enable BasicManagement service on this device if needed */
+ var config = MetaConfig.get_default ();
+ try {
+ if (config.get_bool (this.name, "diagnostics")) {
+ var resource = new ResourceInfo (BasicManagement.UPNP_ID,
+ BasicManagement.UPNP_TYPE,
+ BasicManagement.DESCRIPTION_PATH,
+ typeof (BasicManagement));
+ this.add_resource (resource);
+
+ this.capabilities |= PluginCapabilities.DIAGNOSTICS;
+ }
+ } catch (GLib.Error error) {}
+
this.icon_infos = new ArrayList<IconInfo> ();
this.default_icons = new ArrayList<IconInfo> ();
diff --git a/src/librygel-renderer/rygel-media-renderer-plugin.vala
b/src/librygel-renderer/rygel-media-renderer-plugin.vala
index 6a64b9b..416e5ab 100644
--- a/src/librygel-renderer/rygel-media-renderer-plugin.vala
+++ b/src/librygel-renderer/rygel-media-renderer-plugin.vala
@@ -103,13 +103,6 @@ public class Rygel.MediaRendererPlugin : Rygel.Plugin {
RenderingControl.DESCRIPTION_PATH,
typeof (RenderingControl));
this.add_resource (resource);
-
- resource = new ResourceInfo (BasicManagement.UPNP_ID,
- BasicManagement.UPNP_TYPE,
- BasicManagement.DESCRIPTION_PATH,
- typeof (BasicManagement));
- this.add_resource (resource);
-
}
public virtual MediaPlayer? get_player () {
@@ -130,8 +123,7 @@ public class Rygel.MediaRendererPlugin : Rygel.Plugin {
throws Error {
string[] services = { AVTransport.UPNP_TYPE,
RenderingControl.UPNP_TYPE,
- ConnectionManager.UPNP_TYPE,
- BasicManagement.UPNP_TYPE };
+ ConnectionManager.UPNP_TYPE };
var v1_hacks = new V1Hacks (DMR, services);
v1_hacks.apply_on_device (device, description_path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]