[rygel] core,gst-plugins: Special MediaRenderer plugin constructor



commit 4ebbbe95e563748bd07f3775da691fc67cec1fde
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sun Aug 1 02:28:55 2010 +0300

    core,gst-plugins: Special MediaRenderer plugin constructor
    
    Convenient constructor for MediaRenderer plugins.

 .../gst-renderer/rygel-gst-renderer-plugin.vala    |   30 ++++----------------
 src/rygel/rygel-plugin.vala                        |   30 ++++++++++++++++++++
 2 files changed, 36 insertions(+), 24 deletions(-)
---
diff --git a/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala b/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
index c1eddba..f970956 100644
--- a/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
+++ b/src/plugins/gst-renderer/rygel-gst-renderer-plugin.vala
@@ -26,30 +26,12 @@ using Rygel;
 using Gee;
 
 public void module_init (PluginLoader loader) {
-    string MEDIA_RENDERER_DESC_PATH = BuildConfig.DATA_DIR +
-                                      "/xml/MediaRenderer2.xml";
-
-    var plugin = new Plugin (MEDIA_RENDERER_DESC_PATH,
-                             "GstRenderer",
-                             _("GStreamer Renderer"));
-
-    var resource = new ResourceInfo (ConnectionManager.UPNP_ID,
-                                     ConnectionManager.UPNP_TYPE,
-                                     ConnectionManager.DESCRIPTION_PATH,
-                                     typeof (GstRenderer.ConnectionManager));
-    plugin.add_resource (resource);
-
-    resource = new ResourceInfo (Rygel.AVTransport.UPNP_ID,
-                                 Rygel.AVTransport.UPNP_TYPE,
-                                 Rygel.AVTransport.DESCRIPTION_PATH,
-                                 typeof (GstRenderer.AVTransport));
-    plugin.add_resource (resource);
-
-    resource = new ResourceInfo (RenderingControl.UPNP_ID,
-                                 RenderingControl.UPNP_TYPE,
-                                 RenderingControl.DESCRIPTION_PATH,
-                                 typeof (GstRenderer.RenderingControl));
-    plugin.add_resource (resource);
+    var plugin = new Plugin.MediaRenderer (
+                                        "GstRenderer",
+                                        _("GStreamer Renderer"),
+                                        typeof (GstRenderer.ConnectionManager),
+                                        typeof (GstRenderer.AVTransport),
+                                        typeof (GstRenderer.RenderingControl));
 
     loader.add_plugin (plugin);
 }
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index 864221f..72387ee 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -31,6 +31,9 @@ using GUPnP;
 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 +
@@ -121,6 +124,33 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
         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]