Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * USB Video Class definitions.
0004  *
0005  * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be>
0006  *
0007  * This file holds USB constants and structures defined by the USB Device
0008  * Class Definition for Video Devices. Unless otherwise stated, comments
0009  * below reference relevant sections of the USB Video Class 1.1 specification
0010  * available at
0011  *
0012  * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip
0013  */
0014 
0015 #ifndef __LINUX_USB_VIDEO_H
0016 #define __LINUX_USB_VIDEO_H
0017 
0018 #include <linux/types.h>
0019 
0020 /* --------------------------------------------------------------------------
0021  * UVC constants
0022  */
0023 
0024 /* A.2. Video Interface Subclass Codes */
0025 #define UVC_SC_UNDEFINED                0x00
0026 #define UVC_SC_VIDEOCONTROL             0x01
0027 #define UVC_SC_VIDEOSTREAMING               0x02
0028 #define UVC_SC_VIDEO_INTERFACE_COLLECTION       0x03
0029 
0030 /* A.3. Video Interface Protocol Codes */
0031 #define UVC_PC_PROTOCOL_UNDEFINED           0x00
0032 #define UVC_PC_PROTOCOL_15              0x01
0033 
0034 /* A.5. Video Class-Specific VC Interface Descriptor Subtypes */
0035 #define UVC_VC_DESCRIPTOR_UNDEFINED         0x00
0036 #define UVC_VC_HEADER                   0x01
0037 #define UVC_VC_INPUT_TERMINAL               0x02
0038 #define UVC_VC_OUTPUT_TERMINAL              0x03
0039 #define UVC_VC_SELECTOR_UNIT                0x04
0040 #define UVC_VC_PROCESSING_UNIT              0x05
0041 #define UVC_VC_EXTENSION_UNIT               0x06
0042 
0043 /* A.6. Video Class-Specific VS Interface Descriptor Subtypes */
0044 #define UVC_VS_UNDEFINED                0x00
0045 #define UVC_VS_INPUT_HEADER             0x01
0046 #define UVC_VS_OUTPUT_HEADER                0x02
0047 #define UVC_VS_STILL_IMAGE_FRAME            0x03
0048 #define UVC_VS_FORMAT_UNCOMPRESSED          0x04
0049 #define UVC_VS_FRAME_UNCOMPRESSED           0x05
0050 #define UVC_VS_FORMAT_MJPEG             0x06
0051 #define UVC_VS_FRAME_MJPEG              0x07
0052 #define UVC_VS_FORMAT_MPEG2TS               0x0a
0053 #define UVC_VS_FORMAT_DV                0x0c
0054 #define UVC_VS_COLORFORMAT              0x0d
0055 #define UVC_VS_FORMAT_FRAME_BASED           0x10
0056 #define UVC_VS_FRAME_FRAME_BASED            0x11
0057 #define UVC_VS_FORMAT_STREAM_BASED          0x12
0058 
0059 /* A.7. Video Class-Specific Endpoint Descriptor Subtypes */
0060 #define UVC_EP_UNDEFINED                0x00
0061 #define UVC_EP_GENERAL                  0x01
0062 #define UVC_EP_ENDPOINT                 0x02
0063 #define UVC_EP_INTERRUPT                0x03
0064 
0065 /* A.8. Video Class-Specific Request Codes */
0066 #define UVC_RC_UNDEFINED                0x00
0067 #define UVC_SET_CUR                 0x01
0068 #define UVC_GET_CUR                 0x81
0069 #define UVC_GET_MIN                 0x82
0070 #define UVC_GET_MAX                 0x83
0071 #define UVC_GET_RES                 0x84
0072 #define UVC_GET_LEN                 0x85
0073 #define UVC_GET_INFO                    0x86
0074 #define UVC_GET_DEF                 0x87
0075 
0076 /* A.9.1. VideoControl Interface Control Selectors */
0077 #define UVC_VC_CONTROL_UNDEFINED            0x00
0078 #define UVC_VC_VIDEO_POWER_MODE_CONTROL         0x01
0079 #define UVC_VC_REQUEST_ERROR_CODE_CONTROL       0x02
0080 
0081 /* A.9.2. Terminal Control Selectors */
0082 #define UVC_TE_CONTROL_UNDEFINED            0x00
0083 
0084 /* A.9.3. Selector Unit Control Selectors */
0085 #define UVC_SU_CONTROL_UNDEFINED            0x00
0086 #define UVC_SU_INPUT_SELECT_CONTROL         0x01
0087 
0088 /* A.9.4. Camera Terminal Control Selectors */
0089 #define UVC_CT_CONTROL_UNDEFINED            0x00
0090 #define UVC_CT_SCANNING_MODE_CONTROL            0x01
0091 #define UVC_CT_AE_MODE_CONTROL              0x02
0092 #define UVC_CT_AE_PRIORITY_CONTROL          0x03
0093 #define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL       0x04
0094 #define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL       0x05
0095 #define UVC_CT_FOCUS_ABSOLUTE_CONTROL           0x06
0096 #define UVC_CT_FOCUS_RELATIVE_CONTROL           0x07
0097 #define UVC_CT_FOCUS_AUTO_CONTROL           0x08
0098 #define UVC_CT_IRIS_ABSOLUTE_CONTROL            0x09
0099 #define UVC_CT_IRIS_RELATIVE_CONTROL            0x0a
0100 #define UVC_CT_ZOOM_ABSOLUTE_CONTROL            0x0b
0101 #define UVC_CT_ZOOM_RELATIVE_CONTROL            0x0c
0102 #define UVC_CT_PANTILT_ABSOLUTE_CONTROL         0x0d
0103 #define UVC_CT_PANTILT_RELATIVE_CONTROL         0x0e
0104 #define UVC_CT_ROLL_ABSOLUTE_CONTROL            0x0f
0105 #define UVC_CT_ROLL_RELATIVE_CONTROL            0x10
0106 #define UVC_CT_PRIVACY_CONTROL              0x11
0107 
0108 /* A.9.5. Processing Unit Control Selectors */
0109 #define UVC_PU_CONTROL_UNDEFINED            0x00
0110 #define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL       0x01
0111 #define UVC_PU_BRIGHTNESS_CONTROL           0x02
0112 #define UVC_PU_CONTRAST_CONTROL             0x03
0113 #define UVC_PU_GAIN_CONTROL             0x04
0114 #define UVC_PU_POWER_LINE_FREQUENCY_CONTROL     0x05
0115 #define UVC_PU_HUE_CONTROL              0x06
0116 #define UVC_PU_SATURATION_CONTROL           0x07
0117 #define UVC_PU_SHARPNESS_CONTROL            0x08
0118 #define UVC_PU_GAMMA_CONTROL                0x09
0119 #define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL    0x0a
0120 #define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL   0x0b
0121 #define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL      0x0c
0122 #define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
0123 #define UVC_PU_DIGITAL_MULTIPLIER_CONTROL       0x0e
0124 #define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL     0x0f
0125 #define UVC_PU_HUE_AUTO_CONTROL             0x10
0126 #define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL        0x11
0127 #define UVC_PU_ANALOG_LOCK_STATUS_CONTROL       0x12
0128 
0129 /* A.9.7. VideoStreaming Interface Control Selectors */
0130 #define UVC_VS_CONTROL_UNDEFINED            0x00
0131 #define UVC_VS_PROBE_CONTROL                0x01
0132 #define UVC_VS_COMMIT_CONTROL               0x02
0133 #define UVC_VS_STILL_PROBE_CONTROL          0x03
0134 #define UVC_VS_STILL_COMMIT_CONTROL         0x04
0135 #define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL      0x05
0136 #define UVC_VS_STREAM_ERROR_CODE_CONTROL        0x06
0137 #define UVC_VS_GENERATE_KEY_FRAME_CONTROL       0x07
0138 #define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL     0x08
0139 #define UVC_VS_SYNC_DELAY_CONTROL           0x09
0140 
0141 /* B.1. USB Terminal Types */
0142 #define UVC_TT_VENDOR_SPECIFIC              0x0100
0143 #define UVC_TT_STREAMING                0x0101
0144 
0145 /* B.2. Input Terminal Types */
0146 #define UVC_ITT_VENDOR_SPECIFIC             0x0200
0147 #define UVC_ITT_CAMERA                  0x0201
0148 #define UVC_ITT_MEDIA_TRANSPORT_INPUT           0x0202
0149 
0150 /* B.3. Output Terminal Types */
0151 #define UVC_OTT_VENDOR_SPECIFIC             0x0300
0152 #define UVC_OTT_DISPLAY                 0x0301
0153 #define UVC_OTT_MEDIA_TRANSPORT_OUTPUT          0x0302
0154 
0155 /* B.4. External Terminal Types */
0156 #define UVC_EXTERNAL_VENDOR_SPECIFIC            0x0400
0157 #define UVC_COMPOSITE_CONNECTOR             0x0401
0158 #define UVC_SVIDEO_CONNECTOR                0x0402
0159 #define UVC_COMPONENT_CONNECTOR             0x0403
0160 
0161 /* 2.4.2.2. Status Packet Type */
0162 #define UVC_STATUS_TYPE_CONTROL             1
0163 #define UVC_STATUS_TYPE_STREAMING           2
0164 
0165 /* 2.4.3.3. Payload Header Information */
0166 #define UVC_STREAM_EOH                  (1 << 7)
0167 #define UVC_STREAM_ERR                  (1 << 6)
0168 #define UVC_STREAM_STI                  (1 << 5)
0169 #define UVC_STREAM_RES                  (1 << 4)
0170 #define UVC_STREAM_SCR                  (1 << 3)
0171 #define UVC_STREAM_PTS                  (1 << 2)
0172 #define UVC_STREAM_EOF                  (1 << 1)
0173 #define UVC_STREAM_FID                  (1 << 0)
0174 
0175 /* 4.1.2. Control Capabilities */
0176 #define UVC_CONTROL_CAP_GET             (1 << 0)
0177 #define UVC_CONTROL_CAP_SET             (1 << 1)
0178 #define UVC_CONTROL_CAP_DISABLED            (1 << 2)
0179 #define UVC_CONTROL_CAP_AUTOUPDATE          (1 << 3)
0180 #define UVC_CONTROL_CAP_ASYNCHRONOUS            (1 << 4)
0181 
0182 /* ------------------------------------------------------------------------
0183  * UVC structures
0184  */
0185 
0186 /* All UVC descriptors have these 3 fields at the beginning */
0187 struct uvc_descriptor_header {
0188     __u8  bLength;
0189     __u8  bDescriptorType;
0190     __u8  bDescriptorSubType;
0191 } __attribute__((packed));
0192 
0193 /* 3.7.2. Video Control Interface Header Descriptor */
0194 struct uvc_header_descriptor {
0195     __u8   bLength;
0196     __u8   bDescriptorType;
0197     __u8   bDescriptorSubType;
0198     __le16 bcdUVC;
0199     __le16 wTotalLength;
0200     __le32 dwClockFrequency;
0201     __u8   bInCollection;
0202     __u8   baInterfaceNr[];
0203 } __attribute__((__packed__));
0204 
0205 #define UVC_DT_HEADER_SIZE(n)               (12+(n))
0206 
0207 #define UVC_HEADER_DESCRIPTOR(n) \
0208     uvc_header_descriptor_##n
0209 
0210 #define DECLARE_UVC_HEADER_DESCRIPTOR(n)        \
0211 struct UVC_HEADER_DESCRIPTOR(n) {           \
0212     __u8   bLength;                 \
0213     __u8   bDescriptorType;             \
0214     __u8   bDescriptorSubType;          \
0215     __le16 bcdUVC;                  \
0216     __le16 wTotalLength;                \
0217     __le32 dwClockFrequency;            \
0218     __u8   bInCollection;               \
0219     __u8   baInterfaceNr[n];            \
0220 } __attribute__ ((packed))
0221 
0222 /* 3.7.2.1. Input Terminal Descriptor */
0223 struct uvc_input_terminal_descriptor {
0224     __u8   bLength;
0225     __u8   bDescriptorType;
0226     __u8   bDescriptorSubType;
0227     __u8   bTerminalID;
0228     __le16 wTerminalType;
0229     __u8   bAssocTerminal;
0230     __u8   iTerminal;
0231 } __attribute__((__packed__));
0232 
0233 #define UVC_DT_INPUT_TERMINAL_SIZE          8
0234 
0235 /* 3.7.2.2. Output Terminal Descriptor */
0236 struct uvc_output_terminal_descriptor {
0237     __u8   bLength;
0238     __u8   bDescriptorType;
0239     __u8   bDescriptorSubType;
0240     __u8   bTerminalID;
0241     __le16 wTerminalType;
0242     __u8   bAssocTerminal;
0243     __u8   bSourceID;
0244     __u8   iTerminal;
0245 } __attribute__((__packed__));
0246 
0247 #define UVC_DT_OUTPUT_TERMINAL_SIZE         9
0248 
0249 /* 3.7.2.3. Camera Terminal Descriptor */
0250 struct uvc_camera_terminal_descriptor {
0251     __u8   bLength;
0252     __u8   bDescriptorType;
0253     __u8   bDescriptorSubType;
0254     __u8   bTerminalID;
0255     __le16 wTerminalType;
0256     __u8   bAssocTerminal;
0257     __u8   iTerminal;
0258     __le16 wObjectiveFocalLengthMin;
0259     __le16 wObjectiveFocalLengthMax;
0260     __le16 wOcularFocalLength;
0261     __u8   bControlSize;
0262     __u8   bmControls[3];
0263 } __attribute__((__packed__));
0264 
0265 #define UVC_DT_CAMERA_TERMINAL_SIZE(n)          (15+(n))
0266 
0267 /* 3.7.2.4. Selector Unit Descriptor */
0268 struct uvc_selector_unit_descriptor {
0269     __u8  bLength;
0270     __u8  bDescriptorType;
0271     __u8  bDescriptorSubType;
0272     __u8  bUnitID;
0273     __u8  bNrInPins;
0274     __u8  baSourceID[0];
0275     __u8  iSelector;
0276 } __attribute__((__packed__));
0277 
0278 #define UVC_DT_SELECTOR_UNIT_SIZE(n)            (6+(n))
0279 
0280 #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
0281     uvc_selector_unit_descriptor_##n
0282 
0283 #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
0284 struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) {        \
0285     __u8  bLength;                  \
0286     __u8  bDescriptorType;              \
0287     __u8  bDescriptorSubType;           \
0288     __u8  bUnitID;                  \
0289     __u8  bNrInPins;                \
0290     __u8  baSourceID[n];                \
0291     __u8  iSelector;                \
0292 } __attribute__ ((packed))
0293 
0294 /* 3.7.2.5. Processing Unit Descriptor */
0295 struct uvc_processing_unit_descriptor {
0296     __u8   bLength;
0297     __u8   bDescriptorType;
0298     __u8   bDescriptorSubType;
0299     __u8   bUnitID;
0300     __u8   bSourceID;
0301     __le16 wMaxMultiplier;
0302     __u8   bControlSize;
0303     __u8   bmControls[2];
0304     __u8   iProcessing;
0305     __u8   bmVideoStandards;
0306 } __attribute__((__packed__));
0307 
0308 #define UVC_DT_PROCESSING_UNIT_SIZE(n)          (10+(n))
0309 
0310 /* 3.7.2.6. Extension Unit Descriptor */
0311 struct uvc_extension_unit_descriptor {
0312     __u8  bLength;
0313     __u8  bDescriptorType;
0314     __u8  bDescriptorSubType;
0315     __u8  bUnitID;
0316     __u8  guidExtensionCode[16];
0317     __u8  bNumControls;
0318     __u8  bNrInPins;
0319     __u8  baSourceID[0];
0320     __u8  bControlSize;
0321     __u8  bmControls[0];
0322     __u8  iExtension;
0323 } __attribute__((__packed__));
0324 
0325 #define UVC_DT_EXTENSION_UNIT_SIZE(p, n)        (24+(p)+(n))
0326 
0327 #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
0328     uvc_extension_unit_descriptor_##p_##n
0329 
0330 #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
0331 struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) {        \
0332     __u8  bLength;                  \
0333     __u8  bDescriptorType;              \
0334     __u8  bDescriptorSubType;           \
0335     __u8  bUnitID;                  \
0336     __u8  guidExtensionCode[16];            \
0337     __u8  bNumControls;             \
0338     __u8  bNrInPins;                \
0339     __u8  baSourceID[p];                \
0340     __u8  bControlSize;             \
0341     __u8  bmControls[n];                \
0342     __u8  iExtension;               \
0343 } __attribute__ ((packed))
0344 
0345 /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
0346 struct uvc_control_endpoint_descriptor {
0347     __u8   bLength;
0348     __u8   bDescriptorType;
0349     __u8   bDescriptorSubType;
0350     __le16 wMaxTransferSize;
0351 } __attribute__((__packed__));
0352 
0353 #define UVC_DT_CONTROL_ENDPOINT_SIZE            5
0354 
0355 /* 3.9.2.1. Input Header Descriptor */
0356 struct uvc_input_header_descriptor {
0357     __u8   bLength;
0358     __u8   bDescriptorType;
0359     __u8   bDescriptorSubType;
0360     __u8   bNumFormats;
0361     __le16 wTotalLength;
0362     __u8   bEndpointAddress;
0363     __u8   bmInfo;
0364     __u8   bTerminalLink;
0365     __u8   bStillCaptureMethod;
0366     __u8   bTriggerSupport;
0367     __u8   bTriggerUsage;
0368     __u8   bControlSize;
0369     __u8   bmaControls[];
0370 } __attribute__((__packed__));
0371 
0372 #define UVC_DT_INPUT_HEADER_SIZE(n, p)          (13+(n*p))
0373 
0374 #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
0375     uvc_input_header_descriptor_##n_##p
0376 
0377 #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p)   \
0378 struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) {      \
0379     __u8   bLength;                 \
0380     __u8   bDescriptorType;             \
0381     __u8   bDescriptorSubType;          \
0382     __u8   bNumFormats;             \
0383     __le16 wTotalLength;                \
0384     __u8   bEndpointAddress;            \
0385     __u8   bmInfo;                  \
0386     __u8   bTerminalLink;               \
0387     __u8   bStillCaptureMethod;         \
0388     __u8   bTriggerSupport;             \
0389     __u8   bTriggerUsage;               \
0390     __u8   bControlSize;                \
0391     __u8   bmaControls[p][n];           \
0392 } __attribute__ ((packed))
0393 
0394 /* 3.9.2.2. Output Header Descriptor */
0395 struct uvc_output_header_descriptor {
0396     __u8   bLength;
0397     __u8   bDescriptorType;
0398     __u8   bDescriptorSubType;
0399     __u8   bNumFormats;
0400     __le16 wTotalLength;
0401     __u8   bEndpointAddress;
0402     __u8   bTerminalLink;
0403     __u8   bControlSize;
0404     __u8   bmaControls[];
0405 } __attribute__((__packed__));
0406 
0407 #define UVC_DT_OUTPUT_HEADER_SIZE(n, p)         (9+(n*p))
0408 
0409 #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
0410     uvc_output_header_descriptor_##n_##p
0411 
0412 #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p)  \
0413 struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) {     \
0414     __u8   bLength;                 \
0415     __u8   bDescriptorType;             \
0416     __u8   bDescriptorSubType;          \
0417     __u8   bNumFormats;             \
0418     __le16 wTotalLength;                \
0419     __u8   bEndpointAddress;            \
0420     __u8   bTerminalLink;               \
0421     __u8   bControlSize;                \
0422     __u8   bmaControls[p][n];           \
0423 } __attribute__ ((packed))
0424 
0425 /* 3.9.2.6. Color matching descriptor */
0426 struct uvc_color_matching_descriptor {
0427     __u8  bLength;
0428     __u8  bDescriptorType;
0429     __u8  bDescriptorSubType;
0430     __u8  bColorPrimaries;
0431     __u8  bTransferCharacteristics;
0432     __u8  bMatrixCoefficients;
0433 } __attribute__((__packed__));
0434 
0435 #define UVC_DT_COLOR_MATCHING_SIZE          6
0436 
0437 /* 4.3.1.1. Video Probe and Commit Controls */
0438 struct uvc_streaming_control {
0439     __u16 bmHint;
0440     __u8  bFormatIndex;
0441     __u8  bFrameIndex;
0442     __u32 dwFrameInterval;
0443     __u16 wKeyFrameRate;
0444     __u16 wPFrameRate;
0445     __u16 wCompQuality;
0446     __u16 wCompWindowSize;
0447     __u16 wDelay;
0448     __u32 dwMaxVideoFrameSize;
0449     __u32 dwMaxPayloadTransferSize;
0450     __u32 dwClockFrequency;
0451     __u8  bmFramingInfo;
0452     __u8  bPreferedVersion;
0453     __u8  bMinVersion;
0454     __u8  bMaxVersion;
0455 } __attribute__((__packed__));
0456 
0457 /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
0458 struct uvc_format_uncompressed {
0459     __u8  bLength;
0460     __u8  bDescriptorType;
0461     __u8  bDescriptorSubType;
0462     __u8  bFormatIndex;
0463     __u8  bNumFrameDescriptors;
0464     __u8  guidFormat[16];
0465     __u8  bBitsPerPixel;
0466     __u8  bDefaultFrameIndex;
0467     __u8  bAspectRatioX;
0468     __u8  bAspectRatioY;
0469     __u8  bmInterfaceFlags;
0470     __u8  bCopyProtect;
0471 } __attribute__((__packed__));
0472 
0473 #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE         27
0474 
0475 /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
0476 struct uvc_frame_uncompressed {
0477     __u8   bLength;
0478     __u8   bDescriptorType;
0479     __u8   bDescriptorSubType;
0480     __u8   bFrameIndex;
0481     __u8   bmCapabilities;
0482     __le16 wWidth;
0483     __le16 wHeight;
0484     __le32 dwMinBitRate;
0485     __le32 dwMaxBitRate;
0486     __le32 dwMaxVideoFrameBufferSize;
0487     __le32 dwDefaultFrameInterval;
0488     __u8   bFrameIntervalType;
0489     __le32 dwFrameInterval[];
0490 } __attribute__((__packed__));
0491 
0492 #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n)       (26+4*(n))
0493 
0494 #define UVC_FRAME_UNCOMPRESSED(n) \
0495     uvc_frame_uncompressed_##n
0496 
0497 #define DECLARE_UVC_FRAME_UNCOMPRESSED(n)       \
0498 struct UVC_FRAME_UNCOMPRESSED(n) {          \
0499     __u8   bLength;                 \
0500     __u8   bDescriptorType;             \
0501     __u8   bDescriptorSubType;          \
0502     __u8   bFrameIndex;             \
0503     __u8   bmCapabilities;              \
0504     __le16 wWidth;                  \
0505     __le16 wHeight;                 \
0506     __le32 dwMinBitRate;                \
0507     __le32 dwMaxBitRate;                \
0508     __le32 dwMaxVideoFrameBufferSize;       \
0509     __le32 dwDefaultFrameInterval;          \
0510     __u8   bFrameIntervalType;          \
0511     __le32 dwFrameInterval[n];          \
0512 } __attribute__ ((packed))
0513 
0514 /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
0515 struct uvc_format_mjpeg {
0516     __u8  bLength;
0517     __u8  bDescriptorType;
0518     __u8  bDescriptorSubType;
0519     __u8  bFormatIndex;
0520     __u8  bNumFrameDescriptors;
0521     __u8  bmFlags;
0522     __u8  bDefaultFrameIndex;
0523     __u8  bAspectRatioX;
0524     __u8  bAspectRatioY;
0525     __u8  bmInterfaceFlags;
0526     __u8  bCopyProtect;
0527 } __attribute__((__packed__));
0528 
0529 #define UVC_DT_FORMAT_MJPEG_SIZE            11
0530 
0531 /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
0532 struct uvc_frame_mjpeg {
0533     __u8   bLength;
0534     __u8   bDescriptorType;
0535     __u8   bDescriptorSubType;
0536     __u8   bFrameIndex;
0537     __u8   bmCapabilities;
0538     __le16 wWidth;
0539     __le16 wHeight;
0540     __le32 dwMinBitRate;
0541     __le32 dwMaxBitRate;
0542     __le32 dwMaxVideoFrameBufferSize;
0543     __le32 dwDefaultFrameInterval;
0544     __u8   bFrameIntervalType;
0545     __le32 dwFrameInterval[];
0546 } __attribute__((__packed__));
0547 
0548 #define UVC_DT_FRAME_MJPEG_SIZE(n)          (26+4*(n))
0549 
0550 #define UVC_FRAME_MJPEG(n) \
0551     uvc_frame_mjpeg_##n
0552 
0553 #define DECLARE_UVC_FRAME_MJPEG(n)          \
0554 struct UVC_FRAME_MJPEG(n) {             \
0555     __u8   bLength;                 \
0556     __u8   bDescriptorType;             \
0557     __u8   bDescriptorSubType;          \
0558     __u8   bFrameIndex;             \
0559     __u8   bmCapabilities;              \
0560     __le16 wWidth;                  \
0561     __le16 wHeight;                 \
0562     __le32 dwMinBitRate;                \
0563     __le32 dwMaxBitRate;                \
0564     __le32 dwMaxVideoFrameBufferSize;       \
0565     __le32 dwDefaultFrameInterval;          \
0566     __u8   bFrameIntervalType;          \
0567     __le32 dwFrameInterval[n];          \
0568 } __attribute__ ((packed))
0569 
0570 #endif /* __LINUX_USB_VIDEO_H */
0571