summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTobi <[email protected]>2025-10-30 15:01:52 +0100
committerTobi <[email protected]>2025-10-30 15:01:52 +0100
commit889cde7d4b31b30f34abc6e304445403bdf4ced4 (patch)
tree5e8b2195ba39d5ad821c981420d202bcdd4d024e /src
parentb8cea4ad766ea40de88fdaa28c19e69f5bc25f9d (diff)
Video class: Changed pararameters of payload request to a dedicated structure in order to meet coding guideliness
Diffstat (limited to 'src')
-rw-r--r--src/class/video/video_device.c13
-rw-r--r--src/class/video/video_device.h12
2 files changed, 19 insertions, 6 deletions
diff --git a/src/class/video/video_device.c b/src/class/video/video_device.c
index 00f192af6..326f5c13d 100644
--- a/src/class/video/video_device.c
+++ b/src/class/video/video_device.c
@@ -214,12 +214,10 @@ TU_ATTR_WEAK int tud_video_commit_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx,
return VIDEO_ERROR_NONE;
}
-TU_ATTR_WEAK void tud_video_prepare_payload_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, void* payload_buf, size_t payload_size, size_t offset) {
+TU_ATTR_WEAK void tud_video_prepare_payload_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, tud_video_payload_request_t* request) {
(void) ctl_idx;
(void) stm_idx;
- (void) payload_buf;
- (void) payload_size;
- (void) offset;
+ (void) request;
}
//--------------------------------------------------------------------+
@@ -871,7 +869,12 @@ static uint_fast16_t _prepare_in_payload(videod_streaming_interface_t *stm, uint
if (stm->buffer) {
memcpy(&ep_buf[hdr_len], stm->buffer + stm->offset, data_len);
} else {
- tud_video_prepare_payload_cb(stm->index_vc, stm->index_vs, &ep_buf[hdr_len], data_len, stm->offset);
+ tud_video_payload_request_t rqst = {
+ .buf = &ep_buf[hdr_len],
+ .length = data_len,
+ .offset = stm->offset
+ };
+ tud_video_prepare_payload_cb(stm->index_vc, stm->index_vs, &rqst);
}
stm->offset += data_len;
remaining -= data_len;
diff --git a/src/class/video/video_device.h b/src/class/video/video_device.h
index b3094dd81..f14555e4f 100644
--- a/src/class/video/video_device.h
+++ b/src/class/video/video_device.h
@@ -35,6 +35,16 @@
extern "C" {
#endif
+
+//--------------------------------------------------------------------+
+// Payload request
+//--------------------------------------------------------------------+
+typedef struct TU_ATTR_PACKED {
+ void* buf; /* Payload buffer to be filled */
+ size_t length; /* Length of the requested data in bytes */
+ size_t offset; /* Offset within the frame (in bytes) */
+} tud_video_payload_request_t;
+
//--------------------------------------------------------------------+
// Application API (Multiple Ports)
// CFG_TUD_VIDEO > 1
@@ -91,7 +101,7 @@ int tud_video_commit_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx,
* @param[in] payload_size Size of payload_buf (requested data size)
* @param[in] offset Current byte offset relative to given bufsize from tud_video_n_frame_xfer (framesize)
* @return video_error_code_t */
-void tud_video_prepare_payload_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, void* payload_buf, size_t payload_size, size_t offset);
+void tud_video_prepare_payload_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx, tud_video_payload_request_t* request);
//--------------------------------------------------------------------+
// INTERNAL USBD-CLASS DRIVER API