Esempio n. 1
0
void uvc_video_decode_isight(struct urb *urb, struct uvc_video_device *video,
        struct uvc_buffer *buf)
{
    int ret, i;

    for (i = 0; i < urb->number_of_packets; ++i) {
        if (urb->iso_frame_desc[i].status < 0) {
            uvc_trace(UVC_TRACE_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(&video->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(&video->queue, buf);
        } while (ret == -EAGAIN);
    }
}
void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream,
		struct uvc_buffer *buf)
{
	int ret, i;

	for (i = 0; i < urb->number_of_packets; ++i) {
		if (urb->iso_frame_desc[i].status < 0) {
			uvc_trace(UVC_TRACE_FRAME, "USB isochronous frame "
				  "lost (%d).\n",
				  urb->iso_frame_desc[i].status);
		}

		/*                           
                                                              
                                                           
                                                             
                                                            
                                                        
                                                              
   */
		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);
	}
}