* 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.
This commit is contained in:
Thomas Vander Stichele
2011-05-24 17:00:04 +00:00
parent 9a6af593f8
commit 3fccbac367
2 changed files with 20 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2011-05-24 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <thomas at apestaart dot org>
* morituri/rip/Makefile.am:

View File

@@ -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)