[pitivi: 15/28] track.py: use gap-finding code to handle multiple default sources basically brute-force approach: ke



commit a1d351158098a4e0b8eca77586ef7b2b4dda5207
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Thu Dec 3 19:42:26 2009 -0800

    track.py: use gap-finding code to handle multiple default sources
    basically brute-force approach: keep a list of sources added, remove previous
    sources, find new gap list, add new sources.

 pitivi/timeline/track.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index d953dc6..59bb7ec 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -29,6 +29,7 @@ from pitivi.stream import VideoStream, AudioStream
 from pitivi.factories.test import VideoTestSourceFactory, \
         AudioTestSourceFactory
 from pitivi.elements.mixer import SmartAdderBin, SmartVideomixerBin
+from pitivi.timeline.gap import Gap
 
 class TrackError(Exception):
     pass
@@ -689,6 +690,19 @@ class Track(Signallable):
 
         return track_object
 
+    def updateDefaultSources(self):
+        for object in self.default_sources:
+            self.composition.remove(object)
+        gaps = Gap.findAllGaps(self.track_objects)
+
+        self.default_sources = []
+        for gap in gaps:
+            source = self._getDefaultTrackObjectForStream(self.stream)
+            gnl_object = source.gnl_object
+            gnl_object.props.start = gap.start
+            gnl_object.props.duration = gap.initial_duration
+            self.composition.add(gnl_object)
+
     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]