Allow plugins to implement any kind of device rather than just MediaServer.
To not complicate the lives of plugin developers for this change, provide
a special constructor to easy create Plugin object for MediaServer.
public class DVBPlugin : Plugin {
public DVBPlugin () {
- base ("DVB", "Digital TV");
+ base.MediaServer ("DVB", "Digital TV");
// We only implement a ContentDirectory service
var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
props.Get (OBJECT_IFACE, "DisplayName", out value);
var title = value.get_string ();
- base (service_name, title);
+ base.MediaServer (service_name, title);
this.service_name = service_name;
this.root_object = root_object;
*/
[ModuleInit]
public void module_init (PluginLoader loader) {
- Plugin plugin = new Plugin ("Folder", "@REALNAME@'s media");
+ Plugin plugin = new Plugin.MediaServer ("Folder", "@REALNAME@'s media");
var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
ContentDirectory.UPNP_TYPE,
[ModuleInit]
public void module_init (PluginLoader loader) {
- Plugin plugin = new Plugin ("Test", "Test Streams");
+ Plugin plugin = new Plugin.MediaServer ("Test", "Test Streams");
// We only implement a ContentDirectory service
var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
"/icons/hicolor/48x48/apps/tracker.png";
public TrackerPlugin () {
- base ("Tracker", "@REALNAME@'s media");
+ base.MediaServer ("Tracker", "@REALNAME@'s media");
// We only implement a ContentDirectory service
var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
using Gee;
using GUPnP;
+using CStuff;
/**
* Represents a Rygel plugin. Plugins are supposed to provide an object of this
* class or a subclass.
*/
public class Rygel.Plugin : GUPnP.ResourceFactory {
+ private static const string MEDIA_SERVER_DESC_PATH = BuildConfig.DATA_DIR +
+ "/xml/description.xml";
+
public string name;
public string title;
+ // Path to description document
+ public string desc_path;
+
public bool available { get; set; }
public ArrayList<ResourceInfo> resource_infos;
public ArrayList<IconInfo> icon_infos;
- public Plugin (string name,
+ public Plugin (string desc_path,
+ string name,
string? title) {
+ this.desc_path = desc_path;
this.name = name;
this.title = title;
this.resource_infos = new ArrayList<ResourceInfo> ();
this.icon_infos = new ArrayList<IconInfo> ();
+ }
+
+ public Plugin.MediaServer (string name,
+ string? title) {
+ this (MEDIA_SERVER_DESC_PATH, name, title);
/* Register Rygel.ConnectionManager */
var resource_info = new ResourceInfo
* Root device for that.
*/
public class Rygel.RootDeviceFactory {
- public static const string DESC_DOC = "xml/description.xml";
public static const string DESC_PREFIX = "Rygel";
private Configuration config;
path = desc_path;
} else {
/* Use the template */
- path = Path.build_filename (BuildConfig.DATA_DIR, DESC_DOC);
+ path = plugin.desc_path;
}
Xml.Doc *doc = Xml.Parser.parse_file (path);