timeout if no frame is found

This commit is contained in:
j 2009-06-21 16:25:38 -04:00
parent e7309c6d44
commit 3fdef4796f
1 changed files with 10 additions and 0 deletions

View File

@ -125,8 +125,18 @@ class Video(gst.Pipeline):
def callback(frame, timestamp):
self._frames[timestamp] = frame
self.mainloop.quit()
self._quit = False
def quit():
if self._quit:
self.mainloop.quit()
return False
else:
self._quit = True
return True
gobject.timeout_add(1000, quit)
if self.getFrame(timestamp, callback):
self.mainloop.run()
frame = self._frames[timestamp]
del self._frames[timestamp]
return frame