Implement frame rate settings
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@@ -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), \
|
||||
|
Reference in New Issue
Block a user