videodev.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:13k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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