[pitivi] pitivi: Update the video caps of the default_source when project setting change



commit 0cbfbf0d9fff7777ad599e1bf5763673afd3985d
Author: Thibault Saunier <thibault saunier collabora co uk>
Date:   Tue May 17 21:19:23 2011 -0400

    pitivi: Update the video caps of the default_source when project setting change
    
    This avoid lot of NNE introduced by different caps on VideoSources and VideoTestSource
    fixes #637522 and #613767

 pitivi/project.py           |    2 ++
 pitivi/timeline/timeline.py |   11 +++++++++++
 pitivi/timeline/track.py    |    4 ++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 670c466..ff2e4c5 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -194,6 +194,8 @@ class Project(Signallable, Loggable):
     def _projectSettingsChanged(self):
         settings = self.getSettings()
         self._videocaps = settings.getVideoCaps()
+        if self.timeline:
+            self.timeline.updateVideoCaps(self._videocaps)
 
         for fact in self.sources.getSources():
             fact.setFilterCaps(self._videocaps)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 1ee4aea..59af0a0 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1505,6 +1505,7 @@ class Timeline(Signallable, Loggable):
         self.dead_band = 10
         self.edges = TimelineEdges()
         self.property_trackers = {}
+        self._video_caps = None
 
     def addTrack(self, track):
         """
@@ -1518,6 +1519,7 @@ class Timeline(Signallable, Loggable):
             raise TimelineError("Provided track already controlled by the timeline")
 
         self.tracks.append(track)
+        self.updateVideoCaps()
         self._updateDuration()
         track.connect('start-changed', self._trackDurationChangedCb)
         track.connect('duration-changed', self._trackDurationChangedCb)
@@ -1559,6 +1561,15 @@ class Timeline(Signallable, Loggable):
             self.duration = duration
             self.emit('duration-changed', duration)
 
+    def updateVideoCaps (self, caps= None):
+        if caps:
+            self._video_caps = caps
+
+        if self._video_caps:
+            for track in self.tracks:
+                if type(track.stream) is VideoStream:
+                    track.updateCaps(self._video_caps)
+
     def addTimelineObject(self, obj):
         """
         Add the TimelineObject to the Timeline.
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index b1d4166..b6b0196 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -1046,6 +1046,10 @@ class Track(Signallable, Loggable):
 
         self.updateDefaultSourcesReal()
 
+    def updateCaps(self, caps):
+        self.stream.caps = caps
+        self.updateDefaultSources()
+
     def updateDefaultSourcesReal(self):
         update = self.composition.props.update
         self.composition.props.update = True



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