Пример #1
0
 def process_frame(frame):
     """Process a frame, holding onto one P-frame at a time, which is used to
     replace any I-frames encountered."""
     if buf[0] == None or not is_iframe(frame):
         buf[0] = frame
     else:
         frame = buf[0]
     return frame
Пример #2
0
 def process_frame(frame):
     """Process a frame, holding onto one P-frame at a time, which is used to
     replace any I-frames encountered."""
     if buf[0] == None or not is_iframe(frame):
         buf[0] = frame
     else:
         frame = buf[0]
     return frame
Пример #3
0
    def magnify_iter(stream):
        all_frames = iter(stream)
        yield next(all_frames)

        while True:
            frame = next(all_frames)
            if not is_iframe(frame):
                yield frame
                yield frame
Пример #4
0
def echo_stream(stream, midpoint=0.5):
    all_frames = list(stream)
    pframes = [f for f in all_frames if not is_iframe(f)]
    midpoint_idx = int(len(all_frames) * midpoint)

    frames = all_frames[:midpoint_idx]

    while len(frames) < len(all_frames):
        frames += pframes[:(len(all_frames) - len(frames))]

    return frames
Пример #5
0
def process_frame(frame, buf):
    '''Determines if given frame is a p-frame or an i-frame.  If it is an i-frame, the buffer stays the same and it returns the frame held in the buffer.  If it is a p-frame, it replaces the buffer with the frame, and returns the frame.'''
    #if there is no frame in buf or the frame is not i-frame
    if buf[0] == None or not is_iframe(frame):
        #then buf is the seen p-frame 
        buf[0] = frame 
    else:
        #if it IS an iframe then use the buf'ers pframe
        frame = buf[0]
        #return the frame
    return frame
Пример #6
0
def drift_stream(stream, midpoint=0.5):
    repeated_frame = None

    for idx, frame in enumerate(stream):
        if idx < len(stream) * midpoint:
            yield frame
        elif is_iframe(frame):
            pass
        else:
            if repeated_frame is None:
                repeated_frame = frame
            yield repeated_frame
Пример #7
0
 def process_frame(frame):
     """Process a frame, holding onto one P-frame at a time, which is used to
     replace any I-frames encountered."""
     #if there is no frame in buf or the frame is not i-frame
     if buf[0] == None or not is_iframe(frame):
         #then buf is the seen p-frame 
         buf[0] = frame 
     else:
         #if it IS an iframe then use the buf'ers pframe
         frame = buf[0]
     #return the frame
     return frame
Пример #8
0
 def process_frame(frame):
     """Process a frame, holding onto one P-frame at a time, which is used to
     replace any I-frames encountered."""
     #if there is no frame in buf or the frame is not i-frame
     if buf[0] == None or not is_iframe(frame):
         #then buf is the seen p-frame 
         buf[0] = frame 
     else:
         #if it IS an iframe then use the buf'ers pframe
         frame = buf[0]
     #return the frame
     return frame