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