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