/* * Built-in iSight webcams implements most of UVC 1.0 except a * different packet format. Instead of sending a header at the * beginning of each isochronous transfer payload, the webcam sends a * single header per image (on its own in a packet), followed by * packets containing data only. * * Offset Size (bytes) Description * ------------------------------------------------------------------ * 0x00 1 Header length * 0x01 1 Flags (UVC-compliant) * 0x02 4 Always equal to '11223344' * 0x06 8 Always equal to 'deadbeefdeadface' * 0x0e 16 Unknown * * The header can be prefixed by an optional, unknown-purpose byte.
*/
/* Synchronize to the input stream by waiting for a header packet. */ if (buf->state != UVC_BUF_STATE_ACTIVE) { if (!is_header) {
uvc_dbg(stream->dev, FRAME, "Dropping packet (out of sync)\n"); return 0;
}
buf->state = UVC_BUF_STATE_ACTIVE;
}
/* * Mark the buffer as done if we're at the beginning of a new frame. * * Empty buffers (bytesused == 0) don't trigger end of frame detection * as it doesn't make sense to return an empty buffer.
*/ if (is_header && buf->bytesused != 0) {
buf->state = UVC_BUF_STATE_DONE; return -EAGAIN;
}
/* * Copy the video data to the buffer. Skip header packets, as they * contain no data.
*/ if (!is_header) {
maxlen = buf->length - buf->bytesused;
mem = buf->mem + buf->bytesused;
nbytes = min(len, maxlen);
memcpy(mem, data, nbytes);
buf->bytesused += nbytes;
for (i = 0; i < urb->number_of_packets; ++i) { if (urb->iso_frame_desc[i].status < 0) {
uvc_dbg(stream->dev, FRAME, "USB isochronous frame lost (%d)\n",
urb->iso_frame_desc[i].status);
}
/* * Decode the payload packet. * * uvc_video_decode is entered twice when a frame transition * has been detected because the end of frame can only be * reliably detected when the first packet of the new frame * is processed. The first pass detects the transition and * closes the previous frame's buffer, the second pass * processes the data of the first payload of the new frame.
*/ do {
ret = isight_decode(&stream->queue, buf,
urb->transfer_buffer +
urb->iso_frame_desc[i].offset,
urb->iso_frame_desc[i].actual_length);
if (buf == NULL) break;
if (buf->state == UVC_BUF_STATE_DONE ||
buf->state == UVC_BUF_STATE_ERROR)
buf = uvc_queue_next_buffer(&stream->queue,
buf);
} while (ret == -EAGAIN);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.