コード例 #1
0
 def __reversed__(self):
     with self.stream.lock:
         pos = self.stream._length
         for item, frame in super(PiCameraDequeHack, self.stream._data).__reversed__():
             if frame:
                 frame = PiVideoFrame(
                     index=frame.index,
                     frame_type=frame.frame_type,
                     frame_size=frame.frame_size,
                     video_size=pos,
                     split_size=pos,
                     timestamp=frame.timestamp,
                     complete=frame.complete,
                     )
                 if pos - frame.frame_size >= 0:
                     yield frame
             pos -= len(item)
コード例 #2
0
ファイル: streams.py プロジェクト: mozys/picamera
 def __reversed__(self):
     with self.stream().lock:
         pos = self.stream()._length
         for item, frame in self.stream()._data.iter_both(True):
             if frame:
                 frame = PiVideoFrame(
                     index=frame.index,
                     frame_type=frame.frame_type,
                     frame_size=frame.frame_size,
                     video_size=pos,
                     split_size=pos,
                     timestamp=frame.timestamp,
                     complete=frame.complete,
                 )
                 if pos - frame.frame_size >= 0:
                     yield frame
             pos -= len(item)
コード例 #3
0
 def __iter__(self):
     with self.stream.lock:
         pos = 0
         for item, frame in super(PiCameraDequeHack, self.stream._data).__iter__():
             pos += len(item)
             if frame:
                 # Rewrite the video_size and split_size attributes according
                 # to the current position of the chunk
                 frame = PiVideoFrame(
                     index=frame.index,
                     frame_type=frame.frame_type,
                     frame_size=frame.frame_size,
                     video_size=pos,
                     split_size=pos,
                     timestamp=frame.timestamp,
                     complete=frame.complete,
                     )
                 # Only yield the frame meta-data if the start of the frame
                 # still exists in the stream
                 if pos - frame.frame_size >= 0:
                     yield frame