Rev 604 | Rev 616 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
603 | giacomo | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Giacomo Guidi <giacomo@gandalf.sssup.it> |
||
10 | * |
||
11 | * |
||
12 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
13 | * |
||
14 | * http://www.sssup.it |
||
15 | * http://retis.sssup.it |
||
16 | * http://shark.sssup.it |
||
17 | */ |
||
18 | |||
19 | /* Linux 2.6 Emulation Library Header */ |
||
20 | |||
21 | #ifndef __SHARK_VIDEODEV26__ |
||
22 | #define __SHARK_VIDEODEV26__ |
||
23 | |||
606 | giacomo | 24 | #include <ll/sys/types.h> |
25 | |||
26 | #define __u8 unsigned char |
||
27 | #define __u32 unsigned int |
||
28 | #define __u16 unsigned short int |
||
29 | #define __s32 int |
||
30 | #define __s16 short int |
||
31 | #define __s8 char |
||
32 | |||
33 | #define _IOC_NONE 0U |
||
34 | #define _IOC_WRITE 1U |
||
35 | #define _IOC_READ 2U |
||
36 | |||
37 | #define _IOC_TYPECHECK(t) (sizeof(t)) |
||
38 | |||
39 | #define _IOC_NRBITS 8 |
||
40 | #define _IOC_TYPEBITS 8 |
||
41 | #define _IOC_SIZEBITS 14 |
||
42 | #define _IOC_DIRBITS 2 |
||
43 | |||
44 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) |
||
45 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) |
||
46 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) |
||
47 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) |
||
48 | |||
49 | #define _IOC_NRSHIFT 0 |
||
50 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) |
||
51 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) |
||
52 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) |
||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ |
||
55 | (((dir) << _IOC_DIRSHIFT) | \ |
||
56 | ((type) << _IOC_TYPESHIFT) | \ |
||
57 | ((nr) << _IOC_NRSHIFT) | \ |
||
58 | ((size) << _IOC_SIZESHIFT)) |
||
59 | |||
60 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) |
||
61 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) |
||
62 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) |
||
63 | |||
64 | #define VIDEO_MAJOR 81 |
||
65 | |||
66 | #define VFL_TYPE_GRABBER 0 |
||
67 | #define VFL_TYPE_VBI 1 |
||
68 | #define VFL_TYPE_RADIO 2 |
||
69 | #define VFL_TYPE_VTX 3 |
||
70 | |||
71 | #define VID_TYPE_CAPTURE 1 /* Can capture */ |
||
72 | #define VID_TYPE_TUNER 2 /* Can tune */ |
||
73 | #define VID_TYPE_TELETEXT 4 /* Does teletext */ |
||
74 | #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ |
||
75 | #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ |
||
76 | #define VID_TYPE_CLIPPING 32 /* Can clip */ |
||
77 | #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ |
||
78 | #define VID_TYPE_SCALES 128 /* Scalable */ |
||
79 | #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ |
||
80 | #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ |
||
81 | #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ |
||
82 | #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ |
||
83 | #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ |
||
84 | #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ |
||
85 | |||
86 | struct video_capability |
||
87 | { |
||
88 | char name[32]; |
||
89 | int type; |
||
90 | int channels; /* Num channels */ |
||
91 | int audios; /* Num audio devices */ |
||
92 | int maxwidth; /* Supported width */ |
||
93 | int maxheight; /* And height */ |
||
94 | int minwidth; /* Supported width */ |
||
95 | int minheight; /* And height */ |
||
96 | }; |
||
97 | |||
98 | |||
99 | struct video_channel |
||
100 | { |
||
101 | int channel; |
||
102 | char name[32]; |
||
103 | int tuners; |
||
104 | __u32 flags; |
||
105 | #define VIDEO_VC_TUNER 1 /* Channel has a tuner */ |
||
106 | #define VIDEO_VC_AUDIO 2 /* Channel has audio */ |
||
107 | __u16 type; |
||
108 | #define VIDEO_TYPE_TV 1 |
||
109 | #define VIDEO_TYPE_CAMERA 2 |
||
110 | __u16 norm; /* Norm set by channel */ |
||
111 | }; |
||
112 | |||
113 | struct video_tuner |
||
114 | { |
||
115 | int tuner; |
||
116 | char name[32]; |
||
117 | unsigned long rangelow, rangehigh; /* Tuner range */ |
||
118 | __u32 flags; |
||
119 | #define VIDEO_TUNER_PAL 1 |
||
120 | #define VIDEO_TUNER_NTSC 2 |
||
121 | #define VIDEO_TUNER_SECAM 4 |
||
122 | #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ |
||
123 | #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ |
||
124 | #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ |
||
125 | #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ |
||
126 | #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ |
||
127 | __u16 mode; /* PAL/NTSC/SECAM/OTHER */ |
||
128 | #define VIDEO_MODE_PAL 0 |
||
129 | #define VIDEO_MODE_NTSC 1 |
||
130 | #define VIDEO_MODE_SECAM 2 |
||
131 | #define VIDEO_MODE_AUTO 3 |
||
132 | __u16 signal; /* Signal strength 16bit scale */ |
||
133 | }; |
||
134 | |||
135 | struct video_picture |
||
136 | { |
||
137 | __u16 brightness; |
||
138 | __u16 hue; |
||
139 | __u16 colour; |
||
140 | __u16 contrast; |
||
141 | __u16 whiteness; /* Black and white only */ |
||
142 | __u16 depth; /* Capture depth */ |
||
143 | __u16 palette; /* Palette in use */ |
||
144 | #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ |
||
145 | #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ |
||
146 | #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ |
||
147 | #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ |
||
148 | #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ |
||
149 | #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ |
||
150 | #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ |
||
151 | #define VIDEO_PALETTE_YUYV 8 |
||
152 | #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ |
||
153 | #define VIDEO_PALETTE_YUV420 10 |
||
154 | #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ |
||
155 | #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ |
||
156 | #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ |
||
157 | #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ |
||
158 | #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ |
||
159 | #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ |
||
160 | #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ |
||
161 | #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ |
||
162 | }; |
||
163 | |||
164 | struct video_audio |
||
165 | { |
||
166 | int audio; /* Audio channel */ |
||
167 | __u16 volume; /* If settable */ |
||
168 | __u16 bass, treble; |
||
169 | __u32 flags; |
||
170 | #define VIDEO_AUDIO_MUTE 1 |
||
171 | #define VIDEO_AUDIO_MUTABLE 2 |
||
172 | #define VIDEO_AUDIO_VOLUME 4 |
||
173 | #define VIDEO_AUDIO_BASS 8 |
||
174 | #define VIDEO_AUDIO_TREBLE 16 |
||
175 | #define VIDEO_AUDIO_BALANCE 32 |
||
176 | char name[16]; |
||
177 | #define VIDEO_SOUND_MONO 1 |
||
178 | #define VIDEO_SOUND_STEREO 2 |
||
179 | #define VIDEO_SOUND_LANG1 4 |
||
180 | #define VIDEO_SOUND_LANG2 8 |
||
181 | __u16 mode; |
||
182 | __u16 balance; /* Stereo balance */ |
||
183 | __u16 step; /* Step actual volume uses */ |
||
184 | }; |
||
185 | |||
186 | struct video_clip |
||
187 | { |
||
188 | __s32 x,y; |
||
189 | __s32 width, height; |
||
190 | struct video_clip *next; /* For user use/driver use only */ |
||
191 | }; |
||
192 | |||
193 | struct video_window |
||
194 | { |
||
195 | __u32 x,y; /* Position of window */ |
||
196 | __u32 width,height; /* Its size */ |
||
197 | __u32 chromakey; |
||
198 | __u32 flags; |
||
199 | struct video_clip *clips; /* Set only */ |
||
200 | int clipcount; |
||
201 | #define VIDEO_WINDOW_INTERLACE 1 |
||
202 | #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ |
||
203 | #define VIDEO_CLIP_BITMAP -1 |
||
204 | /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ |
||
205 | #define VIDEO_CLIPMAP_SIZE (128 * 625) |
||
206 | }; |
||
207 | |||
208 | struct video_capture |
||
209 | { |
||
210 | __u32 x,y; /* Offsets into image */ |
||
211 | __u32 width, height; /* Area to capture */ |
||
212 | __u16 decimation; /* Decimation divider */ |
||
213 | __u16 flags; /* Flags for capture */ |
||
214 | #define VIDEO_CAPTURE_ODD 0 /* Temporal */ |
||
215 | #define VIDEO_CAPTURE_EVEN 1 |
||
216 | }; |
||
217 | |||
218 | struct video_buffer |
||
219 | { |
||
220 | void *base; |
||
221 | int height,width; |
||
222 | int depth; |
||
223 | int bytesperline; |
||
224 | }; |
||
225 | |||
226 | struct video_mmap |
||
227 | { |
||
228 | unsigned int frame; /* Frame (0 - n) for double buffer */ |
||
229 | int height,width; |
||
230 | unsigned int format; /* should be VIDEO_PALETTE_* */ |
||
231 | }; |
||
232 | |||
233 | struct video_key |
||
234 | { |
||
235 | __u8 key[8]; |
||
236 | __u32 flags; |
||
237 | }; |
||
238 | |||
239 | |||
240 | #define VIDEO_MAX_FRAME 32 |
||
241 | |||
242 | struct video_mbuf |
||
243 | { |
||
244 | int size; /* Total memory to map */ |
||
245 | int frames; /* Frames */ |
||
246 | int offsets[VIDEO_MAX_FRAME]; |
||
247 | }; |
||
248 | |||
249 | |||
250 | #define VIDEO_NO_UNIT (-1) |
||
251 | |||
252 | |||
253 | struct video_unit |
||
254 | { |
||
255 | int video; /* Video minor */ |
||
256 | int vbi; /* VBI minor */ |
||
257 | int radio; /* Radio minor */ |
||
258 | int audio; /* Audio minor */ |
||
259 | int teletext; /* Teletext minor */ |
||
260 | }; |
||
261 | |||
262 | struct vbi_format { |
||
263 | __u32 sampling_rate; /* in Hz */ |
||
264 | __u32 samples_per_line; |
||
265 | __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ |
||
266 | __s32 start[2]; /* starting line for each frame */ |
||
267 | __u32 count[2]; /* count of lines for each frame */ |
||
268 | __u32 flags; |
||
269 | #define VBI_UNSYNC 1 /* can distingues between top/bottom field */ |
||
270 | #define VBI_INTERLACED 2 /* lines are interlaced */ |
||
271 | }; |
||
272 | |||
273 | /* video_info is biased towards hardware mpeg encode/decode */ |
||
274 | /* but it could apply generically to any hardware compressor/decompressor */ |
||
275 | struct video_info |
||
276 | { |
||
277 | __u32 frame_count; /* frames output since decode/encode began */ |
||
278 | __u32 h_size; /* current unscaled horizontal size */ |
||
279 | __u32 v_size; /* current unscaled veritcal size */ |
||
280 | __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */ |
||
281 | __u32 picture_type; /* current picture type */ |
||
282 | __u32 temporal_reference; /* current temporal reference */ |
||
283 | __u8 user_data[256]; /* user data last found in compressed stream */ |
||
284 | /* user_data[0] contains user data flags, user_data[1] has count */ |
||
285 | }; |
||
286 | |||
287 | /* generic structure for setting playback modes */ |
||
288 | struct video_play_mode |
||
289 | { |
||
290 | int mode; |
||
291 | int p1; |
||
292 | int p2; |
||
293 | }; |
||
294 | |||
295 | /* for loading microcode / fpga programming */ |
||
296 | struct video_code |
||
297 | { |
||
298 | char loadwhat[16]; /* name or tag of file being passed */ |
||
299 | int datasize; |
||
300 | __u8 *data; |
||
301 | }; |
||
302 | |||
303 | #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ |
||
304 | #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ |
||
305 | #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ |
||
306 | #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ |
||
307 | #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ |
||
308 | #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ |
||
309 | #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ |
||
310 | #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ |
||
311 | #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ |
||
312 | #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ |
||
313 | #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ |
||
314 | #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ |
||
315 | #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) */ |
||
316 | #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ |
||
317 | #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ |
||
318 | #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ |
||
319 | #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ |
||
320 | #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ |
||
321 | #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ |
||
322 | #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ |
||
323 | #define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ |
||
324 | #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ |
||
325 | #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ |
||
326 | #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ |
||
327 | #define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ |
||
328 | #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ |
||
329 | #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ |
||
330 | #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ |
||
331 | #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ |
||
332 | |||
333 | |||
334 | #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ |
||
335 | |||
336 | /* VIDIOCSWRITEMODE */ |
||
337 | #define VID_WRITE_MPEG_AUD 0 |
||
338 | #define VID_WRITE_MPEG_VID 1 |
||
339 | #define VID_WRITE_OSD 2 |
||
340 | #define VID_WRITE_TTX 3 |
||
341 | #define VID_WRITE_CC 4 |
||
342 | #define VID_WRITE_MJPEG 5 |
||
343 | |||
344 | /* VIDIOCSPLAYMODE */ |
||
345 | #define VID_PLAY_VID_OUT_MODE 0 |
||
346 | /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ |
||
347 | #define VID_PLAY_GENLOCK 1 |
||
348 | /* p1: 0 = OFF, 1 = ON */ |
||
349 | /* p2: GENLOCK FINE DELAY value */ |
||
350 | #define VID_PLAY_NORMAL 2 |
||
351 | #define VID_PLAY_PAUSE 3 |
||
352 | #define VID_PLAY_SINGLE_FRAME 4 |
||
353 | #define VID_PLAY_FAST_FORWARD 5 |
||
354 | #define VID_PLAY_SLOW_MOTION 6 |
||
355 | #define VID_PLAY_IMMEDIATE_NORMAL 7 |
||
356 | #define VID_PLAY_SWITCH_CHANNELS 8 |
||
357 | #define VID_PLAY_FREEZE_FRAME 9 |
||
358 | #define VID_PLAY_STILL_MODE 10 |
||
359 | #define VID_PLAY_MASTER_MODE 11 |
||
360 | /* p1: see below */ |
||
361 | #define VID_PLAY_MASTER_NONE 1 |
||
362 | #define VID_PLAY_MASTER_VIDEO 2 |
||
363 | #define VID_PLAY_MASTER_AUDIO 3 |
||
364 | #define VID_PLAY_ACTIVE_SCANLINES 12 |
||
365 | /* p1 = first active; p2 = last active */ |
||
366 | #define VID_PLAY_RESET 13 |
||
367 | #define VID_PLAY_END_MARK 14 |
||
368 | |||
369 | |||
370 | |||
371 | #define VID_HARDWARE_BT848 1 |
||
372 | #define VID_HARDWARE_QCAM_BW 2 |
||
373 | #define VID_HARDWARE_PMS 3 |
||
374 | #define VID_HARDWARE_QCAM_C 4 |
||
375 | #define VID_HARDWARE_PSEUDO 5 |
||
376 | #define VID_HARDWARE_SAA5249 6 |
||
377 | #define VID_HARDWARE_AZTECH 7 |
||
378 | #define VID_HARDWARE_SF16MI 8 |
||
379 | #define VID_HARDWARE_RTRACK 9 |
||
380 | #define VID_HARDWARE_ZOLTRIX 10 |
||
381 | #define VID_HARDWARE_SAA7146 11 |
||
382 | #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */ |
||
383 | #define VID_HARDWARE_RTRACK2 13 |
||
384 | #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */ |
||
385 | #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */ |
||
386 | #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ |
||
387 | #define VID_HARDWARE_BROADWAY 17 /* Broadway project */ |
||
388 | #define VID_HARDWARE_GEMTEK 18 |
||
389 | #define VID_HARDWARE_TYPHOON 19 |
||
390 | #define VID_HARDWARE_VINO 20 /* SGI Indy Vino */ |
||
391 | #define VID_HARDWARE_CADET 21 /* Cadet radio */ |
||
392 | #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ |
||
393 | #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ |
||
394 | #define VID_HARDWARE_CPIA 24 |
||
395 | #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ |
||
396 | #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ |
||
397 | #define VID_HARDWARE_OV511 27 |
||
398 | #define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */ |
||
399 | #define VID_HARDWARE_W9966 29 |
||
400 | #define VID_HARDWARE_SE401 30 /* SE401 USB webcams */ |
||
401 | #define VID_HARDWARE_PWC 31 /* Philips webcams */ |
||
402 | #define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */ |
||
403 | #define VID_HARDWARE_CPIA2 33 |
||
404 | #define VID_HARDWARE_VICAM 34 |
||
405 | #define VID_HARDWARE_SF16FMR2 35 |
||
406 | |||
604 | giacomo | 407 | /* Open VideoDev Interface */ |
603 | giacomo | 408 | int VIDEODEV26_open(int num); |
409 | |||
604 | giacomo | 410 | /* IOCTL to VideoDev device */ |
411 | int VIDEODEV26_ioctl(int num,unsigned int cmd,unsigned long arg); |
||
412 | |||
603 | giacomo | 413 | #endif |