summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/device/video_capture/src/main.c13
-rw-r--r--examples/device/video_capture/src/usb_descriptors.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/examples/device/video_capture/src/main.c b/examples/device/video_capture/src/main.c
index 6f47a1841..a38791365 100644
--- a/examples/device/video_capture/src/main.c
+++ b/examples/device/video_capture/src/main.c
@@ -110,11 +110,11 @@ static unsigned char const *frames[] = {
};
static unsigned current_frame = 0;
static unsigned tx_busy = 0;
+static unsigned interval_ms = 1000 / FRAME_RATE;
void video_task(void)
{
static unsigned start_ms = 0;
- static unsigned interval_ms = 1000 / FRAME_RATE;
static unsigned already_sent = 0;
if (!tud_video_n_streaming(0, 0)) {
@@ -137,7 +137,7 @@ void video_task(void)
tud_video_n_frame_xfer(0, 0, (void*)frames[current_frame], FRAME_WIDTH * FRAME_HEIGHT * 12/8);
}
-int tud_video_frame_xfer_complete_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx)
+void tud_video_frame_xfer_complete_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx)
{
(void)ctl_idx; (void)stm_idx;
tx_busy = 0;
@@ -145,7 +145,14 @@ int tud_video_frame_xfer_complete_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx)
++current_frame;
if (current_frame == sizeof(frames)/sizeof(frames[0]))
current_frame = 0;
- return 0;
+}
+
+int tud_video_commit_cb(uint_fast8_t ctl_idx, uint_fast8_t stm_idx,
+ video_probe_and_commit_control_t const *parameters)
+{
+ /* convert unit to ms from 100 ns */
+ interval_ms = parameters->dwFrameInterval / 10000;
+ return VIDEO_NO_ERROR;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/video_capture/src/usb_descriptors.h b/examples/device/video_capture/src/usb_descriptors.h
index 867e9af42..eff57f1fa 100644
--- a/examples/device/video_capture/src/usb_descriptors.h
+++ b/examples/device/video_capture/src/usb_descriptors.h
@@ -99,7 +99,7 @@ enum {
TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT(/*bFrameIndex */1, 0, _width, _height, \
_width * _height * 12, _width * _height * 12 * _fps, \
_width * _height * 12, \
- (10000000/_fps), (10000000/_fps), (10000000/_fps)*_fps, (10000000/_fps)), \
+ (10000000/_fps), (10000000/_fps), 10000000, 100000), \
TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING(VIDEO_COLOR_PRIMARIES_BT709, VIDEO_COLOR_XFER_CH_BT709, VIDEO_COLOR_COEF_SMPTE170M), \
/* VS alt 1 */\
TUD_VIDEO_DESC_STD_VS(1, 1, 1, 0), \