diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2009-06-04 14:26:39 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@skynet.be> | 2009-06-04 14:26:39 +0200 |
commit | 2534dbc36b3ce8468ed85ed58818d4dcddaec092 (patch) | |
tree | d9780a4c6fa534937bc0ce4d49bc29011180860e /linux/drivers/media/video/uvc/uvc_queue.c | |
parent | 44b1c5b02d09f608ab17baeed5f5862af30bb32e (diff) | |
download | mediapointer-dvb-s2-2534dbc36b3ce8468ed85ed58818d4dcddaec092.tar.gz mediapointer-dvb-s2-2534dbc36b3ce8468ed85ed58818d4dcddaec092.tar.bz2 |
uvcvideo: Don't accept to change the format when buffers are allocated.
From: Laurent Pinchart <laurent.pinchart@skynet.be>
Setting a new frame format or size will likely change the buffer size required
to store a complete video frame. To avoid a buffer overflow, don't allow
VIDIOC_S_FMT calls when video buffers are already allocated.
Priority: normal
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Diffstat (limited to 'linux/drivers/media/video/uvc/uvc_queue.c')
-rw-r--r-- | linux/drivers/media/video/uvc/uvc_queue.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_queue.c b/linux/drivers/media/video/uvc/uvc_queue.c index 0155752e4..f854698c4 100644 --- a/linux/drivers/media/video/uvc/uvc_queue.c +++ b/linux/drivers/media/video/uvc/uvc_queue.c @@ -172,6 +172,20 @@ int uvc_free_buffers(struct uvc_video_queue *queue) return 0; } +/* + * Check if buffers have been allocated. + */ +int uvc_queue_allocated(struct uvc_video_queue *queue) +{ + int allocated; + + mutex_lock(&queue->mutex); + allocated = queue->count != 0; + mutex_unlock(&queue->mutex); + + return allocated; +} + static void __uvc_query_buffer(struct uvc_buffer *buf, struct v4l2_buffer *v4l2_buf) { |