aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-08-08 08:10:07 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:20 -0400
commite95a191566685530ef49b702bbce0a33c57c3136 (patch)
tree1972930857eb33239234e1f62c7cd4f70550a12d /drivers/media/video
parent434449f4c8902198e6fa90023f60395230f36c23 (diff)
V4L/DVB (4375): Eliminate hardcoded limits in VIDIOC_[S|TRY]_FMT for pvrusb2
The pvrusb2 implementation for VIDIOC_[S|TRY]_FMT was hardcoding limits on the range for allowed resolution, but it would be much better if we instead just queried the internal control for these values. This then opens the door for the driver to adjust these limits based on the detected hardware. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-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..5f5438aca136 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 (h < lmin) {
472 h = lmin;
473 } else if (h > lmax) {
474 h = 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 (w < lmin) {
473 w = 720; 479 w = lmin;
480 } else if (w > lmax) {
481 w = 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: