📄 struct-v4l2.c
字号:
#include <stdio.h>#include <sys/ioctl.h>#include <sys/time.h>#include <asm/types.h>#include "videodev2.h"#include "struct-dump.h"#include "struct-v4l2.h"/* ---------------------------------------------------------------------- */char *desc_v4l2_field[] = { [V4L2_FIELD_ANY] = "ANY", [V4L2_FIELD_NONE] = "NONE", [V4L2_FIELD_TOP] = "TOP", [V4L2_FIELD_BOTTOM] = "BOTTOM", [V4L2_FIELD_INTERLACED] = "INTERLACED", [V4L2_FIELD_SEQ_TB] = "SEQ_TB", [V4L2_FIELD_SEQ_BT] = "SEQ_BT", [V4L2_FIELD_ALTERNATE] = "ALTERNATE",};char *desc_v4l2_buf_type[] = { [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "VIDEO_CAPTURE", [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "VIDEO_OUTPUT", [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "VIDEO_OVERLAY", [V4L2_BUF_TYPE_VBI_CAPTURE] = "VBI_CAPTURE", [V4L2_BUF_TYPE_VBI_OUTPUT] = "VBI_OUTPUT", [V4L2_BUF_TYPE_PRIVATE] = "PRIVATE",};char *desc_v4l2_ctrl_type[] = { [V4L2_CTRL_TYPE_INTEGER] = "INTEGER", [V4L2_CTRL_TYPE_BOOLEAN] = "BOOLEAN", [V4L2_CTRL_TYPE_MENU] = "MENU", [V4L2_CTRL_TYPE_BUTTON] = "BUTTON",};char *desc_v4l2_tuner_type[] = { [V4L2_TUNER_RADIO] = "RADIO", [V4L2_TUNER_ANALOG_TV] = "ANALOG_TV",};char *desc_v4l2_memory[] = { [V4L2_MEMORY_MMAP] = "MMAP", [V4L2_MEMORY_USERPTR] = "USERPTR", [V4L2_MEMORY_OVERLAY] = "OVERLAY",};char *desc_v4l2_colorspace[] = { [V4L2_COLORSPACE_SMPTE170M] = "SMPTE170M", [V4L2_COLORSPACE_SMPTE240M] = "SMPTE240M", [V4L2_COLORSPACE_REC709] = "REC709", [V4L2_COLORSPACE_BT878] = "BT878", [V4L2_COLORSPACE_470_SYSTEM_M] = "470_SYSTEM_M", [V4L2_COLORSPACE_470_SYSTEM_BG] = "470_SYSTEM_BG", [V4L2_COLORSPACE_JPEG] = "JPEG", [V4L2_COLORSPACE_SRGB] = "SRGB",};char *bits_capabilities[32] = { "VIDEO_CAPTURE", "VIDEO_OUTPUT", "VIDEO_OVERLAY", "", "VBI_CAPTURE", "VBI_OUTPUT", "?","?", "RDS_CAPTURE", "?", "?", "?", "?", "?", "?", "?", "TUNER", "AUDIO", "?", "?", "?", "?", "?", "?", "READWRITE", "ASYNCIO", "STREAMING", "?",};char *bits_standard[64] = { "PAL_B", "PAL_B1", "PAL_G", "PAL_H", "PAL_I", "PAL_D", "PAL_D1", "PAL_K", "PAL_M", "PAL_N", "PAL_Nc", "PAL_60", "NTSC_M", "NTSC_M_JP", "?", "?", "SECAM_B", "SECAM_D", "SECAM_G", "SECAM_H", "SECAM_K", "SECAM_K1", "SECAM_L", "?" "ATSC_8_VSB", "ATSC_16_VSB",};char *bits_buf_flags[32] = { "MAPPED", "QUEUED", "DONE", "KEYFRAME", "PFRAME", "BFRAME", "?", "?", "TIMECODE",};char *bits_fbuf_cap[32] = { "EXTERNOVERLAY", "CHROMAKEY", "LIST_CLIPPING", "BITMAP_CLIPPING",};char *bits_fbuf_flags[32] = { "PRIMARY", "OVERLAY", "CHROMAKEY",};char *desc_input_type[32] = { [ V4L2_INPUT_TYPE_TUNER ] = "TUNER", [ V4L2_INPUT_TYPE_CAMERA ] = "CAMERA",};char *bits_input_status[32] = { "NO_POWER", "NO_SIGNAL", "NO_COLOR", "?", "?","?","?","?", "NO_H_LOCK", "COLOR_KILL", "?", "?", "?","?","?","?", "NO_SYNC", "NO_EQU", "NO_CARRIER", "?", "?","?","?","?", "MACROVISION", "NO_ACCESS", "VTR", "?", "?","?","?","?",};char *bits_tuner_cap[32] = { "LOW", "NORM", "?", "?", "STEREO", "LANG2", "LANG1", "?",};char *bits_tuner_rx[32] = { "MONO", "STEREO", "LANG2", "LANG1",};char *desc_tuner2_mode[] = { [ V4L2_TUNER_MODE_MONO ] = "MONO", [ V4L2_TUNER_MODE_STEREO ] = "STEREO", [ V4L2_TUNER_MODE_LANG2 ] = "LANG2", [ V4L2_TUNER_MODE_LANG1 ] = "LANG1",};/* ---------------------------------------------------------------------- */struct struct_desc desc_v4l2_rect[] = {{ .type = SINT32, .name = "left",},{ .type = SINT32, .name = "top",},{ .type = SINT32, .name = "width",},{ .type = SINT32, .name = "height",},{ /* end of list */}};struct struct_desc desc_v4l2_fract[] = {{ .type = UINT32, .name = "numerator",},{ .type = UINT32, .name = "denominator",},{ /* end of list */}};struct struct_desc desc_v4l2_capability[] = {{ .type = STRING, .name = "driver", .length = 16,},{ .type = STRING, .name = "card", .length = 32,},{ .type = STRING, .name = "bus_info", .length = 32,},{ .type = VER, .name = "version",},{ .type = BITS32, .name = "capabilities", .bits = bits_capabilities,},{ /* end of list */}};struct struct_desc desc_v4l2_pix_format[] = {{ .type = UINT32, .name = "width",},{ .type = UINT32, .name = "height",},{ .type = FOURCC, .name = "pixelformat",},{ .type = ENUM32, .name = "field", .enums = desc_v4l2_field, .length = sizeof(desc_v4l2_field) / sizeof(char*),},{ .type = UINT32, .name = "bytesperline",},{ .type = UINT32, .name = "sizeimage",},{ .type = ENUM32, .name = "colorspace", .enums = desc_v4l2_colorspace, .length = sizeof(desc_v4l2_colorspace) / sizeof(char*),},{ .type = UINT32, .name = "priv",},{ /* end of list */}};struct struct_desc desc_v4l2_fmtdesc[] = {{ .type = UINT32, .name = "index",},{ .type = ENUM32, .name = "type", .enums = desc_v4l2_buf_type, .length = sizeof(desc_v4l2_buf_type) / sizeof(char*),},{ .type = UINT32, .name = "flags",},{ .type = STRING, .name = "description", .length = 32,},{ .type = FOURCC, .name = "pixelformat",},{ /* end of list */}};struct struct_desc desc_v4l2_timecode[] = {{ .type = UINT32, .name = "type",},{ .type = UINT32, .name = "flags",},{ .type = UINT8, .name = "frames",},{ .type = UINT8, .name = "seconds",},{ .type = UINT8, .name = "minutes",},{ .type = UINT8, .name = "hours",},{ .type = STRING, .name = "userbits", .length = 4,},{ /* end of list */}};struct struct_desc desc_v4l2_compression[] = {{ .type = UINT32, .name = "quality",},{ .type = UINT32, .name = "keyframerate",},{ .type = UINT32, .name = "pframerate",},{ /* end of list */}};struct struct_desc desc_v4l2_jpegcompression[] = {{ .type = SINT32, .name = "quality",},{ .type = SINT32, .name = "APPn",},{ .type = SINT32, .name = "APP_len",},{ .type = STRING, .name = "APP_data", .length = 60,},{ .type = SINT32, .name = "COM_len",},{ .type = STRING, .name = "COM_data", .length = 60,},{ .type = UINT32, .name = "jpeg_markers",},{ /* end of list */}};struct struct_desc desc_v4l2_requestbuffers[] = {{ .type = UINT32, .name = "count",},{ .type = ENUM32, .name = "type", .enums = desc_v4l2_buf_type, .length = sizeof(desc_v4l2_buf_type) / sizeof(char*),},{ .type = ENUM32, .name = "memory", .enums = desc_v4l2_memory, .length = sizeof(desc_v4l2_memory) / sizeof(char*),},{ /* end of list */}};struct struct_desc desc_v4l2_buffer[] = {{ .type = UINT32, .name = "index",},{ .type = ENUM32, .name = "type", .enums = desc_v4l2_buf_type, .length = sizeof(desc_v4l2_buf_type) / sizeof(char*),},{ .type = UINT32, .name = "bytesused",},{ .type = BITS32, .name = "flags", .bits = bits_buf_flags,},{ .type = ENUM32, .name = "field", .enums = desc_v4l2_field, .length = sizeof(desc_v4l2_field) / sizeof(char*),},{ .type = STRUCT, .name = "timestamp", .desc = desc_timeval, .length = sizeof(struct timeval),},{ .type = STRUCT, .name = "timecode", .desc = desc_v4l2_timecode, .length = sizeof(struct v4l2_timecode),},{ .type = UINT32, .name = "sequence",},{ .type = ENUM32, .name = "memory", .enums = desc_v4l2_memory, .length = sizeof(desc_v4l2_memory) / sizeof(char*),},{ /* FIXME ... */ /* end of list */}};struct struct_desc desc_v4l2_framebuffer[] = {{ .type = BITS32, .name = "capability", .bits = bits_fbuf_cap,},{ .type = BITS32, .name = "flags", .bits = bits_fbuf_flags,},{ .type = PTR, .name = "base",},{ .type = STRUCT, .name = "fmt", .desc = desc_v4l2_pix_format, .length = sizeof(struct v4l2_pix_format),},{ /* end of list */}};struct struct_desc desc_v4l2_clip[] = {{ .type = STRUCT, .name = "c", .desc = desc_v4l2_rect, .length = sizeof(struct v4l2_rect),},{ /* end of list */}};struct struct_desc desc_v4l2_window[] = {{ .type = STRUCT, .name = "w", .desc = desc_v4l2_rect, .length = sizeof(struct v4l2_rect),},{ .type = ENUM32, .name = "field", .enums = desc_v4l2_field, .length = sizeof(desc_v4l2_field) / sizeof(char*),},{ .type = UINT32, .name = "chromakey",},{ .type = PTR, .name = "clips",},{ .type = UINT32, .name = "clipcount",},{ .type = PTR, .name = "bitmap",},{ /* end of list */}};struct struct_desc desc_v4l2_captureparm[] = {{ .type = UINT32, .name = "capability",},{ .type = UINT32, .name = "capturemode",},{ .type = STRUCT, .name = "timeperframe", .desc = desc_v4l2_fract, .length = sizeof(struct v4l2_fract),},{ .type = UINT32, .name = "extendedmode",},{ .type = UINT32, .name = "readbuffers",},{ /* end of list */}};struct struct_desc desc_v4l2_outputparm[] = {{ .type = UINT32, .name = "capability",},{ .type = UINT32, .name = "outputmode",},{ .type = STRUCT, .name = "timeperframe", .desc = desc_v4l2_fract, .length = sizeof(struct v4l2_fract),},{ .type = UINT32, .name = "extendedmode",},{ .type = UINT32, .name = "writebuffers",},{ /* end of list */}};struct struct_desc desc_v4l2_cropcap[] = {{ .type = ENUM32, .name = "type", .enums = desc_v4l2_buf_type, .length = sizeof(desc_v4l2_buf_type) / sizeof(char*),},{ .type = STRUCT, .name = "bounds", .desc = desc_v4l2_rect, .length = sizeof(struct v4l2_rect),},{ .type = STRUCT, .name = "defrect", .desc = desc_v4l2_rect, .length = sizeof(struct v4l2_rect),},{ .type = STRUCT, .name = "pixelaspect", .desc = desc_v4l2_fract, .length = sizeof(struct v4l2_fract),},{ /* end of list */}};struct struct_desc desc_v4l2_crop[] = {{ .type = ENUM32, .name = "type", .enums = desc_v4l2_buf_type, .length = sizeof(desc_v4l2_buf_type) / sizeof(char*),},{ .type = STRUCT, .name = "c", .desc = desc_v4l2_rect, .length = sizeof(struct v4l2_rect),},{ /* end of list */}};struct struct_desc desc_v4l2_standard[] = {{ .type = UINT32, .name = "index",},{ .type = BITS64, .name = "id", .bits = bits_standard,},{ .type = STRING, .name = "name",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -