summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2025-05-29 10:46:52 +0800
committersakumisu <[email protected]>2025-05-29 10:47:10 +0800
commit8a81d814350a37c53eb5857d28df7dea23df8abb (patch)
treec2c1005ab7048667b2ebee34178897dbcabe7c9d
parentc75e62c1e98471dba58461fc8a568b00ae789e29 (diff)
update(class/video): change headerlen to 12 for 4 byte align, fix encoding
Signed-off-by: sakumisu <[email protected]>
-rw-r--r--class/video/usb_video.h10
-rw-r--r--class/video/usbd_video.c3
2 files changed, 7 insertions, 6 deletions
diff --git a/class/video/usb_video.h b/class/video/usb_video.h
index ff36fece..8f95992b 100644
--- a/class/video/usb_video.h
+++ b/class/video/usb_video.h
@@ -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 */
diff --git a/class/video/usbd_video.c b/class/video/usbd_video.c
index b94379df..a4e53162 100644
--- a/class/video/usbd_video.c
+++ b/class/video/usbd_video.c
@@ -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;