diff --git a/oxgst/video.py b/oxgst/video.py index 73483b4..67b9951 100644 --- a/oxgst/video.py +++ b/oxgst/video.py @@ -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