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