ESP-IDF 5.5 + LVGL 9 firmware that plays random public cameras from insecam.org on the T-Embed's 320x170 screen, live MJPEG where available, a new camera every 20 seconds. Knob steps through cameras, LED ring shows the countdown. Auto-detects the original vs CC1101 board, reuses Wi-Fi credentials from NVS and falls back to a captive-portal setup hotspot.
24 lines
925 B
C
24 lines
925 B
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
// Pulls complete JPEG files out of an arbitrary byte stream (single image,
|
|
// MJPEG multipart, junk in between) by walking the marker structure, so an
|
|
// EOI inside an EXIF thumbnail can't truncate a frame.
|
|
typedef struct {
|
|
int state;
|
|
uint8_t marker;
|
|
uint32_t remaining;
|
|
uint8_t *out;
|
|
size_t out_len, out_cap;
|
|
size_t skipped; // bytes discarded while hunting for SOI
|
|
} jpegframe_t;
|
|
|
|
void jpegframe_init(jpegframe_t *f, uint8_t *out, size_t out_cap);
|
|
void jpegframe_reset(jpegframe_t *f);
|
|
// Consumes input; returns the number of bytes used. *complete is set when
|
|
// out[0..out_len) holds a whole JPEG (unused input stays for the next call).
|
|
// *overflow is set if a frame outgrew the buffer; the extractor then resyncs.
|
|
size_t jpegframe_feed(jpegframe_t *f, const uint8_t *in, size_t n, bool *complete, bool *overflow);
|