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