[pitivi] TrackObject: Don't set unchanged properties on gstreamer objects.



commit ec1bb70415bec257585d39347f6a604734236714
Author: Edward Hervey <bilboed bilboed com>
Date:   Sat Jun 20 17:11:25 2009 +0200

    TrackObject: Don't set unchanged properties on gstreamer objects.
    
    Basically it's a bug at the GObject level. If you set a property to the
    same value it was previously set to... the 'notify' signal will be
    emitted...
    ... and since several things (like gnlcomposition and the timeline ui)
    are listening to those notify expecting changes we were just wasting
    cpu time for nothing.

 pitivi/timeline/track.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 3a4a5be..038af8e 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -330,7 +330,8 @@ class TrackObject(Signallable, Loggable):
             self.setObjectStart(position)
 
     def setObjectStart(self, position):
-        self.gnl_object.props.start = position
+        if self.gnl_object.props.start != position:
+            self.gnl_object.props.start = position
 
     start = property(_getStart, setStart)
 
@@ -347,7 +348,8 @@ class TrackObject(Signallable, Loggable):
             self.setObjectDuration(position)
 
     def setObjectDuration(self, position):
-        self.gnl_object.props.duration = position
+        if self.gnl_object.props.duration != position:
+            self.gnl_object.props.duration = position
 
     duration = property(_getDuration, setDuration)
 
@@ -361,7 +363,8 @@ class TrackObject(Signallable, Loggable):
             self.setObjectInPoint(position)
 
     def setObjectInPoint(self, value):
-        self.gnl_object.props.media_start = value
+        if self.gnl_object.props.media_sart != value:
+            self.gnl_object.props.media_start = value
 
     in_point = property(_getInPoint, setInPoint)
 
@@ -380,7 +383,8 @@ class TrackObject(Signallable, Loggable):
             self.setObjectMediaDuration(position)
 
     def setObjectMediaDuration(self, position):
-        self.gnl_object.props.media_duration = position
+        if self.gnl_object.props.media_duration != position:
+            self.gnl_object.props.media_duration = position
 
     media_duration = property(_getMediaDuration, setMediaDuration)
 
@@ -399,7 +403,8 @@ class TrackObject(Signallable, Loggable):
             self.setObjectPriority(priority)
 
     def setObjectPriority(self, priority):
-        self.gnl_object.props.priority = priority
+        if self.gnl_object.props.priority != priority:
+            self.gnl_object.props.priority = priority
 
     priority = property(_getPriority, setPriority)
 



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