Fixed issue #511.
This commit is contained in:
parent
591c116098
commit
34c35c8cec
@ -477,8 +477,8 @@ from playbin')
|
|||||||
_log.debug('thumbnail message: {0}'.format(message))
|
_log.debug('thumbnail message: {0}'.format(message))
|
||||||
|
|
||||||
if message.type == gst.MESSAGE_ERROR:
|
if message.type == gst.MESSAGE_ERROR:
|
||||||
_log.error('thumbnail error: {0}'.format(message))
|
_log.error('thumbnail error: {0}'.format(message.parse_error()))
|
||||||
gobject.idle_add(self.on_thumbnail_error)
|
gobject.idle_add(self.on_thumbnail_error, message)
|
||||||
|
|
||||||
if message.type == gst.MESSAGE_STATE_CHANGED:
|
if message.type == gst.MESSAGE_STATE_CHANGED:
|
||||||
prev_state, cur_state, pending_state = \
|
prev_state, cur_state, pending_state = \
|
||||||
@ -570,9 +570,17 @@ pending: {2}'.format(
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_thumbnail_error(self):
|
def on_thumbnail_error(self, message):
|
||||||
_log.error('Thumbnailing failed.')
|
_log.error('Thumbnailing failed.')
|
||||||
self.disconnect()
|
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):
|
def disconnect(self):
|
||||||
self.state = self.STATE_HALTING
|
self.state = self.STATE_HALTING
|
||||||
@ -1007,4 +1015,4 @@ if __name__ == '__main__':
|
|||||||
print('I\'m a callback!')
|
print('I\'m a callback!')
|
||||||
transcoder.transcode(*args, progress_callback=cb)
|
transcoder.transcode(*args, progress_callback=cb)
|
||||||
elif options.action == 'discover':
|
elif options.action == 'discover':
|
||||||
print transcoder.discover(*args).__dict__
|
print transcoder.discover(*args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user