Skip to content

Instantly share code, notes, and snippets.

@joar
Created February 7, 2013 22:15
Show Gist options
  • Save joar/4734741 to your computer and use it in GitHub Desktop.
Save joar/4734741 to your computer and use it in GitHub Desktop.
*** ../transcoders.py 2013-02-07 22:02:20.000000000 +0100
--- mediagoblin/media_types/video/transcoders.py 2013-02-07 22:02:30.000000000 +0100
***************
*** 367,373 ****
self.width = width
self.height = height
- print self.height, self.width
self.position_callback = position_callback \
or self.wadsworth_position_callback
--- 367,372 ----
***************
*** 478,485 ****
_log.debug('thumbnail message: {0}'.format(message))
if message.type == gst.MESSAGE_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 = \
--- 477,484 ----
_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)
if message.type == gst.MESSAGE_STATE_CHANGED:
prev_state, cur_state, pending_state = \
***************
*** 571,587 ****
return False
! 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
--- 570,578 ----
return False
! def on_thumbnail_error(self):
_log.error('Thumbnailing failed.')
self.disconnect()
def disconnect(self):
self.state = self.STATE_HALTING
***************
*** 1003,1011 ****
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment