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