1 #ifndef __LINUX_VIDEODEV_H
2 #define __LINUX_VIDEODEV_H
4 #include <linux/types.h>
5 #include <linux/version.h>
9 * v4l2 is still work-in-progress, integration planed for 2.5.x
10 * v4l2 project homepage: http://www.thedirks.org/v4l2/
11 * patches available from: http://bytesex.org/patches/
14 # include <linux/videodev2.h>
21 #include <linux/poll.h>
22 #include <linux/devfs_fs_kernel.h>
33 /* old, obsolete interface -- dropped in 2.5.x, don't use it */
34 int (*open)(struct video_device *, int mode);
35 void (*close)(struct video_device *);
36 long (*read)(struct video_device *, char *, unsigned long, int noblock);
37 long (*write)(struct video_device *, const char *, unsigned long, int noblock);
38 unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
39 int (*ioctl)(struct video_device *, unsigned int , void *);
40 int (*mmap)(struct video_device *, const char *, unsigned long);
41 int (*initialize)(struct video_device *);
43 /* new interface -- we will use file_operations directly
44 * like soundcore does. */
45 struct file_operations *fops;
46 void *priv; /* Used to be 'private' but that upsets C++ */
48 /* for videodev.c intenal usage -- don't touch */
50 struct semaphore lock;
51 devfs_handle_t devfs_handle;
54 #define VIDEO_MAJOR 81
55 extern int video_register_device(struct video_device *, int type, int nr);
57 #define VFL_TYPE_GRABBER 0
58 #define VFL_TYPE_VBI 1
59 #define VFL_TYPE_RADIO 2
60 #define VFL_TYPE_VTX 3
62 extern void video_unregister_device(struct video_device *);
63 extern struct video_device* video_devdata(struct file*);
65 extern int video_exclusive_open(struct inode *inode, struct file *file);
66 extern int video_exclusive_release(struct inode *inode, struct file *file);
67 extern int video_usercopy(struct inode *inode, struct file *file,
68 unsigned int cmd, unsigned long arg,
69 int (*func)(struct inode *inode, struct file *file,
70 unsigned int cmd, void *arg));
71 #endif /* __KERNEL__ */
73 #define VID_TYPE_CAPTURE 1 /* Can capture */
74 #define VID_TYPE_TUNER 2 /* Can tune */
75 #define VID_TYPE_TELETEXT 4 /* Does teletext */
76 #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
77 #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
78 #define VID_TYPE_CLIPPING 32 /* Can clip */
79 #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
80 #define VID_TYPE_SCALES 128 /* Scalable */
81 #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
82 #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
83 #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
84 #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
85 #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
86 #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
88 struct video_capability
92 int channels; /* Num channels */
93 int audios; /* Num audio devices */
94 int maxwidth; /* Supported width */
95 int maxheight; /* And height */
96 int minwidth; /* Supported width */
97 int minheight; /* And height */
107 #define VIDEO_VC_TUNER 1 /* Channel has a tuner */
108 #define VIDEO_VC_AUDIO 2 /* Channel has audio */
110 #define VIDEO_TYPE_TV 1
111 #define VIDEO_TYPE_CAMERA 2
112 __u16 norm; /* Norm set by channel */
119 unsigned long rangelow, rangehigh; /* Tuner range */
121 #define VIDEO_TUNER_PAL 1
122 #define VIDEO_TUNER_NTSC 2
123 #define VIDEO_TUNER_SECAM 4
124 #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
125 #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
126 #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
127 #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
128 #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
129 __u16 mode; /* PAL/NTSC/SECAM/OTHER */
130 #define VIDEO_MODE_PAL 0
131 #define VIDEO_MODE_NTSC 1
132 #define VIDEO_MODE_SECAM 2
133 #define VIDEO_MODE_AUTO 3
134 __u16 signal; /* Signal strength 16bit scale */
143 __u16 whiteness; /* Black and white only */
144 __u16 depth; /* Capture depth */
145 __u16 palette; /* Palette in use */
146 #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
147 #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
148 #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
149 #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
150 #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
151 #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
152 #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
153 #define VIDEO_PALETTE_YUYV 8
154 #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
155 #define VIDEO_PALETTE_YUV420 10
156 #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
157 #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
158 #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
159 #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
160 #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
161 #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
162 #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
163 #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
168 int audio; /* Audio channel */
169 __u16 volume; /* If settable */
172 #define VIDEO_AUDIO_MUTE 1
173 #define VIDEO_AUDIO_MUTABLE 2
174 #define VIDEO_AUDIO_VOLUME 4
175 #define VIDEO_AUDIO_BASS 8
176 #define VIDEO_AUDIO_TREBLE 16
177 #define VIDEO_AUDIO_BALANCE 32
179 #define VIDEO_SOUND_MONO 1
180 #define VIDEO_SOUND_STEREO 2
181 #define VIDEO_SOUND_LANG1 4
182 #define VIDEO_SOUND_LANG2 8
184 __u16 balance; /* Stereo balance */
185 __u16 step; /* Step actual volume uses */
192 struct video_clip *next; /* For user use/driver use only */
197 __u32 x,y; /* Position of window */
198 __u32 width,height; /* Its size */
201 struct video_clip *clips; /* Set only */
203 #define VIDEO_WINDOW_INTERLACE 1
204 #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
205 #define VIDEO_CLIP_BITMAP -1
206 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
207 #define VIDEO_CLIPMAP_SIZE (128 * 625)
212 __u32 x,y; /* Offsets into image */
213 __u32 width, height; /* Area to capture */
214 __u16 decimation; /* Decimation divider */
215 __u16 flags; /* Flags for capture */
216 #define VIDEO_CAPTURE_ODD 0 /* Temporal */
217 #define VIDEO_CAPTURE_EVEN 1
230 unsigned int frame; /* Frame (0 - n) for double buffer */
232 unsigned int format; /* should be VIDEO_PALETTE_* */
242 #define VIDEO_MAX_FRAME 32
246 int size; /* Total memory to map */
247 int frames; /* Frames */
248 int offsets[VIDEO_MAX_FRAME];
252 #define VIDEO_NO_UNIT (-1)
257 int video; /* Video minor */
258 int vbi; /* VBI minor */
259 int radio; /* Radio minor */
260 int audio; /* Audio minor */
261 int teletext; /* Teletext minor */
265 __u32 sampling_rate; /* in Hz */
266 __u32 samples_per_line;
267 __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
268 __s32 start[2]; /* starting line for each frame */
269 __u32 count[2]; /* count of lines for each frame */
271 #define VBI_UNSYNC 1 /* can distingues between top/bottom field */
272 #define VBI_INTERLACED 2 /* lines are interlaced */
275 /* video_info is biased towards hardware mpeg encode/decode */
276 /* but it could apply generically to any hardware compressor/decompressor */
279 __u32 frame_count; /* frames output since decode/encode began */
280 __u32 h_size; /* current unscaled horizontal size */
281 __u32 v_size; /* current unscaled veritcal size */
282 __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
283 __u32 picture_type; /* current picture type */
284 __u32 temporal_reference; /* current temporal reference */
285 __u8 user_data[256]; /* user data last found in compressed stream */
286 /* user_data[0] contains user data flags, user_data[1] has count */
289 /* generic structure for setting playback modes */
290 struct video_play_mode
297 /* for loading microcode / fpga programming */
300 char loadwhat[16]; /* name or tag of file being passed */
305 #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
306 #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
307 #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
308 #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
309 #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
310 #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
311 #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
312 #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
313 #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
314 #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
315 #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
316 #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
317 #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) */
318 #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
319 #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
320 #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
321 #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
322 #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
323 #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
324 #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
325 #define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
326 #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
327 #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
328 #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
329 #define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
330 #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
331 #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
332 #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
333 #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
336 #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
338 /* VIDIOCSWRITEMODE */
339 #define VID_WRITE_MPEG_AUD 0
340 #define VID_WRITE_MPEG_VID 1
341 #define VID_WRITE_OSD 2
342 #define VID_WRITE_TTX 3
343 #define VID_WRITE_CC 4
344 #define VID_WRITE_MJPEG 5
346 /* VIDIOCSPLAYMODE */
347 #define VID_PLAY_VID_OUT_MODE 0
348 /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
349 #define VID_PLAY_GENLOCK 1
350 /* p1: 0 = OFF, 1 = ON */
351 /* p2: GENLOCK FINE DELAY value */
352 #define VID_PLAY_NORMAL 2
353 #define VID_PLAY_PAUSE 3
354 #define VID_PLAY_SINGLE_FRAME 4
355 #define VID_PLAY_FAST_FORWARD 5
356 #define VID_PLAY_SLOW_MOTION 6
357 #define VID_PLAY_IMMEDIATE_NORMAL 7
358 #define VID_PLAY_SWITCH_CHANNELS 8
359 #define VID_PLAY_FREEZE_FRAME 9
360 #define VID_PLAY_STILL_MODE 10
361 #define VID_PLAY_MASTER_MODE 11
363 #define VID_PLAY_MASTER_NONE 1
364 #define VID_PLAY_MASTER_VIDEO 2
365 #define VID_PLAY_MASTER_AUDIO 3
366 #define VID_PLAY_ACTIVE_SCANLINES 12
367 /* p1 = first active; p2 = last active */
368 #define VID_PLAY_RESET 13
369 #define VID_PLAY_END_MARK 14
373 #define VID_HARDWARE_BT848 1
374 #define VID_HARDWARE_QCAM_BW 2
375 #define VID_HARDWARE_PMS 3
376 #define VID_HARDWARE_QCAM_C 4
377 #define VID_HARDWARE_PSEUDO 5
378 #define VID_HARDWARE_SAA5249 6
379 #define VID_HARDWARE_AZTECH 7
380 #define VID_HARDWARE_SF16MI 8
381 #define VID_HARDWARE_RTRACK 9
382 #define VID_HARDWARE_ZOLTRIX 10
383 #define VID_HARDWARE_SAA7146 11
384 #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */
385 #define VID_HARDWARE_RTRACK2 13
386 #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */
387 #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */
388 #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */
389 #define VID_HARDWARE_BROADWAY 17 /* Broadway project */
390 #define VID_HARDWARE_GEMTEK 18
391 #define VID_HARDWARE_TYPHOON 19
392 #define VID_HARDWARE_VINO 20 /* SGI Indy Vino */
393 #define VID_HARDWARE_CADET 21 /* Cadet radio */
394 #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */
395 #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */
396 #define VID_HARDWARE_CPIA 24
397 #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */
398 #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */
399 #define VID_HARDWARE_OV511 27
400 #define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */
401 #define VID_HARDWARE_W9966 29
402 #define VID_HARDWARE_SE401 30 /* SE401 USB webcams */
403 #define VID_HARDWARE_PWC 31 /* Philips webcams */
404 #define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */
405 #define VID_HARDWARE_CPIA2 33
406 #define VID_HARDWARE_VICAM 34 /* ViCam, 3Com Homeconnect */
407 #define VID_HARDWARE_SF16FMR2 35
409 #endif /* __LINUX_VIDEODEV_H */