Add motion jpeg
This commit is contained in:
@@ -112,6 +112,8 @@ static unsigned interval_ms = 1000 / FRAME_RATE;
|
||||
/* YUY2 frame buffer */
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
#include "images.h"
|
||||
|
||||
# if !defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPG)
|
||||
static struct {
|
||||
uint32_t size;
|
||||
uint8_t const *buffer;
|
||||
@@ -125,6 +127,8 @@ static struct {
|
||||
{color_bar_6_jpg_len, color_bar_6_jpg},
|
||||
{color_bar_7_jpg_len, color_bar_7_jpg},
|
||||
};
|
||||
# endif
|
||||
|
||||
#else
|
||||
static uint8_t frame_buffer[FRAME_WIDTH * FRAME_HEIGHT * 16 / 8];
|
||||
static void fill_color_bar(uint8_t *buffer, unsigned start_position)
|
||||
@@ -181,7 +185,12 @@ void video_task(void)
|
||||
already_sent = 1;
|
||||
start_ms = board_millis();
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
# if defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPG)
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)&frame_buffer[(frame_num % (FRAME_WIDTH / 2)) * 4],
|
||||
FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
# else
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)frames[frame_num % 8].buffer, frames[frame_num % 8].size);
|
||||
# endif
|
||||
#else
|
||||
fill_color_bar(frame_buffer, frame_num);
|
||||
tud_video_n_frame_xfer(0, 0, (void*)frame_buffer, FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
@@ -194,7 +203,12 @@ void video_task(void)
|
||||
start_ms += interval_ms;
|
||||
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
# if defined(CFG_EXAMPLE_VIDEO_DISABLE_MJPG)
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)&frame_buffer[(frame_num % (FRAME_WIDTH / 2)) * 4],
|
||||
FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
# else
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)frames[frame_num % 8].buffer, frames[frame_num % 8].size);
|
||||
# endif
|
||||
#else
|
||||
fill_color_bar(frame_buffer, frame_num);
|
||||
tud_video_n_frame_xfer(0, 0, (void*)frame_buffer, FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
|
Reference in New Issue
Block a user