Change images to MJPEG
This commit is contained in:
@@ -110,8 +110,21 @@ static unsigned tx_busy = 0;
|
||||
static unsigned interval_ms = 1000 / FRAME_RATE;
|
||||
|
||||
/* YUY2 frame buffer */
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
#if 1
|
||||
#include "images.h"
|
||||
static struct {
|
||||
uint32_t size;
|
||||
uint8_t const *buffer;
|
||||
} const frames[] = {
|
||||
{color_bar_0_jpg_len, color_bar_0_jpg},
|
||||
{color_bar_1_jpg_len, color_bar_1_jpg},
|
||||
{color_bar_2_jpg_len, color_bar_2_jpg},
|
||||
{color_bar_3_jpg_len, color_bar_3_jpg},
|
||||
{color_bar_4_jpg_len, color_bar_4_jpg},
|
||||
{color_bar_5_jpg_len, color_bar_5_jpg},
|
||||
{color_bar_6_jpg_len, color_bar_6_jpg},
|
||||
{color_bar_7_jpg_len, color_bar_7_jpg},
|
||||
};
|
||||
#else
|
||||
static uint8_t frame_buffer[FRAME_WIDTH * FRAME_HEIGHT * 16 / 8];
|
||||
static void fill_color_bar(uint8_t *buffer, unsigned start_position)
|
||||
@@ -168,8 +181,7 @@ void video_task(void)
|
||||
already_sent = 1;
|
||||
start_ms = board_millis();
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t) &frame_buffer[(frame_num % (FRAME_WIDTH / 2)) * 4],
|
||||
FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)&frames[frame_num % 8].buffer, frames[frame_num % 8].size);
|
||||
#else
|
||||
fill_color_bar(frame_buffer, frame_num);
|
||||
tud_video_n_frame_xfer(0, 0, (void*)frame_buffer, FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
@@ -182,8 +194,7 @@ void video_task(void)
|
||||
start_ms += interval_ms;
|
||||
|
||||
#ifdef CFG_EXAMPLE_VIDEO_READONLY
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t) &frame_buffer[(frame_num % (FRAME_WIDTH / 2)) * 4],
|
||||
FRAME_WIDTH * FRAME_HEIGHT * 16/8);
|
||||
tud_video_n_frame_xfer(0, 0, (void*)(uintptr_t)&frames[frame_num % 8].buffer, frames[frame_num % 8].size);
|
||||
#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