diff options
| author | sakumisu <[email protected]> | 2026-06-16 21:52:04 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-06-16 21:52:15 +0800 |
| commit | 0ae587a64c533530dc6a06a3c6863eba98fd88c1 (patch) | |
| tree | a30437fec89371c954b14f4031941ca4854383a2 | |
| parent | f4b4dc682edcaa61339c27ed36510aedd425caaa (diff) | |
update(class/video): change frame interval config to only one
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | class/video/usb_video.h | 48 | ||||
| -rw-r--r-- | demo/video_audiov1_hid_template.c | 2 | ||||
| -rw-r--r-- | demo/video_static_h264_template.c | 2 | ||||
| -rw-r--r-- | demo/video_static_mjpeg_template.c | 2 | ||||
| -rw-r--r-- | demo/video_static_yuyv_template.c | 2 |
5 files changed, 29 insertions, 27 deletions
diff --git a/class/video/usb_video.h b/class/video/usb_video.h index 8f95992b..6b1a9ac5 100644 --- a/class/video/usb_video.h +++ b/class/video/usb_video.h @@ -1159,7 +1159,7 @@ struct video_autoexposure_mode { 0x09, \ 0x24, \ VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE, \ - 0x03, /* bTerminalID */ \ + 0x03, /* bTerminalID */ \ WBVAL(VIDEO_TT_STREAMING), \ 0x00, /* bAssocTerminal */ \ 0x02, /* bSourceID */ \ @@ -1173,7 +1173,7 @@ struct video_autoexposure_mode { /* Class-specific VC Interrupt Endpoint Descriptor */ \ 0x05, 0x25, 0x03, 0x10, 0x00 -#define VIDEO_VC_NOEP_DESCRIPTOR_INIT(bFirstInterface, bEndpointAddress, bcdUVC, wTotalLength, dwClockFrequency, stridx) \ +#define VIDEO_VC_NOEP_DESCRIPTOR_INIT(bFirstInterface, bEndpointAddress, bcdUVC, wTotalLength, dwClockFrequency, stridx) \ /* Interface Association Descriptor */ \ 0x08, \ USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, \ @@ -1187,11 +1187,12 @@ struct video_autoexposure_mode { USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ 0x00, /* bInterfaceNumber */ \ 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints:1 endpoint (interrupt endpoint) */ \ + 0x00, /* bNumEndpoints:0 endpoint (interrupt endpoint) */ \ USB_DEVICE_CLASS_VIDEO, /* bInterfaceClass : CC_VIDEO */ \ VIDEO_SC_VIDEOCONTROL, /* bInterfaceSubClass : SC_VIDEOCONTROL */ \ VIDEO_PC_PROTOCOL_UNDEFINED, /* bInterfaceProtocol : PC_PROTOCOL_UNDEFINED */ \ - stridx, /* iInterface:Index to string descriptor that contains the string <Your Product Name> */ /*Class-specific VideoControl Interface Descriptor */ \ + stridx, /* iInterface:Index to string descriptor that contains the string <Your Product Name> */\ + /*Class-specific VideoControl Interface Descriptor */ \ 0x0d, /* bLength */ \ 0x24, /* bDescriptorType : CS_INTERFACE */ \ VIDEO_VC_HEADER_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VC_HEADER subtype */ \ @@ -1199,7 +1200,8 @@ struct video_autoexposure_mode { WBVAL(wTotalLength), /* wTotalLength */ \ DBVAL(dwClockFrequency), /* dwClockFrequency : 0x005b8d80 -> 6,000,000 == 6MHz*/ \ 0x01, /* bInCollection : Number of streaming interfaces. */ \ - (uint8_t)(bFirstInterface + 1), /* baInterfaceNr(0) : VideoStreaming interface 1 belongs to this VideoControl interface.*/ /* Input Terminal 1 -> Processing Unit 2 -> Output Terminal 3 */ \ + (uint8_t)(bFirstInterface + 1), /* baInterfaceNr(0) : VideoStreaming interface 1 belongs to this VideoControl interface.*/ \ + /* Input Terminal 1 -> Processing Unit 2 -> Output Terminal 3 */ \ 0x12, \ 0x24, \ VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE, \ @@ -1225,7 +1227,7 @@ struct video_autoexposure_mode { 0x09, \ 0x24, \ VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE, \ - 0x03, /* bTerminalID */ \ + 0x03, /* bTerminalID */ \ WBVAL(VIDEO_TT_STREAMING), \ 0x00, /* bAssocTerminal */ \ 0x02, /* bSourceID */ \ @@ -1256,7 +1258,7 @@ struct video_autoexposure_mode { 0x00, /* bStillCaptureMethod : Device supports still image capture method 0. */ \ 0x00, /* bTriggerSupport : Hardware trigger supported for still image capture */ \ 0x00, /* bTriggerUsage : Hardware trigger should initiate a still image capture. */ \ - 0x01, /* bControlSize : Size of the bmaControls field */ \ + PP_NARG(__VA_ARGS__), /* bControlSize : Size of the bmaControls field */ \ __VA_ARGS__ /* bmaControls : No VideoStreaming specific controls are supported.*/ #define VIDEO_VS_OUTPUT_HEADER_DESCRIPTOR_INIT(bNumFormats, wTotalLength, bEndpointAddress, ...) \ @@ -1291,8 +1293,8 @@ struct video_autoexposure_mode { 0x00 /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */ #define VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_INIT(bFrameIndex, wWidth, wHeight, dwMinBitRate, dwMaxBitRate, \ - dwMaxVideoFrameBufferSize, dwDefaultFrameInterval, bFrameIntervalType, ...) \ - 0x1a + PP_NARG(__VA_ARGS__), \ + dwMaxVideoFrameBufferSize, dwDefaultFrameInterval) \ + 0x1E, \ 0x24, \ VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_SUBTYPE, \ bFrameIndex, \ @@ -1302,13 +1304,13 @@ struct video_autoexposure_mode { DBVAL(dwMinBitRate), \ DBVAL(dwMaxBitRate), \ DBVAL(dwMaxVideoFrameBufferSize), \ - dwDefaultFrameInterval, /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ - bFrameIntervalType, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ - __VA_ARGS__ + DBVAL(dwDefaultFrameInterval), /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ + 0x01, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ + DBVAL(dwDefaultFrameInterval) #define VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_INIT(bFormatIndex, bNumFrameDescriptors) \ /*Payload Format(MJPEG) Descriptor */ \ - 0x0b, /* bLength */ \ + 0x0b, /* bLength */ \ 0x24, /* bDescriptorType : CS_INTERFACE */ \ 0x06, /* bDescriptorSubType : VS_FORMAT_MJPEG subtype */ \ bFormatIndex, /* bFormatIndex : First (and only) format descriptor */ \ @@ -1321,8 +1323,8 @@ struct video_autoexposure_mode { 0x00 /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */ #define VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(bFrameIndex, wWidth, wHeight, dwMinBitRate, dwMaxBitRate, \ - dwMaxVideoFrameBufferSize, dwDefaultFrameInterval, bFrameIntervalType, ...) \ - 0x1a + PP_NARG(__VA_ARGS__), /* bLength */ \ + dwMaxVideoFrameBufferSize, dwDefaultFrameInterval) \ + 0x1E, /* bLength */ \ 0x24, /* bDescriptorType : CS_INTERFACE */ \ VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VS_FRAME_MJPEG */ \ bFrameIndex, /* bFrameIndex : First (and only) frame descriptor */ \ @@ -1332,9 +1334,9 @@ struct video_autoexposure_mode { DBVAL(dwMinBitRate), /* dwMinBitRate (4bytes): Min bit rate in bits/s */ \ DBVAL(dwMaxBitRate), /* dwMaxBitRate (4bytes): Max bit rate in bits/s */ \ DBVAL(dwMaxVideoFrameBufferSize), /* dwMaxVideoFrameBufSize (4bytes): Maximum video or still frame size, in bytes. */ \ - dwDefaultFrameInterval, /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ - bFrameIntervalType, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ - __VA_ARGS__ + DBVAL(dwDefaultFrameInterval), /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ + 0x01, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ + DBVAL(dwDefaultFrameInterval) #define VIDEO_VS_FORMAT_H264_DESCRIPTOR_INIT(bFormatIndex, bNumFrameDescriptors) \ /*Payload Format(H.264) Descriptor */ \ @@ -1353,8 +1355,8 @@ struct video_autoexposure_mode { 0x00 /* Variable size: False */ #define VIDEO_VS_FRAME_H264_DESCRIPTOR_INIT(bFrameIndex, wWidth, wHeight, dwMinBitRate, dwMaxBitRate, \ - dwDefaultFrameInterval, bFrameIntervalType, ...) \ - 0x1a + PP_NARG(__VA_ARGS__), /* bLength */ \ + dwDefaultFrameInterval) \ + 0x1E, /* bLength */ \ 0x24, /* bDescriptorType : CS_INTERFACE */ \ VIDEO_VS_FRAME_FRAME_BASED_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VS_FRAME_BASED */ \ bFrameIndex, /* bFrameIndex : First (and only) frame descriptor */ \ @@ -1363,10 +1365,10 @@ struct video_autoexposure_mode { WBVAL(wHeight), /* wHeight (2bytes): Height of frame is 64 pixels. */ \ DBVAL(dwMinBitRate), /* dwMinBitRate (4bytes): Min bit rate in bits/s */ \ DBVAL(dwMaxBitRate), /* dwMaxBitRate (4bytes): Max bit rate in bits/s */ \ - dwDefaultFrameInterval, /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ - bFrameIntervalType, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ + DBVAL(dwDefaultFrameInterval), /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ + 0x01, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ DBVAL(0x00), /* dwBytesPerLine (4bytes) */ \ - __VA_ARGS__ + DBVAL(dwDefaultFrameInterval) #define VIDEO_VS_COLOR_MATCHING_DESCRIPTOR_INIT() \ 0x06, /* bLength */ \ diff --git a/demo/video_audiov1_hid_template.c b/demo/video_audiov1_hid_template.c index 0ab81775..7a06aaa4 100644 --- a/demo/video_audiov1_hid_template.c +++ b/demo/video_audiov1_hid_template.c @@ -114,7 +114,7 @@ static const uint8_t config_descriptor[] = { VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x00, 0x00), VIDEO_VS_INPUT_HEADER_DESCRIPTOR_INIT(0x01, VS_HEADER_SIZ, VIDEO_IN_EP, 0x00), VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_INIT(0x01, 0x01), - VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, DBVAL(INTERVAL), 0x01, DBVAL(INTERVAL)), + VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, INTERVAL), VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x01, 0x01), /* 1.2.2.2 Standard VideoStream Isochronous Video Data Endpoint Descriptor */ USB_ENDPOINT_DESCRIPTOR_INIT(VIDEO_IN_EP, 0x05, VIDEO_PACKET_SIZE, 0x01), diff --git a/demo/video_static_h264_template.c b/demo/video_static_h264_template.c index 825e94e9..8d4083e4 100644 --- a/demo/video_static_h264_template.c +++ b/demo/video_static_h264_template.c @@ -59,7 +59,7 @@ static const uint8_t config_descriptor[] = { VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x00, 0x00), VIDEO_VS_INPUT_HEADER_DESCRIPTOR_INIT(0x01, VS_HEADER_SIZ, VIDEO_IN_EP, 0x00), VIDEO_VS_FORMAT_H264_DESCRIPTOR_INIT(0x01, 0x01), - VIDEO_VS_FRAME_H264_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, DBVAL(INTERVAL), 0x01, DBVAL(INTERVAL)), + VIDEO_VS_FRAME_H264_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, INTERVAL), VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x01, 0x01), /* 1.2.2.2 Standard VideoStream Isochronous Video Data Endpoint Descriptor */ USB_ENDPOINT_DESCRIPTOR_INIT(VIDEO_IN_EP, 0x05, VIDEO_PACKET_SIZE, 0x01) diff --git a/demo/video_static_mjpeg_template.c b/demo/video_static_mjpeg_template.c index 8f76ce7b..8ae8514b 100644 --- a/demo/video_static_mjpeg_template.c +++ b/demo/video_static_mjpeg_template.c @@ -59,7 +59,7 @@ static const uint8_t config_descriptor[] = { VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x00, 0x00), VIDEO_VS_INPUT_HEADER_DESCRIPTOR_INIT(0x01, VS_HEADER_SIZ, VIDEO_IN_EP, 0x00), VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_INIT(0x01, 0x01), - VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, DBVAL(INTERVAL), 0x01, DBVAL(INTERVAL)), + VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, INTERVAL), VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x01, 0x01), /* 1.2.2.2 Standard VideoStream Isochronous Video Data Endpoint Descriptor */ USB_ENDPOINT_DESCRIPTOR_INIT(VIDEO_IN_EP, 0x05, VIDEO_PACKET_SIZE, 0x01) diff --git a/demo/video_static_yuyv_template.c b/demo/video_static_yuyv_template.c index 9cda27bc..1b7383ab 100644 --- a/demo/video_static_yuyv_template.c +++ b/demo/video_static_yuyv_template.c @@ -60,7 +60,7 @@ static const uint8_t config_descriptor[] = { VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x00, 0x00), VIDEO_VS_INPUT_HEADER_DESCRIPTOR_INIT(0x01, VS_HEADER_SIZ, VIDEO_IN_EP, 0x00), VIDEO_VS_FORMAT_UNCOMPRESSED_DESCRIPTOR_INIT(0x01, 0x01, VIDEO_GUID_YUY2), - VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, DBVAL(INTERVAL), 0x01, DBVAL(INTERVAL)), + VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_INIT(0x01, WIDTH, HEIGHT, MIN_BIT_RATE, MAX_BIT_RATE, MAX_FRAME_SIZE, INTERVAL), VIDEO_VS_COLOR_MATCHING_DESCRIPTOR_INIT(), VIDEO_VS_DESCRIPTOR_INIT(0x01, 0x01, 0x01), /* 1.2.2.2 Standard VideoStream Isochronous Video Data Endpoint Descriptor */ |
