Fixed issue #511.

This commit is contained in:
pythonsnake 2013-02-10 11:43:18 +01:00 committed by Joar Wandborg
parent 591c116098
commit 34c35c8cec

View File

@ -477,8 +477,8 @@ from playbin')
_log.debug('thumbnail message: {0}'.format(message))
if message.type == gst.MESSAGE_ERROR:
_log.error('thumbnail error: {0}'.format(message))
gobject.idle_add(self.on_thumbnail_error)
_log.error('thumbnail error: {0}'.format(message.parse_error()))
gobject.idle_add(self.on_thumbnail_error, message)
if message.type == gst.MESSAGE_STATE_CHANGED:
prev_state, cur_state, pending_state = \
@ -570,9 +570,17 @@ pending: {2}'.format(
return False
def on_thumbnail_error(self):
def on_thumbnail_error(self, message):
_log.error('Thumbnailing failed.')
self.disconnect()
if 'Error calculating the output scaled size - integer overflow' in message.parse_error()[1]:
_log.error('Retrying with manually set sizes...')
info = VideoTranscoder().discover(self.source_path)
h = info['videoheight']
w = info['videowidth']
ratio = 180 / int(w)
h = int(h * ratio)
self.__init__(self.source_path, self.dest_path, 180, h)
def disconnect(self):
self.state = self.STATE_HALTING
@ -1007,4 +1015,4 @@ if __name__ == '__main__':
print('I\'m a callback!')
transcoder.transcode(*args, progress_callback=cb)
elif options.action == 'discover':
print transcoder.discover(*args).__dict__
print transcoder.discover(*args)