[rygel] core: Make sure HTTPServer gets created successfully



commit 3a0aded2fec8a7c48cc9f1fbcef61b6db9606836
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Aug 11 17:08:48 2010 +0300

    core: Make sure HTTPServer gets created successfully

 src/rygel/rygel-content-directory.vala |   10 +---------
 src/rygel/rygel-http-server.vala       |    2 +-
 src/rygel/rygel-transcode-manager.vala |   31 +++++++++++++++++++++++++------
 3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala
index ffbcbb5..06acf04 100644
--- a/src/rygel/rygel-content-directory.vala
+++ b/src/rygel/rygel-content-directory.vala
@@ -71,15 +71,7 @@ internal class Rygel.ContentDirectory: Service {
         var plugin = this.root_device.resource_factory as MediaServerPlugin;
 
         this.root_container = plugin.get_root_container (this.context);
-
-        try {
-            this.http_server = new HTTPServer (this, plugin.name);
-        } catch (GLib.Error err) {
-            critical (_("Failed to create HTTP server for %s: %s"),
-                      this.get_type ().name (),
-                      err.message);
-            return;
-        }
+        this.http_server = new HTTPServer (this, plugin.name);
 
         this.updated_containers =  new ArrayList<MediaContainer> ();
         this.active_imports = new ArrayList<ImportResource> ();
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index 92e3853..db84854 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -37,7 +37,7 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
     public Cancellable cancellable { get; set; }
 
     public HTTPServer (ContentDirectory content_dir,
-                       string           name) throws GLib.Error {
+                       string           name) {
         base ();
 
         this.root_container = content_dir.root_container;
diff --git a/src/rygel/rygel-transcode-manager.vala b/src/rygel/rygel-transcode-manager.vala
index 709f93d..4d7a9be 100644
--- a/src/rygel/rygel-transcode-manager.vala
+++ b/src/rygel/rygel-transcode-manager.vala
@@ -33,24 +33,43 @@ using Gst;
 internal abstract class Rygel.TranscodeManager : GLib.Object {
     private ArrayList<Transcoder> transcoders;
 
-    public TranscodeManager () throws GLib.Error {
+    public TranscodeManager () {
         transcoders = new ArrayList<Transcoder> ();
 
         var config = MetaConfig.get_default ();
 
-        if (config.get_transcoding ()) {
-            if (config.get_lpcm_transcoder ()) {
+        var transcoding = true;
+        var lpcm_transcoder = true;
+        var mp3_transcoder = true;
+        var mp2ts_transcoder = true;
+        var wmv_transcoder = true;
+
+        try {
+            transcoding = config.get_transcoding ();
+
+            if (transcoding) {
+                lpcm_transcoder = config.get_lpcm_transcoder ();
+                mp3_transcoder = config.get_mp3_transcoder ();
+                mp2ts_transcoder = config.get_mp2ts_transcoder ();
+                wmv_transcoder = config.get_wmv_transcoder ();
+            }
+        } catch (Error err) {}
+
+        if (transcoding) {
+            if (lpcm_transcoder) {
                 transcoders.add (new L16Transcoder (Endianness.BIG));
             }
-            if (config.get_mp3_transcoder ()) {
+
+            if (mp3_transcoder) {
                 transcoders.add (new MP3Transcoder (MP3Layer.THREE));
             }
-            if (config.get_mp2ts_transcoder ()) {
+
+            if (mp2ts_transcoder) {
                 transcoders.add (new MP2TSTranscoder(MP2TSProfile.SD));
                 transcoders.add (new MP2TSTranscoder(MP2TSProfile.HD));
             }
 
-            if (config.get_wmv_transcoder ()) {
+            if (wmv_transcoder) {
                 transcoders.add (new WMVTranscoder ());
             }
         }



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