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