Commit 0a312d63 authored by Jussi Kukkonen's avatar Jussi Kukkonen Committed by Jens Georg
Browse files

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
parent c28afb99
......@@ -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 */
......
......@@ -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;
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment