rygel r453 - in trunk/src: plugins/dvb plugins/test plugins/tracker rygel



Author: zeeshanak
Date: Sun Jan 18 19:28:04 2009
New Revision: 453
URL: http://svn.gnome.org/viewvc/rygel?rev=453&view=rev

Log:
Merge branch 'leak-tests' into streamer-renaming

Modified:
   trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
   trunk/src/plugins/test/rygel-test-content-dir.vala
   trunk/src/plugins/tracker/rygel-media-tracker.vala
   trunk/src/rygel/rygel-content-directory.vala
   trunk/src/rygel/rygel-http-server.vala
   trunk/src/rygel/rygel-main.vala
   trunk/src/rygel/rygel-media-server.vala

Modified: trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-content-dir.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-content-dir.vala	Sun Jan 18 19:28:04 2009
@@ -27,6 +27,7 @@
 using Rygel;
 using GUPnP;
 using DBus;
+using Gee;
 
 /**
  * Implementation of DVB ContentDirectory service.
@@ -40,7 +41,7 @@
 
     public dynamic DBus.Object manager;
 
-    private List<DVBChannelGroup> groups;
+    private ArrayList<DVBChannelGroup> groups;
 
     // Pubic methods
     public override void constructed () {
@@ -69,9 +70,7 @@
             return;
         }
 
-        HTTPServer http_server = new HTTPServer (this.context, "DVB");
-
-        this.groups = new List<DVBChannelGroup> ();
+        this.groups = new ArrayList<DVBChannelGroup> ();
         foreach (uint group_id in dev_groups) {
             string channel_list_path = null;
             string group_name =  null;
@@ -93,11 +92,11 @@
                                          DVBContentDir.CHANNEL_LIST_IFACE);
 
             // Create ChannelGroup for each registered device group
-            this.groups.append (new DVBChannelGroup (group_id,
-                                                     group_name,
-                                                     this.root_container.id,
-                                                     channel_list,
-                                                     http_server));
+            this.groups.add (new DVBChannelGroup (group_id,
+                                                  group_name,
+                                                  this.root_container.id,
+                                                  channel_list,
+                                                  this.http_server));
         }
     }
 
@@ -149,7 +148,7 @@
         foreach (DVBChannelGroup group in this.groups)
             group.serialize (didl_writer);
 
-        args.total_matches = args.number_returned = this.groups.length ();
+        args.total_matches = args.number_returned = this.groups.size;
         args.update_id = uint32.MAX;
     }
 

Modified: trunk/src/plugins/test/rygel-test-content-dir.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-content-dir.vala	(original)
+++ trunk/src/plugins/test/rygel-test-content-dir.vala	Sun Jan 18 19:28:04 2009
@@ -27,37 +27,34 @@
 using Rygel;
 using GUPnP;
 using Gst;
+using Gee;
 
 /**
  * Implementation of ContentDirectory service, meant for testing purposes only.
  */
 public class Rygel.TestContentDir : ContentDirectory {
-    private List<MediaItem> items;
-
-    private HTTPServer http_server;
+    private ArrayList<MediaItem> items;
 
     /* Pubic methods */
     public override void constructed () {
         // Chain-up to base first
         base.constructed ();
 
-        this.http_server = new HTTPServer (context, "RygelTest");
-
         this.http_server.item_requested += this.on_item_requested;
         this.http_server.need_stream_source += this.on_need_stream_source;
 
-        this.items = new List<MediaItem> ();
-        this.items.append (new TestAudioItem ("sinewave",
-                                              this.root_container.id,
-                                              "Sine Wave",
-                                              this.http_server));
-        this.items.append (new TestVideoItem ("smtpe",
-                                              this.root_container.id,
-                                              "SMTPE",
-                                              this.http_server));
+        this.items = new ArrayList<MediaItem> ();
+        this.items.add (new TestAudioItem ("sinewave",
+                                           this.root_container.id,
+                                           "Sine Wave",
+                                           this.http_server));
+        this.items.add (new TestVideoItem ("smtpe",
+                                           this.root_container.id,
+                                           "SMTPE",
+                                           this.http_server));
 
         // Now we know how many top-level items we have
-        this.root_container.child_count = this.items.length ();
+        this.root_container.child_count = this.items.size;
     }
 
     public override void add_metadata (DIDLLiteWriter didl_writer,
@@ -77,7 +74,7 @@
         foreach (MediaItem item in this.items)
             item.serialize (didl_writer);
 
-        args.total_matches = args.number_returned = this.items.length ();
+        args.total_matches = args.number_returned = this.items.size;
         args.update_id = uint32.MAX;
     }
 

Modified: trunk/src/plugins/tracker/rygel-media-tracker.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-media-tracker.vala	(original)
+++ trunk/src/plugins/tracker/rygel-media-tracker.vala	Sun Jan 18 19:28:04 2009
@@ -26,6 +26,7 @@
 using Rygel;
 using GUPnP;
 using DBus;
+using Gee;
 
 /**
  * Implementation of Tracker-based ContentDirectory service.
@@ -34,45 +35,42 @@
     public static const int MAX_REQUESTED_COUNT = 128;
 
     /* FIXME: Make this a static if you know how to initize it */
-    private List<TrackerContainer> containers;
+    private ArrayList<TrackerContainer> containers;
 
     private SearchCriteriaParser search_parser;
-    private HTTPServer http_server;
 
     /* Pubic methods */
     public override void constructed () {
         // Chain-up to base first
         base.constructed ();
 
-        this.http_server = new HTTPServer (this.context, "Tracker");
-
         this.http_server.item_requested += on_item_requested;
 
-        this.containers = new List<TrackerContainer> ();
-        this.containers.append
+        this.containers = new ArrayList<TrackerContainer> ();
+        this.containers.add
                         (new TrackerContainer ("16",
                                                this.root_container.id,
                                                "All Images",
                                                "Images",
                                                MediaItem.IMAGE_CLASS,
-                                               http_server));
-        this.containers.append
+                                               this.http_server));
+        this.containers.add
                         (new TrackerContainer ("14",
                                                this.root_container.id,
                                                "All Music",
                                                "Music",
                                                MediaItem.MUSIC_CLASS,
-                                               http_server));
-        this.containers.append
+                                               this.http_server));
+        this.containers.add
                         (new TrackerContainer ("15",
                                                this.root_container.id,
                                                "All Videos",
                                                "Videos",
                                                MediaItem.VIDEO_CLASS,
-                                               http_server));
+                                               this.http_server));
 
         // Now we know how many top-level containers we have
