[pitivi: 24/28] Fix some bugs introduced merging the default_sources branch.



commit a4e3ecf81b972471617834787cfdc8fee460c79d
Author: Alessandro Decina <alessandro d gmail com>
Date:   Mon Mar 1 00:35:59 2010 +0100

    Fix some bugs introduced merging the default_sources branch.
    
    Fix a deadlock calling gnlsource.set_state(gst.STATE_NULL) with composition
    updates turned off.
    
    Fix not-linked errors posted by removed default sources.

 pitivi/timeline/track.py |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index feb6d78..ccbdb17 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -699,8 +699,19 @@ class Track(Signallable):
 
         return track_object
 
-    def updateDefaultSources(self):
+    def _defaultSourceBlockedCb(self, pad, blocked):
+        pass
+
+    def _shutdownDefaultSource(self, source):
+        source = list(source.elements())[0]
+        for srcpad in source.src_pads():
+            srcpad = source.get_pad('src')
+            srcpad.set_blocked_async(True, self._defaultSourceBlockedCb)
+            srcpad.push_event(gst.event_new_flush_start())
+
+    def _updateDefaultSourcesUnchecked(self):
         for source in self.default_sources:
+            self._shutdownDefaultSource(source)
             self.composition.remove(source)
             source.set_state(gst.STATE_NULL)
         gaps = Gap.findAllGaps(self.track_objects)
@@ -714,6 +725,14 @@ class Track(Signallable):
             self.composition.add(gnl_object)
             self.default_sources.append(gnl_object)
 
+    def updateDefaultSources(self):
+        update = self.composition.props.update
+        self.composition.props.update = True
+        try:
+            self._updateDefaultSourcesUnchecked()
+        finally:
+            self.composition.props.update = update
+
     def _getMixerForStream(self, stream):
         if isinstance(stream, AudioStream):
             gnl = gst.element_factory_make("gnloperation", "top-level-audio-mixer")



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