From 66847ef013cc4ed3ae519360e7e4cbf531465ae8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 24 Sep 2011 10:46:55 -0300 Subject: [media] uvcvideo: Add UVC timestamps support UVC devices transmit a device timestamp along with video frames. Convert the timestamp to a host timestamp and use it to fill the V4L2 buffer timestamp field. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_queue.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/media/video/uvc/uvc_queue.c') diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index 268be579aa72..518f77d3a4d8 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c @@ -104,10 +104,22 @@ static void uvc_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&queue->irqlock, flags); } +static int uvc_buffer_finish(struct vb2_buffer *vb) +{ + struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); + struct uvc_streaming *stream = + container_of(queue, struct uvc_streaming, queue); + struct uvc_buffer *buf = container_of(vb, struct uvc_buffer, buf); + + uvc_video_clock_update(stream, &vb->v4l2_buf, buf); + return 0; +} + static struct vb2_ops uvc_queue_qops = { .queue_setup = uvc_queue_setup, .buf_prepare = uvc_buffer_prepare, .buf_queue = uvc_buffer_queue, + .buf_finish = uvc_buffer_finish, }; void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, -- cgit v1.2.2