1 | #ifndef __LINUX_VIDEODEV_H
|
---|
2 | #define __LINUX_VIDEODEV_H
|
---|
3 |
|
---|
4 | #include <linux/types.h>
|
---|
5 |
|
---|
6 | /*#ifdef __KERNEL__
|
---|
7 |
|
---|
8 | #if LINUX_VERSION_CODE >= 0x020100
|
---|
9 | #include <linux/poll.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | struct video_device
|
---|
13 | {
|
---|
14 | char name[32];
|
---|
15 | int type;
|
---|
16 | int hardware;
|
---|
17 |
|
---|
18 | int (*open)(struct video_device *, int mode);
|
---|
19 | void (*close)(struct video_device *);
|
---|
20 | long (*read)(struct video_device *, char *, unsigned long, int noblock);
|
---|
21 | // Do we need a write method ?
|
---|
22 | long (*write)(struct video_device *, const char *, unsigned long, int noblock);
|
---|
23 | #if LINUX_VERSION_CODE >= 0x020100
|
---|
24 | unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
|
---|
25 | #endif
|
---|
26 | int (*ioctl)(struct video_device *, unsigned int , void *);
|
---|
27 | int (*mmap)(struct video_device *, const char *, unsigned long);
|
---|
28 | int (*initialize)(struct video_device *);
|
---|
29 | void *priv; // Used to be 'private' but that upsets C++
|
---|
30 | int busy;
|
---|
31 | int minor;
|
---|
32 | };
|
---|
33 |
|
---|
34 | extern int videodev_init(void);
|
---|
35 | #define VIDEO_MAJOR 81
|
---|
36 | extern int video_register_device(struct video_device *, int type);
|
---|
37 |
|
---|
38 | #define VFL_TYPE_GRABBER 0
|
---|
39 | #define VFL_TYPE_VBI 1
|
---|
40 | #define VFL_TYPE_RADIO 2
|
---|
41 | #define VFL_TYPE_VTX 3
|
---|
42 |
|
---|
43 | extern void video_unregister_device(struct video_device *);
|
---|
44 | #endif
|
---|
45 | */
|
---|
46 |
|
---|
47 | #define VID_TYPE_CAPTURE 1 /* Can capture */
|
---|
48 | #define VID_TYPE_TUNER 2 /* Can tune */
|
---|
49 | #define VID_TYPE_TELETEXT 4 /* Does teletext */
|
---|
50 | #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
|
---|
51 | #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
|
---|
52 | #define VID_TYPE_CLIPPING 32 /* Can clip */
|
---|
53 | #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
|
---|
54 | #define VID_TYPE_SCALES 128 /* Scalable */
|
---|
55 | #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
|
---|
56 | #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
|
---|
57 |
|
---|
58 | struct video_capability
|
---|
59 | {
|
---|
60 | char name[32];
|
---|
61 | int type;
|
---|
62 | int channels; /* Num channels */
|
---|
63 | int audios; /* Num audio devices */
|
---|
64 | int maxwidth; /* Supported width */
|
---|
65 | int maxheight; /* And height */
|
---|
66 | int minwidth; /* Supported width */
|
---|
67 | int minheight; /* And height */
|
---|
68 | };
|
---|
69 |
|
---|
70 |
|
---|
71 | struct video_channel
|
---|
72 | {
|
---|
73 | int channel;
|
---|
74 | char name[32];
|
---|
75 | int tuners;
|
---|
76 | __u32 flags;
|
---|
77 | #define VIDEO_VC_TUNER 1 /* Channel has a tuner */
|
---|
78 | #define VIDEO_VC_AUDIO 2 /* Channel has audio */
|
---|
79 | __u16 type;
|
---|
80 | #define VIDEO_TYPE_TV 1
|
---|
81 | #define VIDEO_TYPE_CAMERA 2
|
---|
82 | __u16 norm; /* Norm set by channel */
|
---|
83 | };
|
---|
84 |
|
---|
85 | struct video_tuner
|
---|
86 | {
|
---|
87 | int tuner;
|
---|
88 | char name[32];
|
---|
89 | ulong rangelow, rangehigh; /* Tuner range */
|
---|
90 | __u32 flags;
|
---|
91 | #define VIDEO_TUNER_PAL 1
|
---|
92 | #define VIDEO_TUNER_NTSC 2
|
---|
93 | #define VIDEO_TUNER_SECAM 4
|
---|
94 | #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
|
---|
95 | #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
|
---|
96 | #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
|
---|
97 | __u16 mode; /* PAL/NTSC/SECAM/OTHER */
|
---|
98 | #define VIDEO_MODE_PAL 0
|
---|
99 | #define VIDEO_MODE_NTSC 1
|
---|
100 | #define VIDEO_MODE_SECAM 2
|
---|
101 | #define VIDEO_MODE_AUTO 3
|
---|
102 | __u16 signal; /* Signal strength 16bit scale */
|
---|
103 | };
|
---|
104 |
|
---|
105 | struct video_picture
|
---|
106 | {
|
---|
107 | __u16 brightness;
|
---|
108 | __u16 hue;
|
---|
109 | __u16 colour;
|
---|
110 | __u16 contrast;
|
---|
111 | __u16 whiteness; /* Black and white only */
|
---|
112 | __u16 depth; /* Capture depth */
|
---|
113 | __u16 palette; /* Palette in use */
|
---|
114 | #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
|
---|
115 | #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
|
---|
116 | #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
|
---|
117 | #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
|
---|
118 | #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
|
---|
119 | #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
|
---|
120 | #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
|
---|
121 | #define VIDEO_PALETTE_YUYV 8
|
---|
122 | #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
|
---|
123 | #define VIDEO_PALETTE_YUV420 10
|
---|
124 | #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
|
---|
125 | #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
|
---|
126 | #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
|
---|
127 | #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
|
---|
128 | #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
|
---|
129 | #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
|
---|
130 | #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
|
---|
131 | #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
|
---|
132 | };
|
---|
133 |
|
---|
134 | struct video_audio
|
---|
135 | {
|
---|
136 | int audio; /* Audio channel */
|
---|
137 | __u16 volume; /* If settable */
|
---|
138 | __u16 bass, treble;
|
---|
139 | __u32 flags;
|
---|
140 | #define VIDEO_AUDIO_MUTE 1
|
---|
141 | #define VIDEO_AUDIO_MUTABLE 2
|
---|
142 | #define VIDEO_AUDIO_VOLUME 4
|
---|
143 | #define VIDEO_AUDIO_BASS 8
|
---|
144 | #define VIDEO_AUDIO_TREBLE 16
|
---|
145 | char name[16];
|
---|
146 | #define VIDEO_SOUND_MONO 1
|
---|
147 | #define VIDEO_SOUND_STEREO 2
|
---|
148 | #define VIDEO_SOUND_LANG1 4
|
---|
149 | #define VIDEO_SOUND_LANG2 8
|
---|
150 | __u16 mode; /* detected audio carriers or one to set */
|
---|
151 | __u16 balance; /* Stereo balance */
|
---|
152 | __u16 step; /* Step actual volume uses */
|
---|
153 | };
|
---|
154 |
|
---|
155 | struct video_clip
|
---|
156 | {
|
---|
157 | __s32 x,y;
|
---|
158 | __s32 width, height;
|
---|
159 | struct video_clip *next; /* For user use/driver use only */
|
---|
160 | };
|
---|
161 |
|
---|
162 | struct video_window
|
---|
163 | {
|
---|
164 | __u32 x,y; /* Position of window */
|
---|
165 | __u32 width,height; /* Its size */
|
---|
166 | __u32 chromakey;
|
---|
167 | __u32 flags;
|
---|
168 | struct video_clip *clips; /* Set only */
|
---|
169 | int clipcount;
|
---|
170 | #define VIDEO_WINDOW_INTERLACE 1
|
---|
171 | #define VIDEO_CLIP_BITMAP -1
|
---|
172 | /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
|
---|
173 | #define VIDEO_CLIPMAP_SIZE (128 * 625)
|
---|
174 | };
|
---|
175 |
|
---|
176 | struct video_capture
|
---|
177 | {
|
---|
178 | __u32 x,y; /* Offsets into image */
|
---|
179 | __u32 width, height; /* Area to capture */
|
---|
180 | __u16 decimation; /* Decimation divder */
|
---|
181 | __u16 flags; /* Flags for capture */
|
---|
182 | #define VIDEO_CAPTURE_ODD 0 /* Temporal */
|
---|
183 | #define VIDEO_CAPTURE_EVEN 1
|
---|
184 | };
|
---|
185 |
|
---|
186 | struct video_buffer
|
---|
187 | {
|
---|
188 | void *base;
|
---|
189 | int height,width;
|
---|
190 | int depth;
|
---|
191 | int bytesperline;
|
---|
192 | };
|
---|
193 |
|
---|
194 | struct video_mmap
|
---|
195 | {
|
---|
196 | unsigned int frame; /* Frame (0 - n) for double buffer */
|
---|
197 | int height,width;
|
---|
198 | unsigned int format; /* should be VIDEO_PALETTE_* */
|
---|
199 | };
|
---|
200 |
|
---|
201 | struct video_key
|
---|
202 | {
|
---|
203 | __u8 key[8];
|
---|
204 | __u32 flags;
|
---|
205 | };
|
---|
206 |
|
---|
207 |
|
---|
208 | #define VIDEO_MAX_FRAME 32
|
---|
209 |
|
---|
210 | struct video_mbuf
|
---|
211 | {
|
---|
212 | int size; /* Total memory to map */
|
---|
213 | int frames; /* Frames */
|
---|
214 | int offsets[VIDEO_MAX_FRAME];
|
---|
215 | };
|
---|
216 |
|
---|
217 |
|
---|
218 | #define VIDEO_NO_UNIT (-1)
|
---|
219 |
|
---|
220 |
|
---|
221 | struct video_unit
|
---|
222 | {
|
---|
223 | int video; /* Video minor */
|
---|
224 | int vbi; /* VBI minor */
|
---|
225 | int radio; /* Radio minor */
|
---|
226 | int audio; /* Audio minor */
|
---|
227 | int teletext; /* Teletext minor */
|
---|
228 | };
|
---|
229 |
|
---|
230 | #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
|
---|
231 | #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
|
---|
232 | #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
|
---|
233 | #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
|
---|
234 | #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
|
---|
235 | #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
|
---|
236 | #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
|
---|
237 | #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
|
---|
238 | #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
|
---|
239 | #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
|
---|
240 | #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
|
---|
241 | #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
|
---|
242 | #define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
|
---|
243 | #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
|
---|
244 | #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
|
---|
245 | #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
|
---|
246 | #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
|
---|
247 | #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
|
---|
248 | #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
|
---|
249 | #define VIDIOCGMBUF _IOR('v', 20, struct video_mbuf) /* Memory map buffer info */
|
---|
250 | #define VIDIOCGUNIT _IOR('v', 21, struct video_unit) /* Get attached units */
|
---|
251 | #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get frame buffer */
|
---|
252 | #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set frame buffer - root only */
|
---|
253 |
|
---|
254 | #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
|
---|
255 |
|
---|
256 |
|
---|
257 | #define VID_HARDWARE_BT848 1
|
---|
258 | #define VID_HARDWARE_QCAM_BW 2
|
---|
259 | #define VID_HARDWARE_PMS 3
|
---|
260 | #define VID_HARDWARE_QCAM_C 4
|
---|
261 | #define VID_HARDWARE_PSEUDO 5
|
---|
262 | #define VID_HARDWARE_SAA5249 6
|
---|
263 | #define VID_HARDWARE_AZTECH 7
|
---|
264 | #define VID_HARDWARE_SF16MI 8
|
---|
265 | #define VID_HARDWARE_RTRACK 9
|
---|
266 | #define VID_HARDWARE_ZOLTRIX 10
|
---|
267 | #define VID_HARDWARE_SAA7146 11
|
---|
268 | #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
|
---|
269 | #define VID_HARDWARE_RTRACK2 13
|
---|
270 | #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
|
---|
271 | #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
|
---|
272 |
|
---|
273 | /*
|
---|
274 | * Initialiser list
|
---|
275 | */
|
---|
276 |
|
---|
277 | struct video_init
|
---|
278 | {
|
---|
279 | char *name;
|
---|
280 | int (*init)(struct video_init *);
|
---|
281 | };
|
---|
282 |
|
---|
283 | #endif
|
---|