Process a received 'Consecutive Frame' frame
776993
def _recv_cf(self, data):
        """"""
        if self.rx_state != ISOTP_WAIT_DATA:
            return 0

        self.rx_timer.cancel()

        # CFs are never longer than the FF
        if len(data) > self.rx_ll_dl:
            return 1

        # CFs have usually the LL_DL length
        if len(data) < self.rx_ll_dl:
            # this is only allowed for the last CF
            if self.rx_len - self.rx_idx > self.rx_ll_dl:
                warning("Received a CF with insuffifient length")
                return 1

        if six.indexbytes(data, 0) & 0x0f != self.rx_sn:
            # Wrong sequence number
            warning("RX state was reset because wrong sequence number was "
                    "received")
            self.rx_state = ISOTP_IDLE
            return 1

        self.rx_sn = (self.rx_sn + 1) % 16
        self.rx_buf += data[1:]
        self.rx_idx = len(self.rx_buf)

        if self.rx_idx >= self.rx_len:
            # we are done
            self.rx_buf = self.rx_buf[0:self.rx_len]
            self.rx_state = ISOTP_IDLE
            self.rx_queue.put(self.rx_buf)
            for cb in self.rx_callbacks:
                cb(self.rx_buf)
            self.call_release()
            self.rx_buf = None
            return 0

        # perform blocksize handling, if enabled
        if self.rxfc_bs != 0:
            self.rx_bs += 1

            # check if we reached the end of the block
            if self.rx_bs >= self.rxfc_bs and not self.listen_mode:
                # send our FC frame
                load = self.ea_hdr
                load += struct.pack("BBB", N_PCI_FC, self.rxfc_bs,
                                    self.rxfc_stmin)
                self.can_send(load)

        # wait for another CF
        self.rx_timer.set_timeout(self.cf_timeout, self._rx_timer_handler)
        return 0
439297
def _frames(traceback):
    '''
    
    '''
    frame = traceback
    while frame.tb_next:
      frame = frame.tb_next
      yield frame.tb_frame
    return
700334
def data_received(self, data):
        """"""
        self.tokenizer.feed(data)
        while self.tokenizer.has_tokens():
            raw = self.tokenizer.get_next_token()
            frame = frame_from_raw(raw)
            if frame is not None:
                self.frame_received_cb(frame)
379114
def increment_frame(self):
        """"""
        if self.current_frame < len(self.images):
            self.current_frame += 1

            if self.current_frame >= len(self.images):
                # Wrap back to the beginning of the animation if should_repeat is true.
                if self.should_repeat:
                    self.current_frame = 0
                else:
                    # Clamp the current frame to the number of images we have in our list
                    self.current_frame = len(self.images) - 1

            # Set the image that is currently displaying.
            if self.current_frame < len(self.images):
                self.image = self.images[self.current_frame]
                self.image.coords = self.coords
998278
def frameify(self, state, data):
        """"""

        # Pull in any partially-processed data
        data = state.recv_buf + data

        # Loop over the data
        while data:
            if not state.frame_start:
                try:
                    idx = data.index(self.prefix + self.begin)
                except ValueError:
                    # Can't find the start of a frame...
                    break

                # Advance data to the beginning of the frame (just
                # after the marker)
                data = data[idx + len(self.prefix) + 1:]
                state.frame_start = True

            # Now that data is sitting at the frame start, let's find
            # the frame ending
            try:
                idx = data.index(self.prefix + self.end)
            except ValueError:
                # Can't find the end of the frame...
                break

            # OK, extract the frame and advance the data
            frame = data[:idx]
            data = data[idx + len(self.prefix) + 1:]
            state.frame_start = (self.begin == self.end)

            # Now we need to unstuff the frame
            frame = self.prefix.join(frame.split(self.prefix + self.nop))

            # Yield the frame
            try:
                yield frame
            except FrameSwitch:
                break

        # Put any remaining data back into the buffer
        state.recv_buf = data
1169349
def frame_from_raw(raw):
    """"""
    command, payload = extract_from_frame(raw)
    frame = create_frame(command)
    if frame is None:
        PYVLXLOG.warning("Command %s not implemented, raw: %s", command, ":".join("{:02x}".format(c) for c in raw))
        return None
    frame.validate_payload_len(payload)
    frame.from_payload(payload)
    return frame
681802
private void updateFrameBuffer() {

		LOG.trace("Next frame");

		if (t1 == -1 || t2 == -1) {
			t1 = System.currentTimeMillis();
			t2 = System.currentTimeMillis();
		}

		int result = new NextFrameTask(this).nextFrame();

		t1 = t2;
		t2 = System.currentTimeMillis();

		fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;

		if (result == -1) {
			LOG.error("Timeout when requesting image!");
		} else if (result < -1) {
			LOG.error("Error requesting new frame!");
		}
	}
888540
def frameify(self, state, data):
        """"""

        # Pull in any partially-processed data
        data = state.recv_buf + data

        # Loop over the data
        while data:
            line, sep, rest = data.partition('\n')

            # Did we have a whole line?
            if sep != '\n':
                break

            # OK, update the data...
            data = rest

            # Now, strip off carriage return, if there is one
            if self.carriage_return and line[-1] == '\r':
                line = line[:-1]

            # Yield the line
            try:
                yield line
            except FrameSwitch:
                break

        # Put any remaining data back into the buffer
        state.recv_buf = data
