31 #if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
32 # include <dev/bktr/ioctl_meteor.h>
33 # include <dev/bktr/ioctl_bt848.h>
34 #elif HAVE_MACHINE_IOCTL_METEOR_H && HAVE_MACHINE_IOCTL_BT848_H
35 # include <machine/ioctl_meteor.h>
36 # include <machine/ioctl_bt848.h>
37 #elif HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H && HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H
38 # include <dev/video/meteor/ioctl_meteor.h>
39 # include <dev/video/bktr/ioctl_bt848.h>
40 #elif HAVE_DEV_IC_BT8XX_H
41 # include <dev/ic/bt8xx.h>
45 #include <sys/ioctl.h>
73 #define PAL_HEIGHT 576
74 #define SECAM_HEIGHT 576
75 #define NTSC_HEIGHT 480
78 #define VIDEO_FORMAT NTSC
81 static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
82 METEOR_DEV3, METEOR_DEV_SVIDEO };
97 int format,
int *video_fd,
int *tuner_fd,
int idev,
double frequency)
99 struct meteor_geomet geo;
101 long ioctl_frequency;
104 struct sigaction act = { {0} }, old;
106 if (idev < 0 || idev > 4)
108 arg = getenv (
"BKTR_DEV");
111 if (idev < 0 || idev > 4)
115 if (format < 1 || format > 6)
117 arg = getenv (
"BKTR_FORMAT");
120 if (format < 1 || format > 6)
126 arg = getenv (
"BKTR_FREQUENCY");
128 frequency = atof (arg);
133 sigemptyset(&act.sa_mask);
135 sigaction(SIGUSR1, &act, &old);
137 *tuner_fd = open(
"/dev/tuner0", O_RDONLY);
141 *video_fd = open(video_device, O_RDONLY);
150 geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
153 case PAL: h_max =
PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI;
break;
159 default: h_max =
PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI;
break;
162 if (height <= h_max / 2)
163 geo.oformat |= METEOR_GEO_EVEN_ONLY;
165 if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
170 if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
176 if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
184 PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
190 if (frequency != 0.0) {
191 ioctl_frequency = (
unsigned long)(frequency*16);
192 if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0)
197 if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0)
200 c = METEOR_CAP_CONTINOUS;
201 ioctl(*video_fd, METEORCAPTUR, &c);
204 ioctl(*video_fd, METEORSSIGNAL, &c);
219 "SLEPT NO signals - %d microseconds late\n",
302 c = METEOR_CAP_STOP_CONT;
303 ioctl(s->
video_fd, METEORCAPTUR, &c);
307 ioctl(s->
tuner_fd, BT848_SAUDIO, &c);
315 #define OFFSET(x) offsetof(VideoData, x)
316 #define DEC AV_OPT_FLAG_DECODING_PARAM
318 {
"standard",
"", offsetof(
VideoData, standard),
AV_OPT_TYPE_INT, {.i64 =
VIDEO_FORMAT},
PAL,
NTSCJ,
AV_OPT_FLAG_DECODING_PARAM,
"standard" },
345 .priv_class = &bktr_class,