Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / videodev.h
1 #ifndef __LINUX_VIDEODEV_H
2 #define __LINUX_VIDEODEV_H
3
4 #include <linux/types.h>
5
6 #define HAVE_V4L1 1
7
8 #include <linux/videodev2.h>
9
10 #ifdef __KERNEL__
11
12 #include <linux/mm.h>
13
14 extern struct video_device* video_devdata(struct file*);
15
16 #define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17 static inline void
18 video_device_create_file(struct video_device *vfd,
19                          struct class_device_attribute *attr)
20 {
21         class_device_create_file(&vfd->class_dev, attr);
22 }
23 static inline void
24 video_device_remove_file(struct video_device *vfd,
25                          struct class_device_attribute *attr)
26 {
27         class_device_remove_file(&vfd->class_dev, attr);
28 }
29
30 #if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31 /* helper functions to access driver private data. */
32 static inline void *video_get_drvdata(struct video_device *dev)
33 {
34         return dev->priv;
35 }
36
37 static inline void video_set_drvdata(struct video_device *dev, void *data)
38 {
39         dev->priv = data;
40 }
41 #endif
42
43 extern int video_exclusive_open(struct inode *inode, struct file *file);
44 extern int video_exclusive_release(struct inode *inode, struct file *file);
45 #endif /* __KERNEL__ */
46
47 struct video_capability
48 {
49         char name[32];
50         int type;
51         int channels;   /* Num channels */
52         int audios;     /* Num audio devices */
53         int maxwidth;   /* Supported width */
54         int maxheight;  /* And height */
55         int minwidth;   /* Supported width */
56         int minheight;  /* And height */
57 };
58
59
60 struct video_channel
61 {
62         int channel;
63         char name[32];
64         int tuners;
65         __u32  flags;
66 #define VIDEO_VC_TUNER          1       /* Channel has a tuner */
67 #define VIDEO_VC_AUDIO          2       /* Channel has audio */
68         __u16  type;
69 #define VIDEO_TYPE_TV           1
70 #define VIDEO_TYPE_CAMERA       2
71         __u16 norm;                     /* Norm set by channel */
72 };
73
74 struct video_tuner
75 {
76         int tuner;
77         char name[32];
78         unsigned long rangelow, rangehigh;      /* Tuner range */
79         __u32 flags;
80 #define VIDEO_TUNER_PAL         1
81 #define VIDEO_TUNER_NTSC        2
82 #define VIDEO_TUNER_SECAM       4
83 #define VIDEO_TUNER_LOW         8       /* Uses KHz not MHz */
84 #define VIDEO_TUNER_NORM        16      /* Tuner can set norm */
85 #define VIDEO_TUNER_STEREO_ON   128     /* Tuner is seeing stereo */
86 #define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
87 #define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
88         __u16 mode;                     /* PAL/NTSC/SECAM/OTHER */
89 #define VIDEO_MODE_PAL          0
90 #define VIDEO_MODE_NTSC         1
91 #define VIDEO_MODE_SECAM        2
92 #define VIDEO_MODE_AUTO         3
93         __u16 signal;                   /* Signal strength 16bit scale */
94 };
95
96 struct video_picture
97 {
98         __u16   brightness;
99         __u16   hue;
100         __u16   colour;
101         __u16   contrast;
102         __u16   whiteness;      /* Black and white only */
103         __u16   depth;          /* Capture depth */
104         __u16   palette;        /* Palette in use */
105 #define VIDEO_PALETTE_GREY      1       /* Linear greyscale */
106 #define VIDEO_PALETTE_HI240     2       /* High 240 cube (BT848) */
107 #define VIDEO_PALETTE_RGB565    3       /* 565 16 bit RGB */
108 #define VIDEO_PALETTE_RGB24     4       /* 24bit RGB */
109 #define VIDEO_PALETTE_RGB32     5       /* 32bit RGB */
110 #define VIDEO_PALETTE_RGB555    6       /* 555 15bit RGB */
111 #define VIDEO_PALETTE_YUV422    7       /* YUV422 capture */
112 #define VIDEO_PALETTE_YUYV      8
113 #define VIDEO_PALETTE_UYVY      9       /* The great thing about standards is ... */
114 #define VIDEO_PALETTE_YUV420    10
115 #define VIDEO_PALETTE_YUV411    11      /* YUV411 capture */
116 #define VIDEO_PALETTE_RAW       12      /* RAW capture (BT848) */
117 #define VIDEO_PALETTE_YUV422P   13      /* YUV 4:2:2 Planar */
118 #define VIDEO_PALETTE_YUV411P   14      /* YUV 4:1:1 Planar */
119 #define VIDEO_PALETTE_YUV420P   15      /* YUV 4:2:0 Planar */
120 #define VIDEO_PALETTE_YUV410P   16      /* YUV 4:1:0 Planar */
121 #define VIDEO_PALETTE_PLANAR    13      /* start of planar entries */
122 #define VIDEO_PALETTE_COMPONENT 7       /* start of component entries */
123 };
124
125 struct video_audio
126 {
127         int     audio;          /* Audio channel */
128         __u16   volume;         /* If settable */
129         __u16   bass, treble;
130         __u32   flags;
131 #define VIDEO_AUDIO_MUTE        1
132 #define VIDEO_AUDIO_MUTABLE     2
133 #define VIDEO_AUDIO_VOLUME      4
134 #define VIDEO_AUDIO_BASS        8
135 #define VIDEO_AUDIO_TREBLE      16
136 #define VIDEO_AUDIO_BALANCE     32
137         char    name[16];
138 #define VIDEO_SOUND_MONO        1
139 #define VIDEO_SOUND_STEREO      2
140 #define VIDEO_SOUND_LANG1       4
141 #define VIDEO_SOUND_LANG2       8
142         __u16   mode;
143         __u16   balance;        /* Stereo balance */
144         __u16   step;           /* Step actual volume uses */
145 };
146
147 struct video_clip
148 {
149         __s32   x,y;
150         __s32   width, height;
151         struct  video_clip *next;       /* For user use/driver use only */
152 };
153
154 struct video_window
155 {
156         __u32   x,y;                    /* Position of window */
157         __u32   width,height;           /* Its size */
158         __u32   chromakey;
159         __u32   flags;
160         struct  video_clip __user *clips;       /* Set only */
161         int     clipcount;
162 #define VIDEO_WINDOW_INTERLACE  1
163 #define VIDEO_WINDOW_CHROMAKEY  16      /* Overlay by chromakey */
164 #define VIDEO_CLIP_BITMAP       -1
165 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
166 #define VIDEO_CLIPMAP_SIZE      (128 * 625)
167 };
168
169 struct video_capture
170 {
171         __u32   x,y;                    /* Offsets into image */
172         __u32   width, height;          /* Area to capture */
173         __u16   decimation;             /* Decimation divider */
174         __u16   flags;                  /* Flags for capture */
175 #define VIDEO_CAPTURE_ODD               0       /* Temporal */
176 #define VIDEO_CAPTURE_EVEN              1
177 };
178
179 struct video_buffer
180 {
181         void    *base;
182         int     height,width;
183         int     depth;
184         int     bytesperline;
185 };
186
187 struct video_mmap
188 {
189         unsigned        int frame;              /* Frame (0 - n) for double buffer */
190         int             height,width;
191         unsigned        int format;             /* should be VIDEO_PALETTE_* */
192 };
193
194 struct video_key
195 {
196         __u8    key[8];
197         __u32   flags;
198 };
199
200 struct video_mbuf
201 {
202         int     size;           /* Total memory to map */
203         int     frames;         /* Frames */
204         int     offsets[VIDEO_MAX_FRAME];
205 };
206
207 #define         VIDEO_NO_UNIT   (-1)
208
209 struct video_unit
210 {
211         int     video;          /* Video minor */
212         int     vbi;            /* VBI minor */
213         int     radio;          /* Radio minor */
214         int     audio;          /* Audio minor */
215         int     teletext;       /* Teletext minor */
216 };
217
218 struct vbi_format {
219         __u32   sampling_rate;  /* in Hz */
220         __u32   samples_per_line;
221         __u32   sample_format;  /* VIDEO_PALETTE_RAW only (1 byte) */
222         __s32   start[2];       /* starting line for each frame */
223         __u32   count[2];       /* count of lines for each frame */
224         __u32   flags;
225 #define VBI_UNSYNC      1       /* can distingues between top/bottom field */
226 #define VBI_INTERLACED  2       /* lines are interlaced */
227 };
228
229 /* video_info is biased towards hardware mpeg encode/decode */
230 /* but it could apply generically to any hardware compressor/decompressor */
231 struct video_info
232 {
233         __u32   frame_count;    /* frames output since decode/encode began */
234         __u32   h_size;         /* current unscaled horizontal size */
235         __u32   v_size;         /* current unscaled veritcal size */
236         __u32   smpte_timecode; /* current SMPTE timecode (for current GOP) */
237         __u32   picture_type;   /* current picture type */
238         __u32   temporal_reference;     /* current temporal reference */
239         __u8    user_data[256]; /* user data last found in compressed stream */
240         /* user_data[0] contains user data flags, user_data[1] has count */
241 };
242
243 /* generic structure for setting playback modes */
244 struct video_play_mode
245 {
246         int     mode;
247         int     p1;
248         int     p2;
249 };
250
251 /* for loading microcode / fpga programming */
252 struct video_code
253 {
254         char    loadwhat[16];   /* name or tag of file being passed */
255         int     datasize;
256         __u8    *data;
257 };
258
259 #define VIDIOCGCAP              _IOR('v',1,struct video_capability)     /* Get capabilities */
260 #define VIDIOCGCHAN             _IOWR('v',2,struct video_channel)       /* Get channel info (sources) */
261 #define VIDIOCSCHAN             _IOW('v',3,struct video_channel)        /* Set channel  */
262 #define VIDIOCGTUNER            _IOWR('v',4,struct video_tuner)         /* Get tuner abilities */
263 #define VIDIOCSTUNER            _IOW('v',5,struct video_tuner)          /* Tune the tuner for the current channel */
264 #define VIDIOCGPICT             _IOR('v',6,struct video_picture)        /* Get picture properties */
265 #define VIDIOCSPICT             _IOW('v',7,struct video_picture)        /* Set picture properties */
266 #define VIDIOCCAPTURE           _IOW('v',8,int)                         /* Start, end capture */
267 #define VIDIOCGWIN              _IOR('v',9, struct video_window)        /* Get the video overlay window */
268 #define VIDIOCSWIN              _IOW('v',10, struct video_window)       /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
269 #define VIDIOCGFBUF             _IOR('v',11, struct video_buffer)       /* Get frame buffer */
270 #define VIDIOCSFBUF             _IOW('v',12, struct video_buffer)       /* Set frame buffer - root only */
271 #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) */
272 #define VIDIOCGFREQ             _IOR('v',14, unsigned long)             /* Set tuner */
273 #define VIDIOCSFREQ             _IOW('v',15, unsigned long)             /* Set tuner */
274 #define VIDIOCGAUDIO            _IOR('v',16, struct video_audio)        /* Get audio info */
275 #define VIDIOCSAUDIO            _IOW('v',17, struct video_audio)        /* Audio source, mute etc */
276 #define VIDIOCSYNC              _IOW('v',18, int)                       /* Sync with mmap grabbing */
277 #define VIDIOCMCAPTURE          _IOW('v',19, struct video_mmap)         /* Grab frames */
278 #define VIDIOCGMBUF             _IOR('v',20, struct video_mbuf)         /* Memory map buffer info */
279 #define VIDIOCGUNIT             _IOR('v',21, struct video_unit)         /* Get attached units */
280 #define VIDIOCGCAPTURE          _IOR('v',22, struct video_capture)      /* Get subcapture */
281 #define VIDIOCSCAPTURE          _IOW('v',23, struct video_capture)      /* Set subcapture */
282 #define VIDIOCSPLAYMODE         _IOW('v',24, struct video_play_mode)    /* Set output video mode/feature */
283 #define VIDIOCSWRITEMODE        _IOW('v',25, int)                       /* Set write mode */
284 #define VIDIOCGPLAYINFO         _IOR('v',26, struct video_info)         /* Get current playback info from hardware */
285 #define VIDIOCSMICROCODE        _IOW('v',27, struct video_code)         /* Load microcode into hardware */
286 #define VIDIOCGVBIFMT           _IOR('v',28, struct vbi_format)         /* Get VBI information */
287 #define VIDIOCSVBIFMT           _IOW('v',29, struct vbi_format)         /* Set VBI information */
288
289
290 #define BASE_VIDIOCPRIVATE      192             /* 192-255 are private */
291
292 /* VIDIOCSWRITEMODE */
293 #define VID_WRITE_MPEG_AUD              0
294 #define VID_WRITE_MPEG_VID              1
295 #define VID_WRITE_OSD                   2
296 #define VID_WRITE_TTX                   3
297 #define VID_WRITE_CC                    4
298 #define VID_WRITE_MJPEG                 5
299
300 /* VIDIOCSPLAYMODE */
301 #define VID_PLAY_VID_OUT_MODE           0
302         /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
303 #define VID_PLAY_GENLOCK                1
304         /* p1: 0 = OFF, 1 = ON */
305         /* p2: GENLOCK FINE DELAY value */
306 #define VID_PLAY_NORMAL                 2
307 #define VID_PLAY_PAUSE                  3
308 #define VID_PLAY_SINGLE_FRAME           4
309 #define VID_PLAY_FAST_FORWARD           5
310 #define VID_PLAY_SLOW_MOTION            6
311 #define VID_PLAY_IMMEDIATE_NORMAL       7
312 #define VID_PLAY_SWITCH_CHANNELS        8
313 #define VID_PLAY_FREEZE_FRAME           9
314 #define VID_PLAY_STILL_MODE             10
315 #define VID_PLAY_MASTER_MODE            11
316         /* p1: see below */
317 #define         VID_PLAY_MASTER_NONE    1
318 #define         VID_PLAY_MASTER_VIDEO   2
319 #define         VID_PLAY_MASTER_AUDIO   3
320 #define VID_PLAY_ACTIVE_SCANLINES       12
321         /* p1 = first active; p2 = last active */
322 #define VID_PLAY_RESET                  13
323 #define VID_PLAY_END_MARK               14
324
325
326
327 #define VID_HARDWARE_BT848      1
328 #define VID_HARDWARE_QCAM_BW    2
329 #define VID_HARDWARE_PMS        3
330 #define VID_HARDWARE_QCAM_C     4
331 #define VID_HARDWARE_PSEUDO     5
332 #define VID_HARDWARE_SAA5249    6
333 #define VID_HARDWARE_AZTECH     7
334 #define VID_HARDWARE_SF16MI     8
335 #define VID_HARDWARE_RTRACK     9
336 #define VID_HARDWARE_ZOLTRIX    10
337 #define VID_HARDWARE_SAA7146    11
338 #define VID_HARDWARE_VIDEUM     12      /* Reserved for Winnov videum */
339 #define VID_HARDWARE_RTRACK2    13
340 #define VID_HARDWARE_PERMEDIA2  14      /* Reserved for Permedia2 */
341 #define VID_HARDWARE_RIVA128    15      /* Reserved for RIVA 128 */
342 #define VID_HARDWARE_PLANB      16      /* PowerMac motherboard video-in */
343 #define VID_HARDWARE_BROADWAY   17      /* Broadway project */
344 #define VID_HARDWARE_GEMTEK     18
345 #define VID_HARDWARE_TYPHOON    19
346 #define VID_HARDWARE_VINO       20      /* SGI Indy Vino */
347 #define VID_HARDWARE_CADET      21      /* Cadet radio */
348 #define VID_HARDWARE_TRUST      22      /* Trust FM Radio */
349 #define VID_HARDWARE_TERRATEC   23      /* TerraTec ActiveRadio */
350 #define VID_HARDWARE_CPIA       24
351 #define VID_HARDWARE_ZR36120    25      /* Zoran ZR36120/ZR36125 */
352 #define VID_HARDWARE_ZR36067    26      /* Zoran ZR36067/36060 */
353 #define VID_HARDWARE_OV511      27
354 #define VID_HARDWARE_ZR356700   28      /* Zoran 36700 series */
355 #define VID_HARDWARE_W9966      29
356 #define VID_HARDWARE_SE401      30      /* SE401 USB webcams */
357 #define VID_HARDWARE_PWC        31      /* Philips webcams */
358 #define VID_HARDWARE_MEYE       32      /* Sony Vaio MotionEye cameras */
359 #define VID_HARDWARE_CPIA2      33
360 #define VID_HARDWARE_VICAM      34
361 #define VID_HARDWARE_SF16FMR2   35
362 #define VID_HARDWARE_W9968CF    36
363 #define VID_HARDWARE_SAA7114H   37
364 #define VID_HARDWARE_SN9C102    38
365 #define VID_HARDWARE_ARV        39
366 #endif /* __LINUX_VIDEODEV_H */
367
368 /*
369  * Local variables:
370  * c-basic-offset: 8
371  * End:
372  */