* morituri/image/image.py:

Fix AudioLengthTask for the case where we don't have the decoder,
	  by instead of doing get_state, waiting for an ASYNC_DONE or ERROR
	  message.  Properly raise a gst.GError in that case.
	* morituri/common/task.py:
	  Add some debug.
	* morituri/test/test_image_image.py:
	  After this fix, we now catch the TYPE_NOT_FOUND because of an
	  empty stream instead of the later gst.QueryError.
	* morituri/test/test_common_encode.py:
	  Let us know what it is if not a gst.QueryError.
This commit is contained in:
Thomas Vander Stichele
2010-04-05 23:20:40 +00:00
parent f1b97923d9
commit 8ea1dc025d
5 changed files with 46 additions and 5 deletions

View File

@@ -160,10 +160,19 @@ class AudioLengthTask(task.Task):
decodebin ! audio/x-raw-int !
fakesink name=sink''' %
common.quoteParse(self._path).encode('utf-8'))
self._bus = self._pipeline.get_bus()
self._bus.add_signal_watch()
self._bus.connect('message::error', self._error_cb)
self.debug('pausing')
self._pipeline.set_state(gst.STATE_PAUSED)
self._pipeline.get_state()
self.debug('paused')
self.debug('waiting for ASYNC_DONE or ERROR')
message = self._bus.timed_pop_filtered(gst.CLOCK_TIME_NONE,
gst.MESSAGE_ASYNC_DONE | gst.MESSAGE_ERROR)
if message.type == gst.MESSAGE_ERROR:
self._error_cb(self._bus, message)
self._pipeline.set_state(gst.STATE_NULL)
return
self.debug('query duration')
sink = self._pipeline.get_by_name('sink')
@@ -185,6 +194,18 @@ class AudioLengthTask(task.Task):
self.stop()
def _error_cb(self, bus, msg):
error, debug = msg.parse_error()
self.debug('Got GStreamer error: %r, debug: %r' % (
error.message, debug))
# give us an exception stack for debugging
try:
raise error
except:
pass
self.setException(error)
self.stop()
class ImageVerifyTask(task.MultiSeparateTask):
"""
I verify a disk image and get the necessary track lengths.