summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-01-06 21:20:29 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-01-06 21:20:29 +0000
commit28665f4a2ca6dea9eaafba8d2abbd9472bd061db (patch)
tree6401e38414451275d48d58b7939dc1feee41178b /src/input
parenta2a95425350da93551388acdca8a00818a34c317 (diff)
parent6255dcb866af030b0122c061459ab587a0d8c074 (diff)
downloadxine-lib-28665f4a2ca6dea9eaafba8d2abbd9472bd061db.tar.gz
xine-lib-28665f4a2ca6dea9eaafba8d2abbd9472bd061db.tar.bz2
Merge from 1.1.
--HG-- rename : src/xine-engine/buffer.h => include/xine/buffer.h rename : src/libffmpeg/ff_video_decoder.c => src/combined/ffmpeg/ff_video_decoder.c rename : src/libsputext/xine_sputext_decoder.c => src/spu_dec/sputext_decoder.c
Diffstat (limited to 'src/input')
-rw-r--r--src/input/input_pvr.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c
index 50ba4720e..740d51665 100644
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -1008,19 +1008,21 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
/* change input */
if (v4l2_data->input != -1 && v4l2_data->input != this->input) {
- lprintf("change input to:%d\n", v4l2_data->input);
this->input = v4l2_data->input;
/* as of ivtv 0.10.6: must close and reopen to set input */
close(this->dev_fd);
this->dev_fd = open (this->class->devname, O_RDWR);
- if (this->dev_fd == -1) {
+ if (this->dev_fd < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"input_pvr: error opening device %s\n", this->class->devname );
} else {
- if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) )
+ if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) == 0 ) {
+ lprintf("Tuner Input set to:%d\n", v4l2_data->input);
+ } else {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"input_pvr: error setting v4l2 input\n");
+ }
}
}
@@ -1032,14 +1034,30 @@ static void pvr_event_handler (pvr_input_plugin_t *this) {
/* change frequency */
if (v4l2_data->frequency != -1 && v4l2_data->frequency != this->frequency) {
- lprintf("changing frequency to:%.2f\n", (float)v4l2_data->frequency * 62.5);
+ double freq = (double)v4l2_data->frequency / 1000.0;
struct v4l2_frequency vf;
+ struct v4l2_tuner vt;
+ double fac = 16;
+
+ memset(&vf, 0, sizeof(vf));
+ memset(&vt, 0, sizeof(vt));
+
this->frequency = v4l2_data->frequency;
- vf.frequency = this->frequency;
+
+ if (ioctl(this->dev_fd, VIDIOC_G_TUNER, &vt) == 0) {
+ fac = (vt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16;
+ }
+
vf.tuner = 0;
- if( ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) )
+ vf.type = vt.type;
+ vf.frequency = (__u32)(freq * fac);
+
+ if (ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) == 0) {
+ lprintf("Tuner Frequency set to %d (%f.3 MHz)\n", vf.frequency, vf.frequency / fac);
+ } else {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"input_pvr: error setting v4l2 frequency\n");
+ }
}
pthread_mutex_unlock(&this->dev_lock);