Update set_state to block for async state changes

This commit is contained in:
Thomas Adamcik 2010-08-14 18:53:31 +02:00
parent f5b6d0e994
commit bb73f8ae5f

View File

@ -170,6 +170,10 @@ class GStreamerProcess(BaseProcess):
"""
result = self.gst_pipeline.set_state(
getattr(gst, 'STATE_' + state_name))
# Block until state change has occured, required for at least the local
# backends seek functionality. (Optional solution is to block in set
# position to ensure that change occours)
self.gst_pipeline.get_state()
if result == gst.STATE_CHANGE_FAILURE:
logger.warning('Setting GStreamer state to %s: failed', state_name)
return False
@ -190,7 +194,6 @@ class GStreamerProcess(BaseProcess):
self.gst_volume.set_property('volume', gst_volume)
def set_position(self, position):
logger.info('Seeking to %s' % position)
self.gst_pipeline.seek_simple(gst.Format(gst.FORMAT_TIME),
gst.SEEK_FLAG_FLUSH, position * gst.MSECOND)
self.set_state('PLAYING')