[rygel] media-export: Work-around bgo#680366



commit 666a6d53faf2e0cdff77ae072d11cf48a3b9e1ba
Author: Jens Georg <mail jensge org>
Date:   Sat Jul 21 15:49:09 2012 +0200

    media-export: Work-around bgo#680366
    
    Conflicts:
    	src/plugins/media-export/rygel-media-export-harvesting-task.vala

 .../media-export/rygel-media-export-harvester.vala |    2 +-
 .../rygel-media-export-harvesting-task.vala        |    4 +-
 .../rygel-media-export-metadata-extractor.vala     |   21 ++++++++-----------
 3 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 1cf0dba..abf1e25 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -83,7 +83,7 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
         // Cancel a probably running harvester
         this.cancel (file);
 
-        var task = new HarvestingTask (this.extractor,
+        var task = new HarvestingTask (new MetadataExtractor (),
                                        this.monitor,
                                        this.file_filter,
                                        file,
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index 27a9dc1..dfa88b4 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -106,7 +106,7 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
                 if (info.get_file_type () != FileType.DIRECTORY) {
                     this.containers.push_tail (this.parent);
                 }
-                Idle.add (this.on_idle);
+                this.on_idle ();
             } else {
                 this.completed ();
             }
@@ -361,6 +361,6 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
             this.containers.pop_head ();
         }
 
-        Idle.add (this.on_idle);
+        this.on_idle ();
     }
 }
diff --git a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
index c38525e..8c29212 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -65,20 +65,9 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
             this.extract_metadata = true;
         }
 
-        if (this.extract_metadata) {
-            var gst_timeout = (ClockTime) (this.timeout * Gst.SECOND);
 
-            this.discoverer = new GUPnP.DLNADiscoverer (gst_timeout,
-                                                        true,
-                                                        true);
-            this.discoverer.done.connect (on_done);
-            this.discoverer.start ();
-        }
-    }
-
-    ~MetadataExtractor () {
         if (this.extract_metadata) {
-            this.discoverer.stop ();
+
         }
     }
 
@@ -86,6 +75,12 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         if (this.extract_metadata) {
             string uri = file.get_uri ();
             this.file_hash.set (uri, file);
+            var gst_timeout = (ClockTime) (this.timeout * Gst.SECOND);
+            this.discoverer = new GUPnP.DLNADiscoverer (gst_timeout,
+                                                        true,
+                                                        true);
+            this.discoverer.done.connect (on_done);
+            this.discoverer.start ();
             this.discoverer.discover_uri (uri);
         } else {
             this.extract_basic_information (file);
@@ -94,6 +89,8 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
 
     private void on_done (GUPnP.DLNAInformation dlna,
                           GLib.Error            err) {
+        this.discoverer.done.disconnect (on_done);
+        this.discoverer = null;
         var file = this.file_hash.get (dlna.info.get_uri ());
         if (file == null) {
             warning ("File %s already handled, ignoring event",



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