[rygel] core,plugins: More ease for MediaServer implementors
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core,plugins: More ease for MediaServer implementors
- Date: Mon, 5 Oct 2009 12:48:20 +0000 (UTC)
commit c53c0a6d107eb07fb38498f9d0cb1034e4206e64
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Oct 4 20:30:21 2009 +0300
core,plugins: More ease for MediaServer implementors
src/plugins/external/rygel-external-plugin.vala | 10 +--------
src/plugins/gstlaunch/rygel-gstlaunch-plugin.vala | 11 ++-------
.../media-export/rygel-media-export-plugin.vala | 10 +-------
src/plugins/mediathek/rygel-mediathek-plugin.vala | 12 ++--------
src/plugins/test/rygel-test-plugin.vala | 13 ++---------
src/plugins/tracker/rygel-tracker-plugin.vala | 12 ++--------
src/rygel/rygel-plugin.vala | 21 +++++++++++++------
7 files changed, 29 insertions(+), 60 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index fb0169f..a518ef8 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -43,17 +43,9 @@ public class Rygel.ExternalPlugin : Rygel.Plugin {
props.Get (OBJECT_IFACE, "DisplayName", out value);
var title = value.get_string ();
- base.MediaServer (service_name, title);
+ base.MediaServer (service_name, title, typeof (ExternalContentDir));
this.service_name = service_name;
this.root_object = root_object;
-
- // We only implement a ContentDirectory service
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
- typeof (ExternalContentDir));
-
- this.add_resource (resource_info);
}
}
diff --git a/src/plugins/gstlaunch/rygel-gstlaunch-plugin.vala b/src/plugins/gstlaunch/rygel-gstlaunch-plugin.vala
index cd11805..c47494f 100644
--- a/src/plugins/gstlaunch/rygel-gstlaunch-plugin.vala
+++ b/src/plugins/gstlaunch/rygel-gstlaunch-plugin.vala
@@ -26,14 +26,9 @@ using CStuff;
[ModuleInit]
public void module_init (PluginLoader loader) {
- Plugin plugin = new Plugin.MediaServer ("GstLaunch", "Gst Launch");
-
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
- typeof (GstLaunchContentDir));
-
- plugin.add_resource (resource_info);
+ var plugin = new Plugin.MediaServer ("GstLaunch",
+ "Gst Launch",
+ typeof (GstLaunchContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/media-export/rygel-media-export-plugin.vala b/src/plugins/media-export/rygel-media-export-plugin.vala
index 6f6f380..e5b1db4 100644
--- a/src/plugins/media-export/rygel-media-export-plugin.vala
+++ b/src/plugins/media-export/rygel-media-export-plugin.vala
@@ -29,15 +29,9 @@ using GLib;
*/
[ModuleInit]
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaServer ("MediaExport", "@REALNAME@'s media");
-
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
+ var plugin = new Plugin.MediaServer ("MediaExport",
+ "@REALNAME@'s media",
typeof (Rygel.MediaExportContentDir));
-
- plugin.add_resource (resource_info);
-
loader.add_plugin (plugin);
}
diff --git a/src/plugins/mediathek/rygel-mediathek-plugin.vala b/src/plugins/mediathek/rygel-mediathek-plugin.vala
index 3f15a56..20c9e0b 100644
--- a/src/plugins/mediathek/rygel-mediathek-plugin.vala
+++ b/src/plugins/mediathek/rygel-mediathek-plugin.vala
@@ -25,15 +25,9 @@ using GUPnP;
[ModuleInit]
public void module_init (PluginLoader loader) {
- Plugin plugin = new Plugin.MediaServer ("ZDFMediathek", "ZDF Mediathek");
-
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
- typeof (Rygel.MediathekContentDir));
-
- plugin.add_resource (resource_info);
-
+ var plugin = new Plugin.MediaServer ("ZDFMediathek",
+ "ZDF Mediathek",
+ typeof (Rygel.MediathekContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/test/rygel-test-plugin.vala b/src/plugins/test/rygel-test-plugin.vala
index a0f93a7..df6949f 100644
--- a/src/plugins/test/rygel-test-plugin.vala
+++ b/src/plugins/test/rygel-test-plugin.vala
@@ -28,16 +28,9 @@ using CStuff;
[ModuleInit]
public void module_init (PluginLoader loader) {
- Plugin plugin = new Plugin.MediaServer ("Test", "Test Streams");
-
- // We only implement a ContentDirectory service
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
- typeof (TestContentDir));
-
- plugin.add_resource (resource_info);
-
+ var plugin = new Plugin.MediaServer ("Test",
+ "Test Streams",
+ typeof (TestContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/tracker/rygel-tracker-plugin.vala b/src/plugins/tracker/rygel-tracker-plugin.vala
index 7bf6214..0860bf8 100644
--- a/src/plugins/tracker/rygel-tracker-plugin.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin.vala
@@ -29,15 +29,9 @@ public class Rygel.TrackerPlugin : Rygel.Plugin {
"/icons/hicolor/48x48/apps/tracker.png";
public TrackerPlugin () {
- base.MediaServer ("Tracker", "@REALNAME@'s media");
-
- // We only implement a ContentDirectory service
- var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
- ContentDirectory.UPNP_TYPE,
- ContentDirectory.DESCRIPTION_PATH,
- typeof (MediaTracker));
-
- this.add_resource (resource_info);
+ base.MediaServer ("Tracker",
+ "@REALNAME@'s media",
+ typeof (MediaTracker));
var icon_info = new IconInfo ("image/png");
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index 7b5a588..a433e77 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -62,15 +62,22 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
}
public Plugin.MediaServer (string name,
- string? title) {
+ string? title,
+ Type content_dir_type) {
this (MEDIA_SERVER_DESC_PATH, name, title);
- /* Register Rygel.ConnectionManager */
- var resource_info = new ResourceInfo
- (ConnectionManager.UPNP_ID,
- ConnectionManager.UPNP_TYPE,
- ConnectionManager.DESCRIPTION_PATH,
- typeof (ConnectionManager));
+ // MediaServer implementations must implement ContentDirectory service
+ var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
+ ContentDirectory.UPNP_TYPE,
+ ContentDirectory.DESCRIPTION_PATH,
+ content_dir_type);
+ this.add_resource (resource_info);
+
+ // Register Rygel.ConnectionManager
+ resource_info = new ResourceInfo (ConnectionManager.UPNP_ID,
+ ConnectionManager.UPNP_TYPE,
+ ConnectionManager.DESCRIPTION_PATH,
+ typeof (ConnectionManager));
this.add_resource (resource_info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]