[pitivi/ges: 91/287] Fix the seekRelative method and make use of it in the viewer
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 91/287] Fix the seekRelative method and make use of it in the viewer
- Date: Thu, 15 Mar 2012 16:33:28 +0000 (UTC)
commit 85e5a9d001ef57968bbbbe780a7d5821af2b8a07
Author: Thibault Saunier <thibault saunier collabora com>
Date: Wed Dec 14 10:37:28 2011 -0300
Fix the seekRelative method and make use of it in the viewer
pitivi/ui/viewer.py | 20 ++++++--------------
pitivi/utils.py | 4 ++--
2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/pitivi/ui/viewer.py b/pitivi/ui/viewer.py
index 97e060f..e3240d2 100644
--- a/pitivi/ui/viewer.py
+++ b/pitivi/ui/viewer.py
@@ -138,7 +138,7 @@ class PitiviViewer(gtk.VBox, Loggable):
self.pipeline.set_state(gst.STATE_NULL)
self.pipeline = pipeline
- if self.pipeline != None:
+ if self.pipeline:
bus = self.pipeline.get_bus()
bus.add_signal_watch()
bus.connect('message', self._busMessageCb)
@@ -433,18 +433,17 @@ class PitiviViewer(gtk.VBox, Loggable):
self.seekRelative(amount)
def seek(self, position, format=gst.FORMAT_TIME):
- try:
- self.seeker.seek(position, format)
- except:
- self.warning("seek failed")
+ self.seeker.seek(position, format)
def _newTime(self, value, frame=-1):
self.info("value:%s, frame:%d", gst.TIME_ARGS(value), frame)
self.current_time = value
self.current_frame = frame
self.timecode_entry.setWidgetValue(value, False)
+
position = self.pipeline.query_position(gst.FORMAT_TIME)[0]
self.app.gui.timeline.timelinePositionChanged(position)
+
if not self.moving_slider:
self.posadjust.set_value(float(value))
return False
@@ -587,22 +586,15 @@ class PitiviViewer(gtk.VBox, Loggable):
self.dock()
def seekRelative(self, time):
- try:
- seekvalue = max(0, min(position + time,
- self.getDuration()))
- self.seek(seekvalue)
- position = self.pipeline.query_position(gst.FORMAT_TIME)[0]
- self.pipeline.seekRelative(time)
- except:
- self.warning("seek failed")
+ self.seeker.seekRelative(time)
def _posCb(self):
try:
position = self.pipeline.query_position(gst.FORMAT_TIME)[0]
except:
return True
+
self._newTime(position)
- self.app.gui.timeline._canvas.timelinePositionChanged(position)
return True
def _currentStateCb(self, state):
diff --git a/pitivi/utils.py b/pitivi/utils.py
index 85675f8..8e67fca 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -358,8 +358,8 @@ class Seeker(Signallable):
except:
log.doLog(log.ERROR, None, "seeker", "Error while flushing", None)
- def _scheduleSeek(self, timeout, callback):
- return gobject.timeout_add(timeout, callback)
+ def _scheduleSeek(self, timeout, callback, relative=False):
+ return gobject.timeout_add(timeout, callback, relative)
def _seekTimeoutCb(self, relative=False):
self.pending_seek_id = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]