videodev.h 10 KB

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