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