summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-07-26 23:58:45 -0500
committerMike Isely <isely@pobox.com>2006-07-26 23:58:45 -0500
commitb3457c9cbfdb5f46bf594929e4e4248d44ffd399 (patch)
tree4e832ff5f5d8858812faf96e107d0fc77e9bc534 /linux/drivers/media/video/pvrusb2
parent62db1c22ce7b8ea11a0b6b6b17ff42f4ec893869 (diff)
downloadmediapointer-dvb-s2-b3457c9cbfdb5f46bf594929e4e4248d44ffd399.tar.gz
mediapointer-dvb-s2-b3457c9cbfdb5f46bf594929e4e4248d44ffd399.tar.bz2
Eliminate hardcoded limits in VIDIOC_[S|TRY]_FMT for pvrusb2
From: Mike Isely <isely@pobox.com> 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>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 2ca67413d..1e4be1e4e 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -475,18 +475,26 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
ret = 0;
switch(vf->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
+ int lmin,lmax;
+ struct pvr2_ctrl *hcp,*vcp;
int h = vf->fmt.pix.height;
int w = vf->fmt.pix.width;
-
- if (h < 200) {
- h = 200;
- } else if (h > 625) {
- h = 625;
+ hcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_HRES);
+ vcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_VRES);
+
+ lmin = pvr2_ctrl_get_min(hcp);
+ lmax = pvr2_ctrl_get_max(hcp);
+ if (h < lmin) {
+ h = lmin;
+ } else if (h > lmax) {
+ h = lmax;
}
- if (w < 320) {
- w = 320;
- } else if (w > 720) {
- w = 720;
+ lmin = pvr2_ctrl_get_min(vcp);
+ lmax = pvr2_ctrl_get_max(vcp);
+ if (w < lmin) {
+ w = lmin;
+ } else if (w > lmax) {
+ w = lmax;
}
memcpy(vf, &pvr_format[PVR_FORMAT_PIX],
@@ -495,14 +503,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
vf->fmt.pix.height = h;
if (cmd == VIDIOC_S_FMT) {
- pvr2_ctrl_set_value(
- pvr2_hdw_get_ctrl_by_id(hdw,
- PVR2_CID_HRES),
- vf->fmt.pix.width);
- pvr2_ctrl_set_value(
- pvr2_hdw_get_ctrl_by_id(hdw,
- PVR2_CID_VRES),
- vf->fmt.pix.height);
+ pvr2_ctrl_set_value(hcp,vf->fmt.pix.width);
+ pvr2_ctrl_set_value(vcp,vf->fmt.pix.height);
}
} break;
case V4L2_BUF_TYPE_VBI_CAPTURE: