⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uvc.h

📁 NXP LPC2378 USBUVC Demo
💻 H
📖 第 1 页 / 共 2 页
字号:
  BYTE  bLength;                            // size of this descriptor in bytes: 8
  BYTE  bDescriptorType;                    // INTERFACE ASSOCIATION Descriptor Type
  BYTE  bFirstInterface;                    // interface number of first VideoControl interface
  BYTE  bInterfaceCount;                    // number of VideoStreaming interfaces
  BYTE  bFunctionClass;                     // Video Interface Class Code
  BYTE  bFunctionSubclass;                  // Video Interface Subclass Codes
  BYTE  bFunctionProtocol;                  // not used
  BYTE  iFunction;                          // index of a string descriptor describing this interface
} UVC_INTERFACE_ASSOCIATION_DESCRIPTOR;

#define UVC_INTERFACE_ASSOCIATION_DESC_SIZE (sizeof(UVC_INTERFACE_ASSOCIATION_DESCRIPTOR))


// Standard VideoControl Interface Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.1 Standard VC Interface Descriptor)
// see usb.h USB_INTERFACE_DESCRIPTOR

// Class-specific VideoControl Interface Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2 Class-Specific VC Interface Descriptor)
typedef __packed struct _UVC_VC_INTERFACE_HEADER_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 12+n
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_HEADER descriptor subtype
  WORD  bcdUVC;                             // USB CDC specification release version
  WORD  wTotalLength;                       // total number of bytes for VC IF (incl. header, unit, terminal descriptors)
  DWORD dwClockFrequency;                   // use of this has been deprecated
  BYTE  bInCollection;                      // number of VS interfaces for video interface collection
  BYTE  baInterfaceNr[1];                   // interface number of first VideoStreaming interface
} UVC_VC_INTERFACE_HEADER_DESCRIPTOR;

#define UVC_VC_INTERFACE_HEADER_DESC_SIZE(n) (sizeof(UVC_VC_INTERFACE_HEADER_DESCRIPTOR)-1+n)


// Inpput Terminal Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.1 Input Terminal Descriptor)
typedef __packed struct _UVC_INPUT_TERMINAL_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 8(+n)
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_HEADER descriptor subtype
  BYTE  bTerminalID;                        // ID to address this terminal
  WORD  wTerminalType;                      // type of terminal
  BYTE  bAssocTerminal;                     // ID of the associated output terminal
  BYTE  iTerminal;                          // string descriptor index describing the terminal
                                            // additional fields depending on the terminal type
} UVC_INPUT_TERMINAL_DESCRIPTOR;

#define UVC_INPUT_TERMINAL_DESC_SIZE(n) (sizeof(UVC_INPUT_TERMINAL_DESCRIPTOR)+n)


// Output Terminal Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.2 Output Terminal Descriptor)
typedef __packed struct _UVC_OUTPUT_TERMINAL_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 9(+n)
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_HEADER descriptor subtype
  BYTE  bTerminalID;                        // ID to address this terminal
  WORD  wTerminalType;                      // type of terminal
  BYTE  bSourceID;                          // ID of the connected Unit or Terminal
  BYTE  bAssocTerminal;                     // ID of the associated output terminal
  BYTE  iTerminal;                          // string descriptor index describing the terminal
                                            // additional fields depending on the terminal type
} UVC_OUTPUT_TERMINAL_DESCRIPTOR;

#define UVC_OUTPUT_TERMINAL_DESC_SIZE(n) (sizeof(UVC_OUTPUT_TERMINAL_DESCRIPTOR)+n)


// Camera Terminal Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.3 Camera Terminal Descriptor)
typedef __packed struct _UVC_CAMERA_TERMINAL_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 15+n
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_HEADER descriptor subtype
  BYTE  bTerminalID;                        // ID to address this terminal
  WORD  wTerminalType;                      // type of terminal
  BYTE  bAssocTerminal;                     // ID of the associated output terminal
  BYTE  iTerminal;                          // string descriptor index describing the terminal
  WORD  wObjectiveFocalLengthMin;           // see USB_Video_Class_1.1.pdf, 2.4.2.5.1
  WORD  wObjectiveFocalLengthMax;           // see USB_Video_Class_1.1.pdf, 2.4.2.5.1
  WORD  wOcularFocalLengt;                  // see USB_Video_Class_1.1.pdf, 2.4.2.5.1
  BYTE  bControlSize;                       // size in bytes of the bmControls field
  BYTE  bmControls[1];                      // Bitmap for the supported controls
} UVC_CAMERA_TERMINAL_DESCRIPTOR;

#define UVC_CAMERA_TERMINAL_DESC_SIZE(n) (sizeof(UVC_CAMERA_TERMINAL_DESCRIPTOR)-1+n)


// Selector Unit Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.4 Selector Unit Descriptor)
typedef __packed struct _UVC_SELECTOR_UNIT_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 6+p
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_SELECTOR_UNIT descriptor subtype
  BYTE  bUnitID;                            // ID to address this unit
  BYTE  bNrInPins;                          // number of input pins for this unit: p
  BYTE  baSourceID[1];                      // number of Unit or terminal connected to this pin
  BYTE  iSelector;                          // string descriptor index describing the selector unit
} UVC_SELECTOR_UNIT_DESCRIPTOR;         
#define UVC_SELECTOR_UNIT_DESC_SIZE(p) (sizeof(UVC_SELECTOR_UNIT_DESCRIPTOR)-1+p)


// Processing Unit Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.5 Processing Unit Descriptor)
typedef __packed struct _UVC_PROCESSING_UNIT_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 10+n
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_PROCESSING_UNIT descriptor subtype
  BYTE  bUnitID;                            // ID to address this unit
  BYTE  bSourceID;                          // ID of the connected Unit or Terminal
  WORD  wMaxMultiplier;                     // 
  BYTE  bControlSize;                       // Size of the bmControl fields, in bytes: n
  BYTE  bmControls[2];                      // Bitmap for the supported controls
  BYTE  iProcessing;                        // string descriptor index describing the processing unit
#if (UVC_VERSION == 0x0110)
  BYTE  bmVideoStandards;                   // bitmap of supported analog video standards
#endif
} UVC_PROCESSING_UNIT_DESCRIPTOR;

#define UVC_PROCESSING_UNIT_DESC_SIZE(n) (sizeof(UVC_PROCESSING_UNIT_DESCRIPTOR)-2+n)


// Extension Unit Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2.6 Extension Unit Descriptor)
typedef __packed struct _UVC_EXTENSION_UNIT_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 24+p+n
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_EXTENSION_UNIT descriptor subtype
  BYTE  bUnitID;                            // ID to address this unit
  BYTE  guidExtensionCode[16];              // vendor specific extension unit code
  BYTE  bNumControls;                       // number of controls in this extension unit
  BYTE  bNrInPins;                          // number of input pins of this unit: p
  BYTE  baSourceID[1];                      // ID of the first connected input pin
  BYTE  bControlSize;                       // Size of the bmControl fields, in bytes: n
  BYTE  bmControls[1];                      // Bitmap for the supported controls
  BYTE  iExtension;                         // string descriptor index describing the extension unit
} UVC_EXTENSION_UNIT_DESCRIPTOR;

#define UVC_EXTENSION_UNIT_DESC_SIZE(p,n) (sizeof(UVC_EXTENSION_UNIT_DESCRIPTOR)-2+p+n)


// Standard VC Interrupt Endpoint Descriptor
// (USB_Video_Class_1.1.pdf, 3.8.2.1 Standard VC Interrupt Endpoint Descriptor)
// see usb.h USB_ENDPOINT_DESCRIPTOR


// Class-specific VC Interrupt Endpoint Descriptor
// (USB_Video_Class_1.1.pdf, 3.8.2.2 Standard VC Interrupt Endpoint Descriptor)
typedef __packed struct _UVC_VC_ENDPOINT_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 5
  BYTE  bDescriptorType;                    // CS_ENDPOINT descriptor type
  BYTE  bDescriptorSubtype;                 // EP_INTERRUPT descriptor subtype
  WORD  wMaxTransferSize;                   // maximum structure size this EP is capable of sending
} UVC_VC_ENDPOINT_DESCRIPTOR;

#define UVC_VC_ENDPOINT_DESC_SIZE (sizeof(UVC_VC_ENDPOINT_DESCRIPTOR))


// Standard VideoStreaming Interface Descriptor
// (USB_Video_Class_1.1.pdf, 3.9.1 Standard VS Interface Descriptor)
// see usb.h USB_INTERFACE_DESCRIPTOR

// Class-specific VideoStreaming Interface Descriptor
// (USB_Video_Class_1.1.pdf, 3.7.2 Class-Specific VS Interface Descriptor)
// consists of Input Header, Output Header, Format and Frame descriptors

