[rygel] server: Allow MediaServerPlugins to override search capabilities
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Allow MediaServerPlugins to override search capabilities
- Date: Sun, 24 Nov 2013 10:13:33 +0000 (UTC)
commit 0a312d63b65bb9cb637b9f054e7f48180676c225
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date: Tue Nov 19 12:06:50 2013 +0200
server: Allow MediaServerPlugins to override search capabilities
Use a virtual MediaServerPlugin.search_caps property instead of hard
coding the value in ContentDirectory. This way plugin implementations
can represent their search capabilities correctly.
The default value is still the same: no change needed in plugins.
https://bugzilla.gnome.org/show_bug.cgi?id=712660
src/librygel-server/rygel-content-directory.vala | 16 +++++--------
src/librygel-server/rygel-media-server-plugin.vala | 24 ++++++++++++++++++++
2 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/src/librygel-server/rygel-content-directory.vala
b/src/librygel-server/rygel-content-directory.vala
index cdc115a..e87f480 100644
--- a/src/librygel-server/rygel-content-directory.vala
+++ b/src/librygel-server/rygel-content-directory.vala
@@ -85,8 +85,6 @@ public class Rygel.ContentDirectory: Service {
private string service_reset_token;
- private string search_caps;
-
public override void constructed () {
base.constructed ();
@@ -118,12 +116,6 @@ public class Rygel.ContentDirectory: Service {
this.last_change = new LastChange ();
- this.search_caps = RelationalExpression.CAPS;
-
- if (PluginCapabilities.TRACK_CHANGES in plugin.capabilities) {
- this.search_caps += ",upnp:objectUpdateID,upnp:containerUpdateID";
- }
-
this.feature_list =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<Features xmlns=\"urn:schemas-upnp-org:av:avs\" " +
@@ -354,8 +346,10 @@ public class Rygel.ContentDirectory: Service {
return;
}
+ var plugin = this.root_device.resource_factory as MediaServerPlugin;
+
/* Set action return arguments */
- action.set ("SearchCaps", typeof (string), this.search_caps);
+ action.set ("SearchCaps", typeof (string), plugin.search_caps);
action.return ();
}
@@ -364,9 +358,11 @@ public class Rygel.ContentDirectory: Service {
private void query_search_capabilities (Service content_dir,
string variable,
ref GLib.Value value) {
+ var plugin = this.root_device.resource_factory as MediaServerPlugin;
+
/* Set action return arguments */
value.init (typeof (string));
- value.set_string (this.search_caps);
+ value.set_string (plugin.search_caps);
}
/* action GetSortCapabilities implementation */
diff --git a/src/librygel-server/rygel-media-server-plugin.vala
b/src/librygel-server/rygel-media-server-plugin.vala
index 3670bd6..fd0aa13 100644
--- a/src/librygel-server/rygel-media-server-plugin.vala
+++ b/src/librygel-server/rygel-media-server-plugin.vala
@@ -40,6 +40,30 @@ public abstract class Rygel.MediaServerPlugin : Rygel.Plugin {
public MediaContainer root_container { get; construct; }
+ private string _search_caps;
+
+ /**
+ * The SearchCapabilities this MediaServer plugin supports.
+ *
+ * Implementations can override this to match their capabilities. If they do,
+ * they should take care to include the change tracking capabilities
+ * (upnp:objectUpdateID, upnp:containerUpdateID) based on
+ * PluginCapabilities.TRACK_CHANGES.
+ */
+ public virtual string search_caps {
+ get {
+ if (this._search_caps == null) {
+ this._search_caps = RelationalExpression.CAPS;
+
+ if (PluginCapabilities.TRACK_CHANGES in this.capabilities) {
+ this._search_caps += ",upnp:objectUpdateID,upnp:containerUpdateID";
+ }
+ }
+
+ return this._search_caps;
+ }
+ }
+
private GLib.List<DLNAProfile> _upload_profiles;
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]