diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-09-07 04:56:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-04 21:38:49 -0400 |
commit | bba4449c637660d5a8b2aee5ad0206df9fd6f334 (patch) | |
tree | 0ed246fe242354b8626ae8a65d11acb091a4d870 | |
parent | c014ec90bc1b951e3fff89bc6ba826b8ef0f444b (diff) |
V4L/DVB (8958): zr36067: Return proper bytes-per-line value
The zr36067 driver should return the actual bytes-per-line value when
queried with ioctl VIDIOC_G_FMT, instead of 0. Otherwise user-space
applications can get confused.
Likewise, with ioctl VIDIOC_S_FMT, we are supposed to fill the
bytes-per-line value. And we shouldn't fail if the caller sets the
initial value to something different from 0. This is perfectly valid
for applications to pre-fill this field with the value they expect.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/zoran_driver.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index ec6f59674b10..ca21bd22a02e 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -2737,7 +2737,8 @@ zoran_do_ioctl (struct inode *inode, | |||
2737 | fh->v4l_settings.format->fourcc; | 2737 | fh->v4l_settings.format->fourcc; |
2738 | fmt->fmt.pix.colorspace = | 2738 | fmt->fmt.pix.colorspace = |
2739 | fh->v4l_settings.format->colorspace; | 2739 | fh->v4l_settings.format->colorspace; |
2740 | fmt->fmt.pix.bytesperline = 0; | 2740 | fmt->fmt.pix.bytesperline = |
2741 | fh->v4l_settings.bytesperline; | ||
2741 | if (BUZ_MAX_HEIGHT < | 2742 | if (BUZ_MAX_HEIGHT < |
2742 | (fh->v4l_settings.height * 2)) | 2743 | (fh->v4l_settings.height * 2)) |
2743 | fmt->fmt.pix.field = | 2744 | fmt->fmt.pix.field = |
@@ -2833,13 +2834,6 @@ zoran_do_ioctl (struct inode *inode, | |||
2833 | fmt->fmt.pix.pixelformat, | 2834 | fmt->fmt.pix.pixelformat, |
2834 | (char *) &printformat); | 2835 | (char *) &printformat); |
2835 | 2836 | ||
2836 | if (fmt->fmt.pix.bytesperline > 0) { | ||
2837 | dprintk(5, | ||
2838 | KERN_ERR "%s: bpl not supported\n", | ||
2839 | ZR_DEVNAME(zr)); | ||
2840 | return -EINVAL; | ||
2841 | } | ||
2842 | |||
2843 | /* we can be requested to do JPEG/raw playback/capture */ | 2837 | /* we can be requested to do JPEG/raw playback/capture */ |
2844 | if (! | 2838 | if (! |
2845 | (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE || | 2839 | (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE || |
@@ -2923,6 +2917,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2923 | fh->jpg_buffers.buffer_size = | 2917 | fh->jpg_buffers.buffer_size = |
2924 | zoran_v4l2_calc_bufsize(&fh-> | 2918 | zoran_v4l2_calc_bufsize(&fh-> |
2925 | jpg_settings); | 2919 | jpg_settings); |
2920 | fmt->fmt.pix.bytesperline = 0; | ||
2926 | fmt->fmt.pix.sizeimage = | 2921 | fmt->fmt.pix.sizeimage = |
2927 | fh->jpg_buffers.buffer_size; | 2922 | fh->jpg_buffers.buffer_size; |
2928 | 2923 | ||
@@ -2979,6 +2974,8 @@ zoran_do_ioctl (struct inode *inode, | |||
2979 | 2974 | ||
2980 | /* tell the user the | 2975 | /* tell the user the |
2981 | * results/missing stuff */ | 2976 | * results/missing stuff */ |
2977 | fmt->fmt.pix.bytesperline = | ||
2978 | fh->v4l_settings.bytesperline; | ||
2982 | fmt->fmt.pix.sizeimage = | 2979 | fmt->fmt.pix.sizeimage = |
2983 | fh->v4l_settings.height * | 2980 | fh->v4l_settings.height * |
2984 | fh->v4l_settings.bytesperline; | 2981 | fh->v4l_settings.bytesperline; |