media-export: Work-around bgo#680366
authorJens Georg <mail@jensge.org>
Sat, 21 Jul 2012 13:49:09 +0000 (15:49 +0200)
committerJens Georg <mail@jensge.org>
Sat, 21 Jul 2012 14:14:25 +0000 (16:14 +0200)
Conflicts:
src/plugins/media-export/rygel-media-export-harvesting-task.vala

src/plugins/media-export/rygel-media-export-harvester.vala
src/plugins/media-export/rygel-media-export-harvesting-task.vala
src/plugins/media-export/rygel-media-export-metadata-extractor.vala

index 1cf0dba..abf1e25 100644 (file)
@@ -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,
index 27a9dc1..dfa88b4 100644 (file)
@@ -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 ();
     }
 }
index c38525e..8c29212 100644 (file)
@@ -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",