Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / include / linux / videodev.h
blob7a73db598fa6f7464db6c88a055609b24e15b3e8
1 #ifndef __LINUX_VIDEODEV_H
2 #define __LINUX_VIDEODEV_H
4 #include <linux/types.h>
5 #include <linux/version.h>
7 #ifdef __KERNEL__
9 #if LINUX_VERSION_CODE >= 0x020100
10 #include <linux/poll.h>
11 #endif
12 #include <linux/devfs_fs_kernel.h>
14 struct video_device
16 char name[32];
17 int type;
18 int hardware;
20 int (*open)(struct video_device *, int mode);
21 void (*close)(struct video_device *);
22 long (*read)(struct video_device *, char *, unsigned long, int noblock);
23 /* Do we need a write method ? */
24 long (*write)(struct video_device *, const char *, unsigned long, int noblock);
25 #if LINUX_VERSION_CODE >= 0x020100
26 unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
27 #endif
28 int (*ioctl)(struct video_device *, unsigned int , void *);
29 int (*mmap)(struct video_device *, const char *, unsigned long);
30 int (*initialize)(struct video_device *);
31 void *priv; /* Used to be 'private' but that upsets C++ */
32 int busy;
33 int minor;
34 devfs_handle_t devfs_handle;
37 extern int videodev_init(void);
38 #define VIDEO_MAJOR 81
39 extern int video_register_device(struct video_device *, int type);
41 #define VFL_TYPE_GRABBER 0
42 #define VFL_TYPE_VBI 1
43 #define VFL_TYPE_RADIO 2
44 #define VFL_TYPE_VTX 3
46 extern void video_unregister_device(struct video_device *);
47 #endif
50 #define VID_TYPE_CAPTURE 1 /* Can capture */
51 #define VID_TYPE_TUNER 2 /* Can tune */
52 #define VID_TYPE_TELETEXT 4 /* Does teletext */
53 #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
54 #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
55 #define VID_TYPE_CLIPPING 32 /* Can clip */
56 #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
57 #define VID_TYPE_SCALES 128 /* Scalable */
58 #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
59 #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
60 #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
61 #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
62 #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
63 #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
65 struct video_capability
67 char name[32];
68 int type;
69 int channels; /* Num channels */
70 int audios; /* Num audio devices */
71 int maxwidth; /* Supported width */
72 int maxheight; /* And height */
73 int minwidth; /* Supported width */
74 int minheight; /* And height */
78 struct video_channel
80 int channel;
81 char name[32];
82 int tuners;
83 __u32 flags;
84 #define VIDEO_VC_TUNER 1 /* Channel has a tuner */
85 #define VIDEO_VC_AUDIO 2 /* Channel has audio */
86 __u16 type;
87 #define VIDEO_TYPE_TV 1
88 #define VIDEO_TYPE_CAMERA 2
89 __u16 norm; /* Norm set by channel */
92 struct video_tuner
94 int tuner;
95 char name[32];
96 ulong rangelow, rangehigh; /* Tuner range */
97 __u32 flags;
98 #define VIDEO_TUNER_PAL 1
99 #define VIDEO_TUNER_NTSC 2
100 #define VIDEO_TUNER_SECAM 4
101 #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
102 #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
103 #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
104 #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
105 #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
106 __u16 mode; /* PAL/NTSC/SECAM/OTHER */
107 #define VIDEO_MODE_PAL 0
108 #define VIDEO_MODE_NTSC 1
109 #define VIDEO_MODE_SECAM 2
110 #define VIDEO_MODE_AUTO 3
111 __u16 signal; /* Signal strength 16bit scale */
114 struct video_picture
116 __u16 brightness;
117 __u16 hue;
118 __u16 colour;
119 __u16 contrast;
120 __u16 whiteness; /* Black and white only */
121 __u16 depth; /* Capture depth */
122 __u16 palette; /* Palette in use */
123 #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
124 #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
125 #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
126 #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
127 #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
128 #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
129 #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
130 #define VIDEO_PALETTE_YUYV 8
131 #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
132 #define VIDEO_PALETTE_YUV420 10
133 #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
134 #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
135 #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
136 #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
137 #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
138 #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
139 #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
140 #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
143 struct video_audio
145 int audio; /* Audio channel */
146 __u16 volume; /* If settable */
147 __u16 bass, treble;
148 __u32 flags;
149 #define VIDEO_AUDIO_MUTE 1
150 #define VIDEO_AUDIO_MUTABLE 2
151 #define VIDEO_AUDIO_VOLUME 4
152 #define VIDEO_AUDIO_BASS 8
153 #define VIDEO_AUDIO_TREBLE 16
154 char name[16];
155 #define VIDEO_SOUND_MONO 1
156 #define VIDEO_SOUND_STEREO 2
157 #define VIDEO_SOUND_LANG1 4
158 #define VIDEO_SOUND_LANG2 8
159 __u16 mode;
160 __u16 balance; /* Stereo balance */
161 __u16 step; /* Step actual volume uses */
164 struct video_clip
166 __s32 x,y;
167 __s32 width, height;
168 struct video_clip *next; /* For user use/driver use only */
171 struct video_window
173 __u32 x,y; /* Position of window */
174 __u32 width,height; /* Its size */
175 __u32 chromakey;
176 __u32 flags;
177 struct video_clip *clips; /* Set only */
178 int clipcount;
179 #define VIDEO_WINDOW_INTERLACE 1
180 #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
181 #define VIDEO_CLIP_BITMAP -1
182 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
183 #define VIDEO_CLIPMAP_SIZE (128 * 625)
186 struct video_capture
188 __u32 x,y; /* Offsets into image */
189 __u32 width, height; /* Area to capture */
190 __u16 decimation; /* Decimation divder */
191 __u16 flags; /* Flags for capture */
192 #define VIDEO_CAPTURE_ODD 0 /* Temporal */
193 #define VIDEO_CAPTURE_EVEN 1
196 struct video_buffer
198 void *base;
199 int height,width;
200 int depth;
201 int bytesperline;
204 struct video_mmap
206 unsigned int frame; /* Frame (0 - n) for double buffer */
207 int height,width;
208 unsigned int format; /* should be VIDEO_PALETTE_* */
211 struct video_key
213 __u8 key[8];
214 __u32 flags;
218 #define VIDEO_MAX_FRAME 32
220 struct video_mbuf
222 int size; /* Total memory to map */
223 int frames; /* Frames */
224 int offsets[VIDEO_MAX_FRAME];
228 #define VIDEO_NO_UNIT (-1)
231 struct video_unit
233 int video; /* Video minor */
234 int vbi; /* VBI minor */
235 int radio; /* Radio minor */
236 int audio; /* Audio minor */
237 int teletext; /* Teletext minor */
240 struct vbi_format {
241 __u32 sampling_rate; /* in Hz */
242 __u32 samples_per_line;
243 __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
244 __s32 start[2]; /* starting line for each frame */
245 __u32 count[2]; /* count of lines for each frame */
246 __u32 flags;
247 #define VBI_UNSYNC 1 /* can distingues between top/bottom field */
248 #define VBI_INTERLACED 2 /* lines are interlaced */
251 /* video_info is biased towards hardware mpeg encode/decode */
252 /* but it could apply generically to any hardware compressor/decompressor */
253 struct video_info
255 __u32 frame_count; /* frames output since decode/encode began */
256 __u32 h_size; /* current unscaled horizontal size */
257 __u32 v_size; /* current unscaled veritcal size */
258 __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
259 __u32 picture_type; /* current picture type */
260 __u32 temporal_reference; /* current temporal reference */
261 __u8 user_data[256]; /* user data last found in compressed stream */
262 /* user_data[0] contains user data flags, user_data[1] has count */
265 /* generic structure for setting playback modes */
266 struct video_play_mode
268 int mode;
269 int p1;
270 int p2;
273 /* for loading microcode / fpga programming */
274 struct video_code
276 char loadwhat[16]; /* name or tag of file being passed */
277 int datasize;
278 __u8 *data;
281 #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
282 #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
283 #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
284 #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
285 #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
286 #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
287 #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
288 #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
289 #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
290 #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
291 #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
292 #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
293 #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) */
294 #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
295 #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
296 #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
297 #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
298 #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
299 #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
300 #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
301 #define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
302 #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
303 #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
304 #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
305 #define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
306 #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
307 #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
308 #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
309 #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
312 #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
314 /* VIDIOCSWRITEMODE */
315 #define VID_WRITE_MPEG_AUD 0
316 #define VID_WRITE_MPEG_VID 1
317 #define VID_WRITE_OSD 2
318 #define VID_WRITE_TTX 3
319 #define VID_WRITE_CC 4
320 #define VID_WRITE_MJPEG 5
322 /* VIDIOCSPLAYMODE */
323 #define VID_PLAY_VID_OUT_MODE 0
324 /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
325 #define VID_PLAY_GENLOCK 1
326 /* p1: 0 = OFF, 1 = ON */
327 /* p2: GENLOCK FINE DELAY value */
328 #define VID_PLAY_NORMAL 2
329 #define VID_PLAY_PAUSE 3
330 #define VID_PLAY_SINGLE_FRAME 4
331 #define VID_PLAY_FAST_FORWARD 5
332 #define VID_PLAY_SLOW_MOTION 6
333 #define VID_PLAY_IMMEDIATE_NORMAL 7
334 #define VID_PLAY_SWITCH_CHANNELS 8
335 #define VID_PLAY_FREEZE_FRAME 9
336 #define VID_PLAY_STILL_MODE 10
337 #define VID_PLAY_MASTER_MODE 11
338 /* p1: see below */
339 #define VID_PLAY_MASTER_NONE 1
340 #define VID_PLAY_MASTER_VIDEO 2
341 #define VID_PLAY_MASTER_AUDIO 3
342 #define VID_PLAY_ACTIVE_SCANLINES 12
343 /* p1 = first active; p2 = last active */
344 #define VID_PLAY_RESET 13
345 #define VID_PLAY_END_MARK 14
349 #define VID_HARDWARE_BT848 1
350 #define VID_HARDWARE_QCAM_BW 2
351 #define VID_HARDWARE_PMS 3
352 #define VID_HARDWARE_QCAM_C 4
353 #define VID_HARDWARE_PSEUDO 5
354 #define VID_HARDWARE_SAA5249 6
355 #define VID_HARDWARE_AZTECH 7
356 #define VID_HARDWARE_SF16MI 8
357 #define VID_HARDWARE_RTRACK 9
358 #define VID_HARDWARE_ZOLTRIX 10
359 #define VID_HARDWARE_SAA7146 11
360 #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
361 #define VID_HARDWARE_RTRACK2 13
362 #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
363 #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
364 #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
365 #define VID_HARDWARE_BROADWAY 17 /* Broadway project */
366 #define VID_HARDWARE_GEMTEK 18
367 #define VID_HARDWARE_TYPHOON 19
368 #define VID_HARDWARE_VINO 20 /* SGI Indy Vino */
369 #define VID_HARDWARE_CADET 21 /* Cadet radio */
370 #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */
371 #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */
372 #define VID_HARDWARE_CPIA 24
373 #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */
374 #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */
375 #define VID_HARDWARE_OV511 27
376 #define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */
379 * Initialiser list
382 struct video_init
384 char *name;
385 int (*init)(struct video_init *);
388 #endif