update(class/video): change headerlen to 12 for 4 byte align, fix encoding

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-05-29 10:46:52 +08:00
parent c75e62c1e9
commit 8a81d81435
2 changed files with 7 additions and 6 deletions

View File

@@ -1237,7 +1237,7 @@ struct video_autoexposure_mode {
USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType : INTERFACE */ \
bInterfaceNumber, /* bInterfaceNumber: Index of this interface */ \
bAlternateSetting, /* bAlternateSetting: Index of this alternate setting */ \
bNumEndpoints, /* bNumEndpoints : 0 endpoints no bandwidth used*/ \
bNumEndpoints, /* bNumEndpoints : 0 endpoints, no bandwidth used*/ \
0x0e, /* bInterfaceClass : CC_VIDEO */ \
0x02, /* bInterfaceSubClass : SC_VIDEOSTREAMING */ \
0x00, /* bInterfaceProtocol : PC_PROTOCOL_UNDEFINED */ \
@@ -1315,8 +1315,8 @@ struct video_autoexposure_mode {
bNumFrameDescriptors, /* bNumFrameDescriptors : One frame descriptor for this format follows. */ \
0x00, /* bmFlags : Uses fixed size samples.. */ \
0x01, /* bDefaultFrameIndex : Default frame index is 1. */ \
0x00, /* bAspectRatioX : Non-interlaced stream not required. */ \
0x00, /* bAspectRatioY : Non-interlaced stream not required. */ \
0x00, /* bAspectRatioX : Non-interlaced stream, not required. */ \
0x00, /* bAspectRatioY : Non-interlaced stream, not required. */ \
0x00, /* bmInterlaceFlags : Non-interlaced stream */ \
0x00 /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */
@@ -1346,8 +1346,8 @@ struct video_autoexposure_mode {
VIDEO_GUID_H264, \
0x00, /* bmFlags : Uses fixed size samples.. */ \
0x01, /* bDefaultFrameIndex : Default frame index is 1. */ \
0x00, /* bAspectRatioX : Non-interlaced stream not required. */ \
0x00, /* bAspectRatioY : Non-interlaced stream not required. */ \
0x00, /* bAspectRatioX : Non-interlaced stream, not required. */ \
0x00, /* bAspectRatioY : Non-interlaced stream, not required. */ \
0x00, /* bmInterlaceFlags : Non-interlaced stream */ \
0x00, /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */ \
0x00 /* Variable size: False */

View File

@@ -747,7 +747,7 @@ static void usbd_video_probe_and_commit_controls_init(uint8_t busid, uint32_t dw
g_usbd_video[busid].commit.bMaxVersion = 0;
g_usbd_video[busid].stream_frameid = 0;
g_usbd_video[busid].stream_headerlen = 2;
g_usbd_video[busid].stream_headerlen = 12;
}
struct usbd_interface *usbd_video_init_intf(uint8_t busid,
@@ -799,6 +799,7 @@ bool usbd_video_stream_split_transfer(uint8_t busid, uint8_t ep)
header = (struct video_payload_header *)&g_usbd_video[busid].stream_buf[offset - g_usbd_video[busid].stream_headerlen];
}
memset(header, 0, g_usbd_video[busid].stream_headerlen);
header->bHeaderLength = g_usbd_video[busid].stream_headerlen;
header->headerInfoUnion.bmheaderInfo = 0;
header->headerInfoUnion.headerInfoBits.endOfHeader = 1;