-        this.root_container.child_count = this.containers.length ();
+        this.root_container.child_count = this.containers.size;
 
         this.search_parser = new SearchCriteriaParser ();
     }
@@ -138,7 +136,7 @@
         foreach (TrackerContainer container in this.containers)
             container.serialize (didl_writer);
 
-        args.total_matches = args.number_returned = this.containers.length ();
+        args.total_matches = args.number_returned = this.containers.size;
         args.update_id = uint32.MAX;
     }
 

Modified: trunk/src/rygel/rygel-content-directory.vala
==============================================================================
--- trunk/src/rygel/rygel-content-directory.vala	(original)
+++ trunk/src/rygel/rygel-content-directory.vala	Sun Jan 18 19:28:04 2009
@@ -65,6 +65,8 @@
     protected string search_caps;
     protected string sort_caps;
 
+    protected HTTPServer http_server;
+
     protected MediaContainer root_container;
 
     DIDLLiteWriter didl_writer;
@@ -90,6 +92,7 @@
     public override void constructed () {
         this.didl_writer = new DIDLLiteWriter ();
         this.setup_root_container ();
+        this.http_server = new HTTPServer (context, this.get_type ().name ());
 
         this.system_update_id = 0;
         this.feature_list =
@@ -126,6 +129,10 @@
         this.query_variable["FeatureList"] += this.query_feature_list;
     }
 
