[pitivi] prevewer.py: quantize thubnail timestamps to avoid unecessary redraws
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pitivi] prevewer.py: quantize thubnail timestamps to avoid unecessary redraws
- Date: Wed, 30 Sep 2009 09:24:57 +0000 (UTC)
commit 37bb927b11eaf66f4877a61e8c0dafd23a8beadb
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Thu Sep 24 14:11:09 2009 -0700
prevewer.py: quantize thubnail timestamps to avoid unecessary redraws
pitivi/ui/previewer.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/ui/previewer.py b/pitivi/ui/previewer.py
index 70337d3..ef5e39d 100644
--- a/pitivi/ui/previewer.py
+++ b/pitivi/ui/previewer.py
@@ -354,7 +354,11 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
def __init__(self, factory, stream_):
if stream_.dar and stream_.par:
self.aspect = float(stream_.dar)
+ rate = stream_.framerate
RandomAccessPreviewer.__init__(self, factory, stream_)
+ self.frame_duration = (gst.SECOND * rate.denom) / rate.num
+ self.tstep = max(self.frame_duration,
+ Zoomable.pixelToNsAt(self.twidth, Zoomable.max_zoom))
def _pipelineInit(self, factory, sbin):
csp = gst.element_factory_make("ffmpegcolorspace")
@@ -375,8 +379,8 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
self.videopipeline.set_state(gst.STATE_PAUSED)
def _segment_for_time(self, time):
- # for video thumbnails, the duration doesn't matter
- return time
+ # quantize thumbnail timestamps to maximum granularity
+ return time - (time % self.tstep)
def _thumbnailCb(self, unused_thsink, pixbuf, timestamp):
gobject.idle_add(self._finishThumbnail, pixbuf, timestamp)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]