From 3fccbac3676e1dd7e99ce521124e66615b4e0809 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 24 May 2011 17:00:04 +0000 Subject: [PATCH] * morituri/common/encode.py: Query for duration and use it in level callback to set progress. Works around F-15 bug where encode progress is not being updated. --- ChangeLog | 6 ++++++ morituri/common/encode.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 982faaa..664f351 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-05-24 Thomas Vander Stichele + + * morituri/common/encode.py: + Query for duration and use it in level callback to set progress. + Works around F-15 bug where encode progress is not being updated. + 2011-05-24 Thomas Vander Stichele * morituri/rip/Makefile.am: diff --git a/morituri/common/encode.py b/morituri/common/encode.py index 17d0d0e..f32ccff 100644 --- a/morituri/common/encode.py +++ b/morituri/common/encode.py @@ -194,6 +194,7 @@ class EncodeTask(gstreamer.GstPipelineTask): self.stop() return + # wavparse 0.10.14 returns in bytes if qformat == self.gst.FORMAT_BYTES: self.debug('query returned in BYTES format') @@ -201,6 +202,13 @@ class EncodeTask(gstreamer.GstPipelineTask): self.debug('total length: %r', length) self._length = length + duration = None + try: + duration, qformat = identity.query_duration(self.gst.FORMAT_TIME) + except self.gst.QueryError, e: + self.debug('Could not query duration') + self._duration = duration + # set up level callbacks # FIXME: publicize bus and reuse it instead of regetting and adding ? bus = self.pipeline.get_bus() @@ -246,6 +254,12 @@ class EncodeTask(gstreamer.GstPipelineTask): self.log('higher peakdB found, now %r', self._peakdB) self._peakdB = p + # FIXME: works around a bug on F-15 where buffer probes don't seem + # to get triggered to update progress + if self._duration is not None: + self.schedule(0, self.setProgress, + float(s['stream-time'] + s['duration']) / self._duration) + def stopped(self): if self._peakdB is not None: self.debug('peakdB %r', self._peakdB)