diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-01-29 11:02:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-05 12:26:03 -0500 |
commit | 5aa95991d7ff15ca965ef5abe91f90afeb262afd (patch) | |
tree | a18c38ed07bb5409ef191a180037aca2bd1bbbf4 /drivers/media/usb/cx231xx | |
parent | bc08734c825b710ffab93f79ca1ca2d0265dd321 (diff) |
[media] cx231xx-417: fix g/try_fmt compliance problems
Colorspace, field and priv were not set, and sizeimage was calculated
using the wrong values (dev->ts1.ts_packet_size and dev->ts1.ts_packet_count
can be 0 at module load).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/cx231xx')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-417.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c index be8f7481d7f2..cbdc141fe9b2 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c | |||
@@ -1223,6 +1223,7 @@ static int bb_buf_setup(struct videobuf_queue *q, | |||
1223 | 1223 | ||
1224 | return 0; | 1224 | return 0; |
1225 | } | 1225 | } |
1226 | |||
1226 | static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) | 1227 | static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) |
1227 | { | 1228 | { |
1228 | struct cx231xx_fh *fh = vq->priv_data; | 1229 | struct cx231xx_fh *fh = vq->priv_data; |
@@ -1645,17 +1646,18 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
1645 | { | 1646 | { |
1646 | struct cx231xx_fh *fh = file->private_data; | 1647 | struct cx231xx_fh *fh = file->private_data; |
1647 | struct cx231xx *dev = fh->dev; | 1648 | struct cx231xx *dev = fh->dev; |
1649 | |||
1648 | dprintk(3, "enter vidioc_g_fmt_vid_cap()\n"); | 1650 | dprintk(3, "enter vidioc_g_fmt_vid_cap()\n"); |
1649 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 1651 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
1650 | f->fmt.pix.bytesperline = 0; | 1652 | f->fmt.pix.bytesperline = 0; |
1651 | f->fmt.pix.sizeimage = | 1653 | f->fmt.pix.sizeimage = mpeglines * mpeglinesize; |
1652 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | 1654 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
1653 | f->fmt.pix.colorspace = 0; | 1655 | f->fmt.pix.width = dev->ts1.width; |
1654 | f->fmt.pix.width = dev->ts1.width; | 1656 | f->fmt.pix.height = dev->ts1.height; |
1655 | f->fmt.pix.height = dev->ts1.height; | 1657 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; |
1656 | f->fmt.pix.field = fh->vidq.field; | 1658 | f->fmt.pix.priv = 0; |
1657 | dprintk(1, "VIDIOC_G_FMT: w: %d, h: %d, f: %d\n", | 1659 | dprintk(1, "VIDIOC_G_FMT: w: %d, h: %d\n", |
1658 | dev->ts1.width, dev->ts1.height, fh->vidq.field); | 1660 | dev->ts1.width, dev->ts1.height); |
1659 | dprintk(3, "exit vidioc_g_fmt_vid_cap()\n"); | 1661 | dprintk(3, "exit vidioc_g_fmt_vid_cap()\n"); |
1660 | return 0; | 1662 | return 0; |
1661 | } | 1663 | } |
@@ -1665,14 +1667,16 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
1665 | { | 1667 | { |
1666 | struct cx231xx_fh *fh = file->private_data; | 1668 | struct cx231xx_fh *fh = file->private_data; |
1667 | struct cx231xx *dev = fh->dev; | 1669 | struct cx231xx *dev = fh->dev; |
1670 | |||
1668 | dprintk(3, "enter vidioc_try_fmt_vid_cap()\n"); | 1671 | dprintk(3, "enter vidioc_try_fmt_vid_cap()\n"); |
1669 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 1672 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
1670 | f->fmt.pix.bytesperline = 0; | 1673 | f->fmt.pix.bytesperline = 0; |
1671 | f->fmt.pix.sizeimage = | 1674 | f->fmt.pix.sizeimage = mpeglines * mpeglinesize; |
1672 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | 1675 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; |
1673 | f->fmt.pix.colorspace = 0; | 1676 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
1674 | dprintk(1, "VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n", | 1677 | f->fmt.pix.priv = 0; |
1675 | dev->ts1.width, dev->ts1.height, fh->vidq.field); | 1678 | dprintk(1, "VIDIOC_TRY_FMT: w: %d, h: %d\n", |
1679 | dev->ts1.width, dev->ts1.height); | ||
1676 | dprintk(3, "exit vidioc_try_fmt_vid_cap()\n"); | 1680 | dprintk(3, "exit vidioc_try_fmt_vid_cap()\n"); |
1677 | return 0; | 1681 | return 0; |
1678 | } | 1682 | } |