timeout if no frame is found
This commit is contained in:
parent
e7309c6d44
commit
3fdef4796f
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue