[pitivi] timeline: Fix rate calculation
- From: Mathieu Duponchelle <mathieudu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Fix rate calculation
- Date: Wed, 25 Aug 2021 12:28:29 +0000 (UTC)
commit 532111c28d62f9ca22ae3f9099ddd7305f415218
Author: Piotrek BrzeziĆski <thewildtree outlook com>
Date: Fri Jul 9 17:15:35 2021 +0200
timeline: Fix rate calculation
Note: this only fixes waveform display at 1x rate, the rest of the code
needs further adjustments to properly support time effects.
pitivi/timeline/previewers.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index f2652a141..bb27f817c 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -1282,14 +1282,17 @@ class AudioPreviewer(Gtk.Layout, Previewer, Zoomable, Loggable):
# calculated in the context of the asset duration.
rect = Gdk.cairo_get_clip_rectangle(context)[1]
clip = self.ges_elem.get_parent()
+ start = self.ges_elem.props.start
inpoint = self.ges_elem.props.in_point
duration = self.ges_elem.props.duration
max_duration = self.ges_elem.get_asset().get_filesource_asset().get_duration()
start_ns = min(max(0, self.pixel_to_ns(rect.x) + inpoint), max_duration)
end_ns = min(max(0, self.pixel_to_ns(rect.x + rect.width) + inpoint), max_duration)
+
# Get the overall rate of the clip in the current area the clip is used
- # FIXME: Smarted computation will be needed when we make the rate keyframeable
- rate = (duration - inpoint) / clip.get_timeline_time_from_internal_time(self.ges_elem, duration)
+ internal_end = clip.get_internal_time_from_timeline_time(self.ges_elem, start + duration)
+ internal_duration = internal_end - inpoint
+ rate = internal_duration / duration
zoom = self.get_current_zoom_level()
height = self.get_allocation().height - 2 * CLIP_BORDER_WIDTH
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]