summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/v4l1-compat.c
diff options
context:
space:
mode:
authorHans Verkuil <devnull@localhost>2005-12-14 22:05:02 +0000
committerHans Verkuil <devnull@localhost>2005-12-14 22:05:02 +0000
commita4db01916e0ed8ce17c255805505e8f6bf403673 (patch)
treee0f185f5436098fb274dd8accdbd6dd6bf5e4da0 /linux/drivers/media/video/v4l1-compat.c
parentd53188a9c5cbe6cf8875135fe8ba02b0d7251bc8 (diff)
downloadmediapointer-dvb-s2-a4db01916e0ed8ce17c255805505e8f6bf403673.tar.gz
mediapointer-dvb-s2-a4db01916e0ed8ce17c255805505e8f6bf403673.tar.bz2
bttv VBI fixes
From: Michael H. Schimek <mschimek@gmx.at> - V4L2_(G|S|TRY)_FMT returned incorrect VBI start lines for PAL-M, NTSC-JP, and PAL-60. They also returned an inaccurate VBI offset. - V4L2_(G|S)_FMT and V4L2_TRY_FMT disagreed about the start of VBI capturing in PAL and SECAM second field. Note the start line fixes may break applications using VIDIOCSVBIFMT because this ioctl fails when the driver does not support exactly the requested parameters. - V4L2_TRY_FMT did not clear the reserved field in struct v4l2_vbi_format. - V4L2_(S|TRY)_FMT did not expect very large or small VBI start or count values, returning wrong (but safe) counts due to an overflow. - VIDIOCGVBIFMT confused V4L and V4L2 VBI flags. However this had no effect because the flags have the same value and bttv never sets them. - In v4l_compat_translate_ioctl() the VIDIOC(G|S)VBIFMT code did not expect V4L2 drivers supporting VBI formats besides V4L2_PIX_FMT_GREY. Signed-off-by: Michael H. Schimek <mschimek@gmx.at> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/v4l1-compat.c')
-rw-r--r--linux/drivers/media/video/v4l1-compat.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c
index 42a41b1cb..02fe28a5e 100644
--- a/linux/drivers/media/video/v4l1-compat.c
+++ b/linux/drivers/media/video/v4l1-compat.c
@@ -1,5 +1,5 @@
/*
- * $Id: v4l1-compat.c,v 1.14 2005/12/07 12:30:28 mchehab Exp $
+ * $Id: v4l1-compat.c,v 1.15 2005/12/14 22:05:02 hverkuil Exp $
*
* Video for Linux Two
* Backward Compatibility Layer
@@ -979,6 +979,10 @@ v4l_compat_translate_ioctl(struct inode *inode,
dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %d\n", err);
break;
}
+ if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) {
+ err = -EINVAL;
+ break;
+ }
memset(fmt, 0, sizeof(*fmt));
fmt->samples_per_line = fmt2->fmt.vbi.samples_per_line;
fmt->sampling_rate = fmt2->fmt.vbi.sampling_rate;
@@ -994,6 +998,11 @@ v4l_compat_translate_ioctl(struct inode *inode,
{
struct vbi_format *fmt = arg;
+ if (VIDEO_PALETTE_RAW != fmt->sample_format) {
+ err = -EINVAL;
+ break;
+ }
+
fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
memset(fmt2, 0, sizeof(*fmt2));
@@ -1014,7 +1023,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
if (fmt2->fmt.vbi.samples_per_line != fmt->samples_per_line ||
fmt2->fmt.vbi.sampling_rate != fmt->sampling_rate ||
- VIDEO_PALETTE_RAW != fmt->sample_format ||
+ fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY ||
fmt2->fmt.vbi.start[0] != fmt->start[0] ||
fmt2->fmt.vbi.count[0] != fmt->count[0] ||
fmt2->fmt.vbi.start[1] != fmt->start[1] ||