📄 videodev.h
字号:
/* * Video for Linux Two * * Header file for v4l or V4L2 drivers and applications, for * Linux kernels 2.2.x or 2.4.x. * * Author: Bill Dirks <bdirks@pacbell.net> * Justin Schoeman * et al. */#ifndef __LINUX_VIDEODEV_H#define __LINUX_VIDEODEV_H#if (LINUX_VERSION_CODE >= 0x020300) && (LINUX_VERSION_CODE < 0x020400)#warning Due to the changes in the 2.3.x kernel series, this version of videodev.h \ may not work correctly for your kernel.#endif#include <linux/types.h>#include <linux/version.h>#ifdef __KERNEL__#include <linux/poll.h>#if (LINUX_VERSION_CODE >= 0x020300) || defined(CONFIG_FS_DEVFS)#include <linux/devfs_fs_kernel.h>#endif#endif#define V4L2_MAJOR_VERSION 0#define V4L2_MINOR_VERSION 20/* * M I S C E L L A N E O U S *//* Four-character-code (FOURCC) */#define v4l2_fourcc(a,b,c,d)\ (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))/* Open flag for non-capturing opens on capture devices */#define O_NONCAP O_TRUNC#define O_NOIO O_TRUNC/* Timestamp data type, 64-bit signed integer, in nanoseconds */#ifndef STAMP_T#define STAMP_Ttypedef __s64 stamp_t;#endif/* * D R I V E R C A P A B I L I T I E S */struct v4l2_capability{ char name[32]; /* Descriptive, and unique */ int type; /* Device type, see below */ int inputs; /* Num video inputs */ int outputs; /* Num video outputs */ int audios; /* Num audio devices */ int maxwidth; int maxheight; int minwidth; int minheight; int maxframerate; __u32 flags; /* Feature flags, see below */ __u32 reserved[4];};/* Values for 'type' field */#define V4L2_TYPE_CAPTURE 0 /* Is a video capture device */#define V4L2_TYPE_CODEC 1 /* Is a CODEC device */#define V4L2_TYPE_OUTPUT 2 /* Is a video output device */#define V4L2_TYPE_FX 3 /* Is a video effects device */#define V4L2_TYPE_VBI 4 /* Is a VBI capture device */#define V4L2_TYPE_VTR 5 /* Is a tape recorder controller */#define V4L2_TYPE_VTX 6 /* Is a teletext device */#define V4L2_TYPE_RADIO 7 /* Is a radio device */#define V4L2_TYPE_VBI_INPUT 4 /* Is a VBI capture device */#define V4L2_TYPE_VBI_OUTPUT 9 /* Is a VBI output device */#define V4L2_TYPE_PRIVATE 1000 /* Start of driver private types *//* Flags for 'flags' field */#define V4L2_FLAG_READ 0x00001 /* Can capture via read() call */#define V4L2_FLAG_WRITE 0x00002 /* Can accept data via write() */#define V4L2_FLAG_STREAMING 0x00004 /* Can capture streaming video */#define V4L2_FLAG_PREVIEW 0x00008 /* Can do automatic preview */#define V4L2_FLAG_SELECT 0x00010 /* Supports the select() call */#define V4L2_FLAG_TUNER 0x00020 /* Can tune */#define V4L2_FLAG_MONOCHROME 0x00040 /* Monochrome only */#define V4L2_FLAG_DATA_SERVICE 0x00080 /* Has a related data service dev. *//* * V I D E O I M A G E F O R M A T */struct v4l2_pix_format{ __u32 width; __u32 height; __u32 depth; __u32 pixelformat; __u32 flags; __u32 bytesperline; /* only used when there are pad bytes */ __u32 sizeimage; __u32 priv; /* private data, depends on pixelformat */};/* Pixel format FOURCC depth Description */#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_YUY2 v4l2_fourcc('Y','U','Y','2') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y','V','Y','U') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V','Y','U','Y') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('P','4','2','2') /* 16 YUV422 planar */#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('P','4','1','1') /* 16 YUV411 planar */#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/UV 4:2:0 *//* The following formats are not defined in the V4L2 specification */#define V4L2_PIX_FMT_YVU422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */#define V4L2_PIX_FMT_YVU411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/UV 4:2:0 *//* Vendor-specific formats */#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compres *//* Flags */#define V4L2_FMT_FLAG_COMPRESSED 0x0001 /* Compressed format */#define V4L2_FMT_FLAG_BYTESPERLINE 0x0002 /* bytesperline field valid */#define V4L2_FMT_FLAG_NOT_INTERLACED 0x0000#define V4L2_FMT_FLAG_INTERLACED 0x0004 /* Image is interlaced */#define V4L2_FMT_FLAG_TOPFIELD 0x0008 /* is a top field only */#define V4L2_FMT_FLAG_BOTFIELD 0x0010 /* is a bottom field only */#define V4L2_FMT_FLAG_ODDFIELD V4L2_FMT_FLAG_TOPFIELD#define V4L2_FMT_FLAG_EVENFIELD V4L2_FMT_FLAG_BOTFIELD#define V4L2_FMT_FLAG_COMBINED V4L2_FMT_FLAG_INTERLACED#define V4L2_FMT_FLAG_FIELD_field 0x001C#define V4L2_FMT_CS_field 0xF000 /* Color space field mask */#define V4L2_FMT_CS_601YUV 0x1000 /* ITU YCrCb color space */#define V4L2_FMT_FLAG_SWCONVERSION 0x0800 /* used only in format enum. *//* SWCONVERSION indicates the format is not natively supported by the *//* driver and the driver uses software conversion to support it *//* * F O R M A T E N U M E R A T I O N */struct v4l2_fmtdesc{ int index; /* Format number */ char description[32]; /* Description string */ __u32 pixelformat; /* Format fourcc */ __u32 flags; /* Format flags */ __u32 depth; /* Bits per pixel */ __u32 reserved[2];};struct v4l2_cvtdesc{ int index; struct { __u32 pixelformat; __u32 flags; __u32 depth; __u32 reserved[2]; } in, out;};struct v4l2_fxdesc{ int index; char name[32]; __u32 flags; __u32 inputs; __u32 controls; __u32 reserved[2];};/* * T I M E C O D E */struct v4l2_timecode{ __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4]; __u32 flags; __u32 type;};/* Type */#define V4L2_TC_TYPE_24FPS 1#define V4L2_TC_TYPE_25FPS 2#define V4L2_TC_TYPE_30FPS 3#define V4L2_TC_TYPE_50FPS 4#define V4L2_TC_TYPE_60FPS 5/* Flags */#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */#define V4L2_TC_FLAG_COLORFRAME 0x0002#define V4L2_TC_USERBITS_field 0x000C#define V4L2_TC_USERBITS_USERDEFINED 0x0000#define V4L2_TC_USERBITS_8BITCHARS 0x0008/* The above is based on SMPTE timecodes *//* * C O M P R E S S I O N P A R A M E T E R S */struct v4l2_compression{ int quality; int keyframerate; int pframerate; __u32 reserved[5];};/* * M E M O R Y - M A P P I N G B U F F E R S */struct v4l2_requestbuffers{ int count; __u32 type; __u32 reserved[2];};struct v4l2_buffer{ int index; __u32 type; __u32 offset; __u32 length; __u32 bytesused; __u32 flags; stamp_t timestamp; struct v4l2_timecode timecode; __u32 sequence; __u32 reserved[3];};/* Buffer type codes and flags for 'type' field */#define V4L2_BUF_TYPE_field 0x00001FFF /* Type field mask */#define V4L2_BUF_TYPE_CAPTURE 0x00000001#define V4L2_BUF_TYPE_CODECIN 0x00000002#define V4L2_BUF_TYPE_CODECOUT 0x00000003#define V4L2_BUF_TYPE_EFFECTSIN 0x00000004#define V4L2_BUF_TYPE_EFFECTSIN2 0x00000005#define V4L2_BUF_TYPE_EFFECTSOUT 0x00000006#define V4L2_BUF_TYPE_VIDEOOUT 0x00000007#define V4L2_BUF_TYPE_FXCONTROL 0x00000008#define V4L2_BUF_TYPE_VBI 0x00000009/* Starting value of driver private buffer types */#define V4L2_BUF_TYPE_PRIVATE 0x00001000#define V4L2_BUF_ATTR_DEVICEMEM 0x00010000 /* Buffer is on device (flag) *//* Flags used only in VIDIOC_REQBUFS */#define V4L2_BUF_REQ_field 0xF0000000#define V4L2_BUF_REQ_CONTIG 0x10000000 /* Map all buffers in one contiguous mmap(). This flag only used in VIDIOC_REQBUFS *//* Flags for 'flags' field */#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */#define V4L2_BUF_FLAG_TOPFIELD 0x0040 /* Image is a top field only */#define V4L2_BUF_FLAG_BOTFIELD 0x0080 /* Image is a bottom field only */#define V4L2_BUF_FLAG_ODDFIELD V4L2_BUF_FLAG_TOPFIELD#define V4L2_BUF_FLAG_EVENFIELD V4L2_BUF_FLAG_BOTFIELD#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid *//* * O V E R L A Y P R E V I E W */struct v4l2_framebuffer{ __u32 capability; __u32 flags; void *base[3]; struct v4l2_pix_format fmt;};/* Flags for the 'capability' field. Read only */#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001#define V4L2_FBUF_CAP_CHROMAKEY 0x0002#define V4L2_FBUF_CAP_CLIPPING 0x0004#define V4L2_FBUF_CAP_SCALEUP 0x0008#define V4L2_FBUF_CAP_SCALEDOWN 0x0010#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0020/* Flags for the 'flags' field. */#define V4L2_FBUF_FLAG_PRIMARY 0x0001#define V4L2_FBUF_FLAG_OVERLAY 0x0002#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004struct v4l2_clip{ int x; int y; int width; int height; struct v4l2_clip *next;};struct v4l2_window{ int x; int y; int width; int height; __u32 chromakey; struct v4l2_clip *clips; int clipcount; void *bitmap;};/* * D E V I C E P E R F O R M A N C E */struct v4l2_performance{ int frames; int framesdropped; __u64 bytesin; __u64 bytesout; __u32 reserved[4];};/* * C A P T U R E P A R A M E T E R S */struct v4l2_captureparm{ __u32 capability; /* Supported modes */ __u32 capturemode; /* Current mode */ unsigned long timeperframe; /* Time per frame in .1us units */ __u32 extendedmode; /* Driver-specific extensions */ __u32 reserved[4];};/* Flags for 'capability' and 'capturemode' fields */#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode *///#define V4L2_MODE_VFLIP 0x0002 /* Flip image vertically *///#define V4L2_MODE_HFLIP 0x0004 /* Flip image horizontally */#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */struct v4l2_outputparm{ __u32 capability; /* Supported modes */ __u32 outputmode; /* Current mode */ unsigned long timeperframe; /* Time per frame in .1us units */ __u32 extendedmode; /* Driver-specific extensions */ __u32 reserved[4];};/* * I N P U T I M A G E C R O P P I N G */struct v4l2_cropcap{ __u32 capability; int min_x; int min_y; int max_x; int max_y; int default_left; int default_top; int default_right; int default_bottom; __u32 reserved[2];};struct v4l2_crop{ int left; int top; int right; int bottom; __u32 reserved;};/* * D I G I T A L Z O O M */struct v4l2_zoomcap{ __u32 capability; __u32 maxwidth; __u32 maxheight; __u32 minwidth; __u32 minheight; __u32 reserved[2];};/* Flags for the capability field */#define V4L2_ZOOM_NONCAP 0x0001#define V4L2_ZOOM_WHILESTREAMING 0x0002struct v4l2_zoom{ __u32 x; __u32 y; __u32 width; __u32 height; __u32 reserved;};/* * A N A L O G V I D E O S T A N D A R D */struct v4l2_standard{ __u8 name[24]; struct { __u32 numerator; __u32 denominator; /* >= 1 */ } framerate; /* Frames, not fields */ __u32 framelines; __u32 reserved1; __u32 colorstandard; union { struct { __u32 colorsubcarrier; /* Hz */ } pal; struct { __u32 colorsubcarrier; /* Hz */ } ntsc; struct { __u32 f0b; /* Hz (blue) */ __u32 f0r; /* Hz (red) */ } secam; __u8 reserved[12]; } colorstandard_data; __u32 transmission; /* Bit field. Must be zero for non-modulators/demodulators. */ __u32 reserved2; /* Must be set to zero */};/* Values for the 'colorstandard' field */#define V4L2_COLOR_STD_PAL 1#define V4L2_COLOR_STD_NTSC 2#define V4L2_COLOR_STD_SECAM 3/* Values for the color subcarrier fields */#define V4L2_COLOR_SUBC_PAL 4433619 /* PAL BGHI, NTSC-44 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -