[pitivi] Effects: Do not use the type of a subclass in TrackObject._updatePriority
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Effects: Do not use the type of a subclass in TrackObject._updatePriority
- Date: Sun, 22 May 2011 21:35:42 +0000 (UTC)
commit 8f220d38f7b28e28fa79ba8e17b995bd4baf2d30
Author: Thibault Saunier <thibault saunier collabora co uk>
Date: Tue May 17 16:45:07 2011 -0400
Effects: Do not use the type of a subclass in TrackObject._updatePriority
pitivi/timeline/track.py | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 340f7a2..b1d4166 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -535,19 +535,15 @@ class TrackObject(Signallable, Loggable):
if priority != self._public_priority:
self._updatePriority(priority)
- def _updatePriority(self, priority):
- # The priority of an effect should always be higher than the priority of
- # the track it is applied to. Those priority are affected when we add a
- # TrackObject to timeline
- if type(self) is TrackEffect:
- if self.stream_type is VideoStream:
- true_priority = 2 + self._stagger + (3 * priority)
- elif self.stream_type is AudioStream:
- true_priority = 2 + (2 * self._stagger) + (4 * priority)
- elif self.stream_type is VideoStream:
- true_priority = 3 + self._stagger + (3 * priority)
+ def _getTruePriority (self, priority):
+ """ calculate the priority the contained gnlobject should have """
+ if self.stream_type is VideoStream:
+ return 3 + self._stagger + (3 * priority)
elif self.stream_type is AudioStream:
- true_priority = 3 + (2 * self._stagger) + (4 * priority)
+ return 3 + (2 * self._stagger) + (4 * priority)
+
+ def _updatePriority(self, priority):
+ true_priority = self._getTruePriority(priority)
if self.gnl_object.props.priority != true_priority:
self.gnl_object.props.priority = true_priority
@@ -758,6 +754,17 @@ class TrackEffect(TrackObject):
return other
+ def _getTruePriority(self, priority):
+ """
+ The priority of an effect should always be higher than the priority
+ of the track it is applied to. Those priority are affected when we
+ add a TrackObject to timeline
+ """
+ if self.stream_type is VideoStream:
+ return 2 + self._stagger + (3 * priority)
+ elif self.stream_type is AudioStream:
+ return 2 + (2 * self._stagger) + (4 * priority)
+
def getElement(self):
"""
Permit to get the gst.Element inside the gnl_object that correspond
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]