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