+    ~ContentDirectory () {
+        this.http_server.destroy ();
+    }
+
     /* Browse action implementation */
     protected virtual void browse_cb (ContentDirectory content_dir,
                                       ServiceAction    action) {

Modified: trunk/src/rygel/rygel-http-server.vala
==============================================================================
--- trunk/src/rygel/rygel-http-server.vala	(original)
+++ trunk/src/rygel/rygel-http-server.vala	Sun Jan 18 19:28:04 2009
@@ -27,6 +27,7 @@
 
 using Gst;
 using GUPnP;
+using Gee;
 
 public errordomain Rygel.HTTPServerError {
     UNACCEPTABLE = Soup.KnownStatusCode.NOT_ACCEPTABLE,
@@ -39,7 +40,7 @@
     private string path_root;
 
     private GUPnP.Context context;
-    private List<HTTPResponse> responses;
+    private ArrayList<HTTPResponse> responses;
 
     public signal void need_stream_source (MediaItem   item,
                                            out Element src);
@@ -48,13 +49,17 @@
 
     public HTTPServer (GUPnP.Context context, string name) {
         this.context = context;
-        this.responses = new List<StreamingResponse> ();
+        this.responses = new ArrayList<StreamingResponse> ();
 
         this.path_root = SERVER_PATH_PREFIX + "/" + name;
 
         context.server.add_handler (this.path_root, server_handler);
     }
 
+    public void destroy () {
+        context.server.remove_handler (this.path_root);
+    }
+
     private string create_uri_for_path (string path) {
         return "http://%s:%u%s%s".printf (this.context.host_ip,
                                           this.context.port,
@@ -78,7 +83,7 @@
         response.start ();
         response.ended += on_response_ended;
 
-        this.responses.append (response);
+        this.responses.add (response);
     }
 
     private void serve_uri (string       uri,
@@ -92,7 +97,7 @@
                                                 size);
         response.ended += on_response_ended;
 
-        this.responses.append (response);
+        this.responses.add (response);
     }
 
     private void on_response_ended (HTTPResponse response) {

Modified: trunk/src/rygel/rygel-main.vala
==============================================================================
--- trunk/src/rygel/rygel-main.vala	(original)
+++ trunk/src/rygel/rygel-main.vala	Sun Jan 18 19:28:04 2009
@@ -26,18 +26,19 @@
 using GUPnP;
 using GConf;
 using CStuff;
+using Gee;
 
 public class Rygel.Main : Object {
     private PluginLoader plugin_loader;
     private MediaServerFactory ms_factory;
-    private List<MediaServer> media_servers;
+    private ArrayList<MediaServer> media_servers;
 
     private MainLoop main_loop;
 
     private int exit_code;
 
     public Main () throws GLib.Error {
-        this.media_servers = new List<MediaServer> ();
+        this.media_servers = new ArrayList<MediaServer> ();
         this.plugin_loader = new PluginLoader ();
         this.ms_factory = new MediaServerFactory ();
         this.main_loop = new GLib.MainLoop (null, false);
@@ -74,7 +75,7 @@
             /* Make our device available */
             server.available = true;
 
-            media_servers.append (server);
+            media_servers.add (server);
         } catch (GLib.Error error) {
             warning ("Failed to create MediaServer for %s. Reason: %s\n",
                      plugin.name,

Modified: trunk/src/rygel/rygel-media-server.vala
==============================================================================
--- trunk/src/rygel/rygel-media-server.vala	(original)
+++ trunk/src/rygel/rygel-media-server.vala	Sun Jan 18 19:28:04 2009
@@ -26,12 +26,13 @@
 using GUPnP;
 using GConf;
 using CStuff;
+using Gee;
 
 /**
  * Represents a MediaServer device.
  */
 public class Rygel.MediaServer: RootDevice {
-    private List<ServiceInfo> services;   /* Services we implement */
+    private ArrayList<ServiceInfo> services;   /* Services we implement */
 
     public MediaServer (GUPnP.Context context,
                         Plugin        plugin,
@@ -45,7 +46,7 @@
         this.weak_ref ((WeakNotify) xml_doc_free, description_doc);
         this.relative_location = relative_location;
 
-        this.services = new List<ServiceInfo> ();
+        this.services = new ArrayList<ServiceInfo> ();
 
         // Now create the sevice objects
         foreach (ResourceInfo info in plugin.resource_infos) {
@@ -53,7 +54,7 @@
             if (info.type.is_a (typeof (Service))) {
                 var service = this.get_service (info.upnp_type);
 
-                this.services.append (service);
+                this.services.add (service);
             }
         }
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]