// Input Header Descriptor
// (USB_Video_Class_1.1.pdf, 3.9.2.1 Input Header Descriptor)
typedef __packed struct _UVC_VS_INTERFACE_INPUT_HEADER_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 13+(p*n)
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_INPUT_HEADER descriptor subtype
  BYTE  bNumFormats;                        // number of video payload format descriptors: p
  WORD  wTotalLength;                       // total number of bytes for VS IF (incl. header)
  BYTE  bEndpointAddress;                   // EP used for video data
  BYTE  bmInfo;                             // capabilities for this VideoStreaming interface
  BYTE  bTerminalLink;                      // ID of the connected Output Terminal
  BYTE  bStillCaptureMethod;                // method of supported still image capture
  BYTE  bTriggerSupport;                    // specifies if HW triggering is supported
  BYTE  bTriggerUsage;                      // How to repond to a HW trigger Interrupt
  BYTE  bControlSize;                       // size of each bmaConrtols field: n
  BYTE  bmaControls[1];                     // Bitmap
} UVC_VS_INTERFACE_INPUT_HEADER_DESCRIPTOR;

#define UVC_VS_INTERFACE_INPUT_HEADER_DESC_SIZE(p,n) (sizeof(UVC_VS_INTERFACE_INPUT_HEADER_DESCRIPTOR)-1+(p*n))


// Output Header Descriptor
// (USB_Video_Class_1.1.pdf, 3.9.2.2 Output Header Descriptor)
typedef __packed struct _UVC_VS_INTERFACE_OUTPUT_HEADER_DESCRIPTOR {
  BYTE  bLength;                            // size of this descriptor in bytes: 9+(p*n)
  BYTE  bDescriptorType;                    // CS_INTERFACE descriptor type
  BYTE  bDescriptorSubtype;                 // VC_OUTPUT_HEADER descriptor subtype
  WORD  bNumFormats;                        // number of video payload format descriptors: p
  WORD  wTotalLength;                       // total number of bytes for VS IF (incl. header)
  BYTE  bEndpointAddress;                   // EP used for video data
  BYTE  bTerminalLink;                      // ID of the connected Output Terminal
  BYTE  bControlSize;                       // size of each bmaConrtols field: n
  BYTE  bmaControls[1];                     // Bitmap
} UVC_VS_INTERFACE_OUTPUT_HEADER_DESCRIPTOR;

#define UVC_VS_INTERFACE_OUTPUT_HEADER_DESC_SIZE (sizeof(UVC_VS_INTERFACE_OUTPUT_HEADER_DESCRIPTOR)-1+(p*n))


// Output Header Descriptor
// (USB_Video_Class_1.1.pdf, 4.3.1.1 Video Probe and Commit Controls)
typedef __packed struct __UVC_VIDEO_PROBE_ANDCOMMIT_CONTROL {
  WORD  bmHint;                             // bitfield indicating what fields shall be kept fixed
  BYTE  bFormatIndex;                       // Video format index from a format descriptor
  BYTE  bFrameIndex;                        // Video frame index from a frame descriptor
  DWORD dwFrameInterval;                    // Frame intervall in 100 ns units
  WORD  wKeyFrameRate;                      // Key frame rate in key-frame per video-frame units
  WORD  wPFrameRate;                        // PFrame rate i PFrame/key frame units
  WORD  wCompQuality;                       // Compression quality control in abstarct units (0..10000)
  WORD  wCompWindowSize;                    // Window size for average bit rate control
  WORD  wDelay;                             // int. VS interface latency in ms from capture to presentation
  DWORD dwMaxVideoFrameSize;                // maximum video frame or codec specific segemet size in bytes
  DWORD dwMaxPayloadTransferSize;           // max. bytes the device can transmit/receive in single payload transfer
#if (UVC_VERSION == 0x0110)
  DWORD dwClockFrequency;                   // device clock frequency in Hz for sepcified format
  BYTE  bmFraminInfo;                       // bitfield control
  BYTE  bPreferedVersion;                   // preferred payload format version for specifide bFormatIndex
  BYTE  bMinVersion;                        // minimum payload format version for specifide bFormatIndex    
  BYTE  bMaxVersion;                        // maximum payload format version for specifide bFormatIndex
#endif   
} UVC_VIDEO_PROBE_AND_COMMIT_CONTROL; 



// Payload Format Descriptors
// (USB_Video_Class_1.1.pdf, 3.9.2.3 Output Header Descriptor)
// see seperate documents




#endif /* __UVC_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -