[rygel] core,plugins: Support all types of devices
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] core,plugins: Support all types of devices
- Date: Mon, 1 Jun 2009 09:52:38 -0400 (EDT)
commit 4cf95b8a619497c24735242e6046c1fcc881d1bc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Jun 1 15:00:09 2009 +0300
core,plugins: Support all types of devices
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.
---
src/plugins/dvb/rygel-dvb-plugin.vala | 2 +-
src/plugins/external/rygel-external-plugin.vala | 2 +-
src/plugins/folder/rygel-folder-plugin.vala | 2 +-
src/plugins/test/rygel-test-plugin.vala | 2 +-
src/plugins/tracker/rygel-tracker-plugin.vala | 2 +-
src/rygel/rygel-plugin.vala | 16 +++++++++++++++-
src/rygel/rygel-root-device-factory.vala | 3 +--
7 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/plugins/dvb/rygel-dvb-plugin.vala b/src/plugins/dvb/rygel-dvb-plugin.vala
index 86dc696..8b64ec6 100644
--- a/src/plugins/dvb/rygel-dvb-plugin.vala
+++ b/src/plugins/dvb/rygel-dvb-plugin.vala
@@ -30,7 +30,7 @@ using CStuff;
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,
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index 684f96e..ba54536 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -45,7 +45,7 @@ public class ExternalPlugin : Plugin {
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;
diff --git a/src/plugins/folder/rygel-folder-plugin.vala b/src/plugins/folder/rygel-folder-plugin.vala
index 1c48f4e..179d365 100644
--- a/src/plugins/folder/rygel-folder-plugin.vala
+++ b/src/plugins/folder/rygel-folder-plugin.vala
@@ -36,7 +36,7 @@ using GLib;
*/
[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,
diff --git a/src/plugins/test/rygel-test-plugin.vala b/src/plugins/test/rygel-test-plugin.vala
index 6b17f52..a338902 100644
--- a/src/plugins/test/rygel-test-plugin.vala
+++ b/src/plugins/test/rygel-test-plugin.vala
@@ -28,7 +28,7 @@ using CStuff;
[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,
diff --git a/src/plugins/tracker/rygel-tracker-plugin.vala b/src/plugins/tracker/rygel-tracker-plugin.vala
index 498bf4a..71b1ede 100644
--- a/src/plugins/tracker/rygel-tracker-plugin.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin.vala
@@ -30,7 +30,7 @@ public class TrackerPlugin : Plugin {
"/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,
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index ee6f41b..48d108b 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -23,22 +23,31 @@
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;
@@ -50,6 +59,11 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
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
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index 5898617..556b358 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -35,7 +35,6 @@ public errordomain RootDeviceFactoryError {
* 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;
@@ -81,7 +80,7 @@ public class Rygel.RootDeviceFactory {
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]