libv4l1-videodev.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /* libv4l1 linux/videodev.h replacement file */
  2. #ifndef __LINUX_VIDEODEV_H
  3. #define __LINUX_VIDEODEV_H
  4. #ifdef linux
  5. #include <linux/ioctl.h>
  6. #endif
  7. #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  8. #include <sys/ioctl.h>
  9. #endif
  10. #include <stdint.h>
  11. #define VID_TYPE_CAPTURE 1 /* Can capture */
  12. #define VID_TYPE_TUNER 2 /* Can tune */
  13. #define VID_TYPE_TELETEXT 4 /* Does teletext */
  14. #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
  15. #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
  16. #define VID_TYPE_CLIPPING 32 /* Can clip */
  17. #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
  18. #define VID_TYPE_SCALES 128 /* Scalable */
  19. #define VID_TYPE_MONOCHROME 256 /* Monochrome only */
  20. #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
  21. #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
  22. #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
  23. #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
  24. #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
  25. struct video_capability
  26. {
  27. char name[32];
  28. int type;
  29. int channels; /* Num channels */
  30. int audios; /* Num audio devices */
  31. int maxwidth; /* Supported width */
  32. int maxheight; /* And height */
  33. int minwidth; /* Supported width */
  34. int minheight; /* And height */
  35. };
  36. struct video_channel
  37. {
  38. int channel;
  39. char name[32];
  40. int tuners;
  41. uint32_t flags;
  42. #define VIDEO_VC_TUNER 1 /* Channel has a tuner */
  43. #define VIDEO_VC_AUDIO 2 /* Channel has audio */
  44. uint16_t type;
  45. #define VIDEO_TYPE_TV 1
  46. #define VIDEO_TYPE_CAMERA 2
  47. uint16_t norm; /* Norm set by channel */
  48. };
  49. struct video_tuner
  50. {
  51. int tuner;
  52. char name[32];
  53. unsigned long rangelow, rangehigh; /* Tuner range */
  54. uint32_t flags;
  55. #define VIDEO_TUNER_PAL 1
  56. #define VIDEO_TUNER_NTSC 2
  57. #define VIDEO_TUNER_SECAM 4
  58. #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
  59. #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
  60. #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
  61. #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
  62. #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
  63. uint16_t mode; /* PAL/NTSC/SECAM/OTHER */
  64. #define VIDEO_MODE_PAL 0
  65. #define VIDEO_MODE_NTSC 1
  66. #define VIDEO_MODE_SECAM 2
  67. #define VIDEO_MODE_AUTO 3
  68. uint16_t signal; /* Signal strength 16bit scale */
  69. };
  70. struct video_picture
  71. {
  72. uint16_t brightness;
  73. uint16_t hue;
  74. uint16_t colour;
  75. uint16_t contrast;
  76. uint16_t whiteness; /* Black and white only */
  77. uint16_t depth; /* Capture depth */
  78. uint16_t palette; /* Palette in use */
  79. #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
  80. #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
  81. #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
  82. #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
  83. #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
  84. #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
  85. #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
  86. #define VIDEO_PALETTE_YUYV 8
  87. #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
  88. #define VIDEO_PALETTE_YUV420 10
  89. #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
  90. #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
  91. #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
  92. #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
  93. #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
  94. #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
  95. #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
  96. #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
  97. };
  98. struct video_audio
  99. {
  100. int audio; /* Audio channel */
  101. uint16_t volume; /* If settable */
  102. uint16_t bass, treble;
  103. uint32_t flags;
  104. #define VIDEO_AUDIO_MUTE 1
  105. #define VIDEO_AUDIO_MUTABLE 2
  106. #define VIDEO_AUDIO_VOLUME 4
  107. #define VIDEO_AUDIO_BASS 8
  108. #define VIDEO_AUDIO_TREBLE 16
  109. #define VIDEO_AUDIO_BALANCE 32
  110. char name[16];
  111. #define VIDEO_SOUND_MONO 1
  112. #define VIDEO_SOUND_STEREO 2
  113. #define VIDEO_SOUND_LANG1 4
  114. #define VIDEO_SOUND_LANG2 8
  115. uint16_t mode;
  116. uint16_t balance; /* Stereo balance */
  117. uint16_t step; /* Step actual volume uses */
  118. };
  119. struct video_clip
  120. {
  121. int32_t x,y;
  122. int32_t width, height;
  123. struct video_clip *next; /* For user use/driver use only */
  124. };
  125. struct video_window
  126. {
  127. uint32_t x,y; /* Position of window */
  128. uint32_t width,height; /* Its size */
  129. uint32_t chromakey;
  130. uint32_t flags;
  131. struct video_clip *clips; /* Set only */
  132. int clipcount;
  133. #define VIDEO_WINDOW_INTERLACE 1
  134. #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
  135. #define VIDEO_CLIP_BITMAP -1
  136. /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
  137. #define VIDEO_CLIPMAP_SIZE (128 * 625)
  138. };
  139. struct video_buffer
  140. {
  141. void *base;
  142. int height,width;
  143. int depth;
  144. int bytesperline;
  145. };
  146. struct video_mmap
  147. {
  148. unsigned int frame; /* Frame (0 - n) for double buffer */
  149. int height,width;
  150. unsigned int format; /* should be VIDEO_PALETTE_* */
  151. };
  152. struct video_mbuf
  153. {
  154. int size; /* Total memory to map */
  155. int frames; /* Frames */
  156. int offsets[32];
  157. };
  158. struct vbi_format {
  159. uint32_t sampling_rate; /* in Hz */
  160. uint32_t samples_per_line;
  161. uint32_t sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
  162. int32_t start[2]; /* starting line for each frame */
  163. uint32_t count[2]; /* count of lines for each frame */
  164. uint32_t flags;
  165. #define VBI_UNSYNC 1 /* can distingues between top/bottom field */
  166. #define VBI_INTERLACED 2 /* lines are interlaced */
  167. };
  168. #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
  169. #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
  170. #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
  171. #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
  172. #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
  173. #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
  174. #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
  175. #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
  176. #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
  177. #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
  178. #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
  179. #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
  180. #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
  181. #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
  182. #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
  183. #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
  184. #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
  185. #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
  186. #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
  187. #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
  188. #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
  189. #endif