diff options
author | Guennadi Liakhovetski | 2017-12-06 10:15:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab | 2018-01-04 06:41:47 -0500 |
commit | 088ead25524583e2200aa99111bea2f66a86545a (patch) | |
tree | 39118e9e19ec50e11c16583cb502b2097a6a96dc /drivers/media/usb/uvc/uvcvideo.h | |
parent | 3bc85817d7982ed53fbc9b150b0205beff68ca5c (diff) |
media: uvcvideo: Add a metadata device node
Some UVC video cameras contain metadata in their payload headers. This
patch extracts that data, adding more clock synchronisation information,
on both bulk and isochronous endpoints and makes it available to the user
space on a separate video node, using the V4L2_CAP_META_CAPTURE capability
and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the
V4L2_META_FMT_UVC pixel format is available from those nodes. However,
cameras can be added to the device ID table to additionally specify their
own metadata format, in which case that format will also become available
from the metadata node.
[Use put_unaligned instead of __put_unaligned_cpu64]
[Use put_unaligned for the sof field as well]
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvcvideo.h')
-rw-r--r-- | drivers/media/usb/uvc/uvcvideo.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index c36fa0991141..961d7c13b27b 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -479,6 +479,8 @@ struct uvc_stats_stream { unsigned int max_sof; /* Maximum STC.SOF value */ }; +#define UVC_METATADA_BUF_SIZE 1024 + struct uvc_streaming { struct list_head list; struct uvc_device *dev; @@ -510,7 +512,13 @@ struct uvc_streaming { unsigned int frozen : 1; struct uvc_video_queue queue; void (*decode) (struct urb *urb, struct uvc_streaming *video, - struct uvc_buffer *buf); + struct uvc_buffer *buf, struct uvc_buffer *meta_buf); + + struct { + struct video_device vdev; + struct uvc_video_queue queue; + __u32 format; + } meta; /* Context data used by the bulk completion handler. */ struct { @@ -552,6 +560,8 @@ struct uvc_streaming { u16 last_sof; u16 sof_offset; + u8 last_scr[6]; + spinlock_t lock; } clock; }; @@ -561,6 +571,7 @@ struct uvc_device { struct usb_interface *intf; unsigned long warnings; __u32 quirks; + __u32 meta_format; int intfnum; char name[32]; @@ -715,6 +726,7 @@ extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit, void uvc_video_clock_update(struct uvc_streaming *stream, struct vb2_v4l2_buffer *vbuf, struct uvc_buffer *buf); +int uvc_meta_register(struct uvc_streaming *stream); int uvc_register_video_device(struct uvc_device *dev, struct uvc_streaming *stream, @@ -777,7 +789,7 @@ extern struct usb_host_endpoint *uvc_find_endpoint( /* Quirks support */ void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream, - struct uvc_buffer *buf); + struct uvc_buffer *buf, struct uvc_buffer *meta_buf); /* debugfs and statistics */ void uvc_debugfs_init(void); |