[rygel] core,plugins: Separate classes for different plugin types
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core,plugins: Separate classes for different plugin types
- Date: Sun, 1 Aug 2010 16:59:54 +0000 (UTC)
commit b8e82d9e957362df72a78955c740c70e03a753d7
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sun Aug 1 03:02:07 2010 +0300
core,plugins: Separate classes for different plugin types
Provide separate classes for MediaServer and MediaRenderer plugins rather
than special constructors.
src/plugins/external/rygel-external-plugin.vala | 10 ++--
.../gst-launch/rygel-gst-launch-plugin.vala | 6 +-
.../gst-renderer/rygel-gst-renderer-plugin.vala | 2 +-
.../media-export/rygel-media-export-plugin.vala | 6 +-
src/plugins/mediathek/rygel-mediathek-plugin.vala | 6 +-
src/plugins/test/rygel-test-plugin.vala | 6 +-
src/plugins/tracker/rygel-tracker-plugin.vala | 12 ++--
src/rygel/Makefile.am | 2 +
src/rygel/rygel-media-renderer-plugin.vala | 56 ++++++++++++++++++
src/rygel/rygel-media-server-plugin.vala | 56 ++++++++++++++++++
src/rygel/rygel-plugin.vala | 61 --------------------
11 files changed, 138 insertions(+), 85 deletions(-)
---
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index 1c4a2ab..6078fb0 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -24,7 +24,7 @@
using FreeDesktop;
-public class Rygel.External.Plugin : Rygel.Plugin {
+public class Rygel.External.Plugin : Rygel.MediaServerPlugin {
public string service_name;
public string root_object;
@@ -38,10 +38,10 @@ public class Rygel.External.Plugin : Rygel.Plugin {
bool searchable,
string root_object,
IconInfo? icon) {
- base.MediaServer (service_name,
- title,
- typeof (ContentDir),
- "Rygel External " + title);
+ base (service_name,
+ title,
+ typeof (ContentDir),
+ "Rygel External " + title);
this.service_name = service_name;
this.child_count = child_count;
diff --git a/src/plugins/gst-launch/rygel-gst-launch-plugin.vala b/src/plugins/gst-launch/rygel-gst-launch-plugin.vala
index 335d284..471653a 100644
--- a/src/plugins/gst-launch/rygel-gst-launch-plugin.vala
+++ b/src/plugins/gst-launch/rygel-gst-launch-plugin.vala
@@ -24,9 +24,9 @@ using Rygel;
using Gee;
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaServer ("GstLaunch",
- "Gst Launch",
- typeof (GstLaunch.ContentDir));
+ var plugin = new MediaServerPlugin ("GstLaunch",
+ "Gst Launch",
+ typeof (GstLaunch.ContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala b/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
index f970956..6ab913c 100644
--- a/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
+++ b/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
@@ -26,7 +26,7 @@ using Rygel;
using Gee;
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaRenderer (
+ var plugin = new MediaRendererPlugin (
"GstRenderer",
_("GStreamer Renderer"),
typeof (GstRenderer.ConnectionManager),
diff --git a/src/plugins/media-export/rygel-media-export-plugin.vala b/src/plugins/media-export/rygel-media-export-plugin.vala
index 3432a54..26ca5ea 100644
--- a/src/plugins/media-export/rygel-media-export-plugin.vala
+++ b/src/plugins/media-export/rygel-media-export-plugin.vala
@@ -28,9 +28,9 @@ using GLib;
*
*/
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaServer ("MediaExport",
- _("@REALNAME@'s media"),
- typeof (Rygel.MediaExport.ContentDir));
+ var plugin = new MediaServerPlugin ("MediaExport",
+ _("@REALNAME@'s media"),
+ typeof (Rygel.MediaExport.ContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/mediathek/rygel-mediathek-plugin.vala b/src/plugins/mediathek/rygel-mediathek-plugin.vala
index 2c44eb8..4b9c22e 100644
--- a/src/plugins/mediathek/rygel-mediathek-plugin.vala
+++ b/src/plugins/mediathek/rygel-mediathek-plugin.vala
@@ -24,9 +24,9 @@ using Rygel;
using GUPnP;
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaServer ("ZDFMediathek",
- "ZDF Mediathek",
- typeof (Mediathek.ContentDir));
+ var plugin = new MediaServerPlugin ("ZDFMediathek",
+ "ZDF Mediathek",
+ typeof (Mediathek.ContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/test/rygel-test-plugin.vala b/src/plugins/test/rygel-test-plugin.vala
index 12e8a41..9a02d07 100644
--- a/src/plugins/test/rygel-test-plugin.vala
+++ b/src/plugins/test/rygel-test-plugin.vala
@@ -26,9 +26,9 @@ using Rygel;
using Gee;
public void module_init (PluginLoader loader) {
- var plugin = new Plugin.MediaServer ("Test",
- "Test Streams",
- typeof (Rygel.Test.ContentDir));
+ var plugin = new MediaServerPlugin("Test",
+ "Test Streams",
+ typeof (Rygel.Test.ContentDir));
loader.add_plugin (plugin);
}
diff --git a/src/plugins/tracker/rygel-tracker-plugin.vala b/src/plugins/tracker/rygel-tracker-plugin.vala
index 6b89c14..d65aa47 100644
--- a/src/plugins/tracker/rygel-tracker-plugin.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin.vala
@@ -22,17 +22,17 @@
using Gee;
-public class Rygel.Tracker.Plugin : Rygel.Plugin {
+public class Rygel.Tracker.Plugin : Rygel.MediaServerPlugin {
// class-wide constants
private const string ICON = BuildConfig.DATA_DIR + // Path
"/icons/hicolor/48x48/apps/tracker.png";
public Plugin () {
- base.MediaServer ("Tracker",
- // @REALNAME@ is substituted for user's real name
- // and it doesn't need translation.
- _("@REALNAME@'s media"),
- typeof (Tracker.ContentDirectory));
+ base ("Tracker",
+ // @REALNAME@ is substituted for user's real name
+ // and it doesn't need translation.
+ _("@REALNAME@'s media"),
+ typeof (Tracker.ContentDirectory));
var icon_info = new IconInfo ("image/png");
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index ddaa44c..55d1da0 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -72,6 +72,8 @@ VAPI_SOURCE_FILES = rygel-configuration.vala \
rygel-resource-info.vala \
rygel-icon-info.vala \
rygel-plugin.vala \
+ rygel-media-server-plugin.vala \
+ rygel-media-renderer-plugin.vala \
rygel-plugin-loader.vala \
rygel-media-object.vala \
rygel-media-container.vala \
diff --git a/src/rygel/rygel-media-renderer-plugin.vala b/src/rygel/rygel-media-renderer-plugin.vala
new file mode 100644
index 0000000..f1ed39d
--- /dev/null
+++ b/src/rygel/rygel-media-renderer-plugin.vala
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2008,2010 Nokia Corporation.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+public class Rygel.MediaRendererPlugin : Rygel.Plugin {
+ private static const string MEDIA_RENDERER_DESC_PATH =
+ BuildConfig.DATA_DIR +
+ "/xml/MediaRenderer2.xml";
+
+ public MediaRendererPlugin (string name,
+ string? title,
+ Type connection_manager_type,
+ Type av_transport_type,
+ Type rendering_control_type,
+ string? description = null) {
+ base (MEDIA_RENDERER_DESC_PATH, name, title, description);
+
+ var resource = new ResourceInfo (ConnectionManager.UPNP_ID,
+ ConnectionManager.UPNP_TYPE,
+ ConnectionManager.DESCRIPTION_PATH,
+ connection_manager_type);
+ this.add_resource (resource);
+
+ resource = new ResourceInfo (Rygel.AVTransport.UPNP_ID,
+ Rygel.AVTransport.UPNP_TYPE,
+ Rygel.AVTransport.DESCRIPTION_PATH,
+ av_transport_type);
+ this.add_resource (resource);
+
+ resource = new ResourceInfo (RenderingControl.UPNP_ID,
+ RenderingControl.UPNP_TYPE,
+ RenderingControl.DESCRIPTION_PATH,
+ rendering_control_type);
+ this.add_resource (resource);
+ }
+}
+
diff --git a/src/rygel/rygel-media-server-plugin.vala b/src/rygel/rygel-media-server-plugin.vala
new file mode 100644
index 0000000..73aa103
--- /dev/null
+++ b/src/rygel/rygel-media-server-plugin.vala
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2008,2010 Nokia Corporation.
+ *
+ * Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ * <zeeshan ali nokia com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+public class Rygel.MediaServerPlugin : Rygel.Plugin {
+ private static const string MEDIA_SERVER_DESC_PATH =
+ BuildConfig.DATA_DIR + "/xml/MediaServer2.xml";
+
+ public MediaServerPlugin (string name,
+ string? title,
+ Type content_dir_type,
+ string? description = null) {
+ base (MEDIA_SERVER_DESC_PATH, name, title, description);
+
+ // 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 (SourceConnectionManager));
+
+ this.add_resource (resource_info);
+ resource_info = new ResourceInfo (
+ MediaReceiverRegistrar.UPNP_ID,
+ MediaReceiverRegistrar.UPNP_TYPE,
+ MediaReceiverRegistrar.DESCRIPTION_PATH,
+ typeof (MediaReceiverRegistrar));
+ this.add_resource (resource_info);
+ }
+}
+
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index 72387ee..98e10a8 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -29,12 +29,6 @@ using GUPnP;
* class or a subclass.
*/
public class Rygel.Plugin : GUPnP.ResourceFactory {
- private static const string MEDIA_SERVER_DESC_PATH =
- BuildConfig.DATA_DIR + "/xml/MediaServer2.xml";
- private static const string MEDIA_RENDERER_DESC_PATH =
- BuildConfig.DATA_DIR +
- "/xml/MediaRenderer2.xml";
-
private static const string ICON_BIG = "file://" +
BuildConfig.BIG_ICON_DIR +
"/rygel.png";
@@ -96,61 +90,6 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
this.default_icons.add (icon);
}
- public Plugin.MediaServer (string name,
- string? title,
- Type content_dir_type,
- string? description = null) {
- this (MEDIA_SERVER_DESC_PATH, name, title, description);
-
- // 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 (SourceConnectionManager));
-
- this.add_resource (resource_info);
- resource_info = new ResourceInfo (
- MediaReceiverRegistrar.UPNP_ID,
- MediaReceiverRegistrar.UPNP_TYPE,
- MediaReceiverRegistrar.DESCRIPTION_PATH,
- typeof (MediaReceiverRegistrar));
- this.add_resource (resource_info);
- }
-
- public Plugin.MediaRenderer (string name,
- string? title,
- Type connection_manager_type,
- Type av_transport_type,
- Type rendering_control_type,
- string? description = null) {
- this (MEDIA_RENDERER_DESC_PATH, name, title, description);
-
- var resource = new ResourceInfo (ConnectionManager.UPNP_ID,
- ConnectionManager.UPNP_TYPE,
- ConnectionManager.DESCRIPTION_PATH,
- connection_manager_type);
- this.add_resource (resource);
-
- resource = new ResourceInfo (Rygel.AVTransport.UPNP_ID,
- Rygel.AVTransport.UPNP_TYPE,
- Rygel.AVTransport.DESCRIPTION_PATH,
- av_transport_type);
- this.add_resource (resource);
-
- resource = new ResourceInfo (RenderingControl.UPNP_ID,
- RenderingControl.UPNP_TYPE,
- RenderingControl.DESCRIPTION_PATH,
- rendering_control_type);
- this.add_resource (resource);
- }
-
public void add_resource (ResourceInfo resource_info) {
this.resource_infos.add (resource_info);
this.register_resource_type (resource_info.upnp_type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]