]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] cx231xx: fix NTSC cropcap, add missing cropcap for 417
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 30 Nov 2015 12:03:30 +0000 (10:03 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 18 Dec 2015 15:29:49 +0000 (13:29 -0200)
The pixelaspect ratio was set incorrectly for 60Hz formats.
And since cropcap wasn't implemented at all for the -417 (compressed
video) the pixelaspect was unknown for compressed video.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/cx231xx/cx231xx-417.c
drivers/media/usb/cx231xx/cx231xx-video.c

index 66b1b00b1b5bde4a3ca9805df6ab771c730815ad..48643b94e69449503618e2d95fc16a8da01c319b 100644 (file)
@@ -1492,6 +1492,27 @@ static struct videobuf_queue_ops cx231xx_qops = {
 
 /* ------------------------------------------------------------------ */
 
+static int vidioc_cropcap(struct file *file, void *priv,
+                         struct v4l2_cropcap *cc)
+{
+       struct cx231xx_fh *fh = priv;
+       struct cx231xx *dev = fh->dev;
+       bool is_50hz = dev->encodernorm.id & V4L2_STD_625_50;
+
+       if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               return -EINVAL;
+
+       cc->bounds.left = 0;
+       cc->bounds.top = 0;
+       cc->bounds.width = dev->ts1.width;
+       cc->bounds.height = dev->ts1.height;
+       cc->defrect = cc->bounds;
+       cc->pixelaspect.numerator = is_50hz ? 54 : 11;
+       cc->pixelaspect.denominator = is_50hz ? 59 : 10;
+
+       return 0;
+}
+
 static int vidioc_g_std(struct file *file, void *fh0, v4l2_std_id *norm)
 {
        struct cx231xx_fh  *fh  = file->private_data;
@@ -1834,6 +1855,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
        .vidioc_g_input          = cx231xx_g_input,
        .vidioc_s_input          = cx231xx_s_input,
        .vidioc_s_ctrl           = vidioc_s_ctrl,
+       .vidioc_cropcap          = vidioc_cropcap,
        .vidioc_querycap         = cx231xx_querycap,
        .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
        .vidioc_g_fmt_vid_cap    = vidioc_g_fmt_vid_cap,
index 246fb2bff114bec4defed2b9d8c80e0e849a8d7a..a70850fe6235ac8dc25b6c0ef63e3d633029bd0a 100644 (file)
@@ -1444,6 +1444,7 @@ static int vidioc_cropcap(struct file *file, void *priv,
 {
        struct cx231xx_fh *fh = priv;
        struct cx231xx *dev = fh->dev;
+       bool is_50hz = dev->norm & V4L2_STD_625_50;
 
        if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                return -EINVAL;
@@ -1453,8 +1454,8 @@ static int vidioc_cropcap(struct file *file, void *priv,
        cc->bounds.width = dev->width;
        cc->bounds.height = dev->height;
        cc->defrect = cc->bounds;
-       cc->pixelaspect.numerator = 54; /* 4:3 FIXME: remove magic numbers */
-       cc->pixelaspect.denominator = 59;
+       cc->pixelaspect.numerator = is_50hz ? 54 : 11;
+       cc->pixelaspect.denominator = is_50hz ? 59 : 10;
 
        return 0;
 }