aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l1-compat.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-08-06 08:10:06 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:49 -0400
commit3702627899db1d6a818c6e0b4ba5205f94bfbef4 (patch)
treee572f177b0c75afd265a1db087b24ff4f15015f0 /drivers/media/video/v4l1-compat.c
parenta202a5bfb6c1d7c778f67f28b5f2caac21beafce (diff)
V4L/DVB (4474): On some cases, depth were not returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/v4l1-compat.c')
-rw-r--r--drivers/media/video/v4l1-compat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index d7c3fcbc80f7..1d899e2db394 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -349,6 +349,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
349 { 349 {
350 struct video_buffer *buffer = arg; 350 struct video_buffer *buffer = arg;
351 351
352 memset(buffer, 0, sizeof(*buffer));
353
352 err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); 354 err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2);
353 if (err < 0) { 355 if (err < 0) {
354 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); 356 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err);
@@ -361,7 +363,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
361 switch (fbuf2.fmt.pixelformat) { 363 switch (fbuf2.fmt.pixelformat) {
362 case V4L2_PIX_FMT_RGB332: 364 case V4L2_PIX_FMT_RGB332:
363 buffer->depth = 8; 365 buffer->depth = 8;
364 break; 366 break;
365 case V4L2_PIX_FMT_RGB555: 367 case V4L2_PIX_FMT_RGB555:
366 buffer->depth = 15; 368 buffer->depth = 15;
367 break; 369 break;
@@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode,
377 default: 379 default:
378 buffer->depth = 0; 380 buffer->depth = 0;
379 } 381 }
380 if (0 != fbuf2.fmt.bytesperline) 382 if (fbuf2.fmt.bytesperline) {
381 buffer->bytesperline = fbuf2.fmt.bytesperline; 383 buffer->bytesperline = fbuf2.fmt.bytesperline;
382 else { 384 if (!buffer->depth && buffer->width)
385 buffer->depth = ((fbuf2.fmt.bytesperline<<3)
386 + (buffer->width-1) )
387 /buffer->width;
388 } else {
383 buffer->bytesperline = 389 buffer->bytesperline =
384 (buffer->width * buffer->depth + 7) & 7; 390 (buffer->width * buffer->depth + 7) & 7;
385 buffer->bytesperline >>= 3; 391 buffer->bytesperline >>= 3;