550505
def _update_frames(self, written):
        """"""
        if self.seekable():
            curr = self.tell()
            self._info.frames = self.seek(0, SEEK_END)
            self.seek(curr, SEEK_SET)
        else:
            self._info.frames += written
681816
async def handle_frame(self, frame):
        """"""
        if isinstance(frame, FrameGetAllNodesInformationConfirmation):
            self.number_of_nodes = frame.number_of_nodes
            # We are still waiting for FrameGetAllNodesInformationNotification
            return False
        if isinstance(frame, FrameGetAllNodesInformationNotification):
            self.notification_frames.append(frame)
        if isinstance(frame, FrameGetAllNodesInformationFinishedNotification):
            if self.number_of_nodes != len(self.notification_frames):
                PYVLXLOG.warning("Number of received scenes does not match expected number")
            self.success = True
            return True
        return False
470957
def swap_buffers(self):
        
        self.widget.swapBuffers()
        self.set_default_viewport()
        self.app.processEvents()
        self.frames += 1
229622
def frameify(self, state, data):
        """"""

        # Pull in any partially-processed data
        data = state.recv_buf + data

        # Loop over the data
        while data:
            frame, sep, rest = data.partition('\0')

            # Did we have a whole frame?
            if sep != '\0':
                break

            # OK, update the data...
            data = rest

            # Now, decode the frame and yield it
            try:
                yield self._decode(frame, self._tables[0])
            except FrameSwitch:
                break

        # Put any remaining data back into the buffer
        state.recv_buf = data
1225031
def process_frame(self, frame):
        
        cmd_method = frame.cmd.lower()

        if not cmd_method in VALID_COMMANDS:
            raise ProtocolError("Invalid STOMP command: {}".format(frame.cmd))

        method = getattr(self, cmd_method, None)

        if not self.engine.connected and method not in (self.connect, self.stomp):
            raise ProtocolError("Not connected.")

        try:
            transaction = frame.headers.get('transaction')
            if not transaction or method in (self.begin, self.commit, self.abort):
                method(frame)
            else:
                if not transaction in self.engine.transactions:
                    raise ProtocolError(
                        "Invalid transaction specified: %s" % transaction)
                self.engine.transactions[transaction].append(frame)
        except Exception as e:
            self.engine.log.error("Error processing STOMP frame: %s" % e)
            self.engine.log.exception(e)
            try:
                self.engine.connection.send_frame(ErrorFrame(str(e), str(e)))
            except Exception as e:  # pragma: no cover
                self.engine.log.error("Could not send error frame: %s" % e)
                self.engine.log.exception(e)
        else:
            # The protocol is not especially clear here (not sure why I'm surprised)
            # about the expected behavior WRT receipts and errors.  We will assume that
            # the RECEIPT frame should not be sent if there is an error frame.
            # Also we'll assume that a transaction should not preclude sending the receipt
            # frame.
            # import pdb; pdb.set_trace()
            if frame.headers.get('receipt') and method != self.connect:
                self.engine.connection.send_frame(ReceiptFrame(
                    receipt=frame.headers.get('receipt')))
773362
public Frame process(Frame frame) {
    	sourceLen=frame.getLength();
    	destinationLen=sourceLen * 2;
        Frame res = Memory.allocate(destinationLen);
        
        byte[] data=frame.getData();
        byte[] resData=res.getData();
        
        for (i = 0,j = 0; i < sourceLen; i++) 
        {
        	currentIndex = data[i] & 0xff;
            resData[j++] = aLawDecompressTable_low[currentIndex];
            resData[j++] = aLawDecompressTable_high[currentIndex];
        }
        
        res.setOffset(0);
        res.setLength(destinationLen);
        res.setTimestamp(frame.getTimestamp());
        res.setDuration(frame.getDuration());
        res.setSequenceNumber(frame.getSequenceNumber());
        res.setEOM(frame.isEOM());
        res.setFormat(linear);
        res.setHeader(frame.getHeader());
        return res;
    }
120846
async def process_frame(self, frame):
        """"""
        if isinstance(frame, FrameNodeStatePositionChangedNotification):
            if frame.node_id not in self.pyvlx.nodes:
                return
            node = self.pyvlx.nodes[frame.node_id]
            if isinstance(node, OpeningDevice):
                node.position = Position(frame.current_position)
                await node.after_update()
        elif isinstance(frame, FrameGetAllNodesInformationNotification):
            if frame.node_id not in self.pyvlx.nodes:
                return
            node = self.pyvlx.nodes[frame.node_id]
            if isinstance(node, OpeningDevice):
                node.position = Position(frame.current_position)
                await node.after_update()
339768
def getouterframes(frame, context=1):
    """"""
    framelist = []
    while frame:
        framelist.append((frame,) + getframeinfo(frame, context))
        frame = frame.f_back
    return framelist
7884
async def recv(self):
        
        pts, time_base = await self.next_timestamp()

        frame = VideoFrame(width=640, height=480)
        for p in frame.planes:
            p.update(bytes(p.buffer_size))
        frame.pts = pts
        frame.time_base = time_base
        return frame