diff options
author | Mike Isely <isely@pobox.com> | 2006-12-27 20:25:06 -0600 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-12-27 20:25:06 -0600 |
commit | c8dd4616f6359cd0f98ea853b654ad4c5eec971b (patch) | |
tree | 34ce801c057b302ca1b6b3bca0baa65d6e2d63d4 /linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |
parent | b74377a68f1b23d52cbe42b2576a31afd3ef875f (diff) | |
download | mediapointer-dvb-s2-c8dd4616f6359cd0f98ea853b654ad4c5eec971b.tar.gz mediapointer-dvb-s2-c8dd4616f6359cd0f98ea853b654ad4c5eec971b.tar.bz2 |
pvrusb2: v4l2 API implementation frequency tweaks
From: Mike Isely <isely@pobox.com>
Report and set correctly converted frequency to/from a V4L2 app.
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 2ab2a0143..eaf2a35ec 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -404,9 +404,15 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_S_FREQUENCY: { const struct v4l2_frequency *vf = (struct v4l2_frequency *)arg; + unsigned long fv; + fv = vf->frequency; + if (vf->type == V4L2_TUNER_RADIO) { + fv = (fv * 125) / 2; + } else { + fv = fv * 62500; + } ret = pvr2_ctrl_set_value( - pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY), - vf->frequency * 62500); + pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY),fv); break; } @@ -414,11 +420,23 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, { struct v4l2_frequency *vf = (struct v4l2_frequency *)arg; int val = 0; + int cur_input = PVR2_CVAL_INPUT_TV; ret = pvr2_ctrl_get_value( pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_FREQUENCY), &val); - val /= 62500; - vf->frequency = val; + if (ret != 0) break; + pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT), + &cur_input); + if (cur_input == PVR2_CVAL_INPUT_RADIO) { + val = (val * 2) / 125; + vf->frequency = val; + vf->type = V4L2_TUNER_RADIO; + } else { + val /= 62500; + vf->frequency = val; + vf->type = V4L2_TUNER_ANALOG_TV; + } break; } |