aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-ioctl.c')
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index afe0a29e7200..66b1c15c3541 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -160,12 +160,7 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh,
160 pixfmt->priv = 0; 160 pixfmt->priv = 0;
161 if (id->type == CX18_ENC_STREAM_TYPE_YUV) { 161 if (id->type == CX18_ENC_STREAM_TYPE_YUV) {
162 pixfmt->pixelformat = s->pixelformat; 162 pixfmt->pixelformat = s->pixelformat;
163 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2))) 163 pixfmt->sizeimage = s->vb_bytes_per_frame;
164 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
165 if (s->pixelformat == V4L2_PIX_FMT_HM12)
166 pixfmt->sizeimage = pixfmt->height * 720 * 3 / 2;
167 else
168 pixfmt->sizeimage = pixfmt->height * 720 * 2;
169 pixfmt->bytesperline = 720; 164 pixfmt->bytesperline = 720;
170 } else { 165 } else {
171 pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; 166 pixfmt->pixelformat = V4L2_PIX_FMT_MPEG;
@@ -296,6 +291,12 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
296 return -EBUSY; 291 return -EBUSY;
297 292
298 s->pixelformat = fmt->fmt.pix.pixelformat; 293 s->pixelformat = fmt->fmt.pix.pixelformat;
294 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2)))
295 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
296 if (s->pixelformat == V4L2_PIX_FMT_HM12)
297 s->vb_bytes_per_frame = h * 720 * 3 / 2;
298 else
299 s->vb_bytes_per_frame = h * 720 * 2;
299 300
300 mbus_fmt.width = cx->cxhdl.width = w; 301 mbus_fmt.width = cx->cxhdl.width = w;
301 mbus_fmt.height = cx->cxhdl.height = h; 302 mbus_fmt.height = cx->cxhdl.height = h;
@@ -463,13 +464,16 @@ static int cx18_s_register(struct file *file, void *fh,
463static int cx18_querycap(struct file *file, void *fh, 464static int cx18_querycap(struct file *file, void *fh,
464 struct v4l2_capability *vcap) 465 struct v4l2_capability *vcap)
465{ 466{
466 struct cx18 *cx = fh2id(fh)->cx; 467 struct cx18_open_id *id = fh2id(fh);
468 struct cx18 *cx = id->cx;
467 469
468 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); 470 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
469 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); 471 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
470 snprintf(vcap->bus_info, sizeof(vcap->bus_info), 472 snprintf(vcap->bus_info, sizeof(vcap->bus_info),
471 "PCI:%s", pci_name(cx->pci_dev)); 473 "PCI:%s", pci_name(cx->pci_dev));
472 vcap->capabilities = cx->v4l2_cap; /* capabilities */ 474 vcap->capabilities = cx->v4l2_cap; /* capabilities */
475 if (id->type == CX18_ENC_STREAM_TYPE_YUV)
476 vcap->capabilities |= V4L2_CAP_STREAMING;
473 return 0; 477 return 0;
474} 478}
475 479