videodev.h 12 KB

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