aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-v4l2.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 0caf70b8c0de..3608c2f81df9 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -459,18 +459,26 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
459 ret = 0; 459 ret = 0;
460 switch(vf->type) { 460 switch(vf->type) {
461 case V4L2_BUF_TYPE_VIDEO_CAPTURE: { 461 case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
462 int lmin,lmax;
463 struct pvr2_ctrl *hcp,*vcp;
462 int h = vf->fmt.pix.height; 464 int h = vf->fmt.pix.height;
463 int w = vf->fmt.pix.width; 465 int w = vf->fmt.pix.width;
464 466 hcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_HRES);
465 if (h < 200) { 467 vcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_VRES);
466 h = 200; 468
467 } else if (h > 625) { 469 lmin = pvr2_ctrl_get_min(hcp);
468 h = 625; 470 lmax = pvr2_ctrl_get_max(hcp);
471 if (w < lmin) {
472 w = lmin;
473 } else if (w > lmax) {
474 w = lmax;
469 } 475 }
470 if (w < 320) { 476 lmin = pvr2_ctrl_get_min(vcp);
471 w = 320; 477 lmax = pvr2_ctrl_get_max(vcp);
472 } else if (w > 720) { 478 if (h < lmin) {
473 w = 720; 479 h = lmin;
480 } else if (h > lmax) {
481 h = lmax;
474 } 482 }
475 483
476 memcpy(vf, &pvr_format[PVR_FORMAT_PIX], 484 memcpy(vf, &pvr_format[PVR_FORMAT_PIX],
@@ -479,14 +487,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
479 vf->fmt.pix.height = h; 487 vf->fmt.pix.height = h;
480 488
481 if (cmd == VIDIOC_S_FMT) { 489 if (cmd == VIDIOC_S_FMT) {
482 pvr2_ctrl_set_value( 490 pvr2_ctrl_set_value(hcp,vf->fmt.pix.width);
483 pvr2_hdw_get_ctrl_by_id(hdw, 491 pvr2_ctrl_set_value(vcp,vf->fmt.pix.height);
484 PVR2_CID_HRES),
485 vf->fmt.pix.width);
486 pvr2_ctrl_set_value(
487 pvr2_hdw_get_ctrl_by_id(hdw,
488 PVR2_CID_VRES),
489 vf->fmt.pix.height);
490 } 492 }
491 } break; 493 } break;
492 case V4L2_BUF_TYPE_VBI_CAPTURE: 494 case V4L2_BUF_TYPE_VBI_CAPTURE: