[pitivi/ges: 241/287] mainwindow: Safely clamp the seeker to the end of the timeline
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 241/287] mainwindow: Safely clamp the seeker to the end of the timeline
- Date: Thu, 15 Mar 2012 16:46:06 +0000 (UTC)
commit 39b4d1a8e0b76cd2e79e8f4c2f38d2975218a79d
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Sat Jan 28 09:24:29 2012 +0100
mainwindow: Safely clamp the seeker to the end of the timeline
pitivi/mainwindow.py | 11 ++++++++++-
pitivi/viewer.py | 4 +---
2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 211f577..905a16e 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -1202,9 +1202,18 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.error("seek failed %s %s %s", gst.TIME_ARGS(position), format, e)
def _timelineSeekCb(self, ruler, position, format):
+ """
+ This is the main method used for seeking throughout the app.
+
+ We clamp the seeker position so that it cannot go past 0 or the
+ end of the timeline.
+ """
try:
+ # FIXME: ideally gstreamer should allow seeking to the exact end...
+ # but since it doesn't, we seek one nanosecond before the end.
+ end = self.app.current.timeline.props.duration - 1
# CLAMP (0, position, self.app.current.timeline.props.duration)
- position = sorted((0, position, self.app.current.timeline.props.duration))[1]
+ position = sorted((0, position, end))[1]
if not self.project_pipeline.seek(1.0, format, gst.SEEK_FLAG_FLUSH,
gst.SEEK_TYPE_SET, position, gst.SEEK_TYPE_NONE, -1):
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 4391811..8a07b16 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -419,9 +419,7 @@ class PitiviViewer(gtk.VBox, Loggable):
def _goToEndCb(self, unused_button):
try:
- # FIXME: ideally gstreamer should allow seeking to the exact end...
- # but since it doesn't, we seek one nanosecond before the end.
- end = self.app.current.timeline.props.duration - 1
+ end = self.app.current.timeline.props.duration
except:
self.warning("Couldn't get timeline duration")
try:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]