videodev.h 11 KB

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