Felix Krull avatar Felix Krull committed 21935b9

Switch files more cleanly.

Comments (0)

Files changed (1)

         self.pipe = Gst.Pipeline()
         # elements
+        self.src = Gst.ElementFactory.make("filesrc", "src")
+        self.pipe.add(self.src)
         self.decbin = Gst.ElementFactory.make("decodebin", "decbin")
         self.conv = Gst.ElementFactory.make("audioconvert", "conv")
         self.rg.set_property("num-tracks", len(self.files))
         # link
+        self.src.link(self.decbin)
         Returns False if everything is done and the pipeline shouldn't be
         started again; True otherwise.
-        # only when there already is a source
-        if hasattr(self, "src"):
-        #    self.src.unlink(self.decbin)
-            self.pipe.remove(self.src)
-        #    self.src = None
-        # set the next file
+        # get the next file
             fname = self._files_iter.next()
         except StopIteration:
             self.emit("all-finished", self.track_data, self.album_data)
             return False
-        # make a new src element
-        self.src = Gst.ElementFactory.make("filesrc", "src")
+        # point the source to the new file
         self.src.set_property("location", to_utf8(fname))
         self._current_file = fname
-        self.pipe.add(self.src)
-        self.src.link(self.decbin)
         self.emit("track-started", to_utf8(fname))
         return True
         elif msg.type == Gst.MessageType.ERROR:
-            self.rg.set_locked_state(True)
             err, debug = msg.parse_error()
             self.emit("error", GSTError(err, debug))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.