64 char hdr[kFledHeaderBytes];
66 const bool hasFledMagic = got >= 4
67 &&
static_cast<fl::u8>(hdr[0]) == kFledMagic[0]
68 &&
static_cast<fl::u8>(hdr[1]) == kFledMagic[1]
69 &&
static_cast<fl::u8>(hdr[2]) == kFledMagic[2]
70 &&
static_cast<fl::u8>(hdr[3]) == kFledMagic[3];
72 const bool supportedFled = got == kFledHeaderBytes
73 &&
static_cast<fl::u8>(hdr[4]) == kFledVersionV1
74 &&
static_cast<fl::u8>(hdr[6]) == 0
75 &&
static_cast<fl::u8>(hdr[7]) == 0
82 const fl::u32 jsonLen =
83 static_cast<fl::u32
>(
static_cast<fl::u8>(hdr[8]))
84 | (
static_cast<fl::u32
>(
static_cast<fl::u8>(hdr[9])) << 8)
85 | (
static_cast<fl::u32
>(
static_cast<fl::u8>(hdr[10])) << 16)
86 | (
static_cast<fl::u32
>(
static_cast<fl::u8>(hdr[11])) << 24);
93 const bool jsonInRange = jsonLenSz <= kFledMaxJsonBytes
94 && jsonLenSz <= fileSize - kFledHeaderBytes;
100 if (jr == jsonLenSz) {
110 const fl::i32 bytesPerLed =
129 if (!validEnvelope) {
146 FL_WARN(
"FLED video.color rejected; using explicit best-effort RGB8 playback");
237 if (
readBytes(bytes,
sizeof(bytes)) !=
sizeof(bytes)) {
240 out->mStorage = storage;
242 for (
fl::u8 i = 0; i < 3; ++i) {
244 out->mComponents[i] =
static_cast<fl::u16
>(bytes[
offset]) |
245 (
static_cast<fl::u16
>(bytes[
offset + 1]) << 8);
287 for (; n < pixels && n < dst.
size() &&
readPixel(&dst[n]); ++n) {
301 DBG(
"Not implemented and therefore always returns true");
310 return target < total_bytes;
316 FL_DBG(
"Streaming handle doesn't support seeking");
325 if (
mHandle->bytesLeft() == 0) {
329 mHandle->readRGB8(frame->rgb()) * 3;
333 DBG(
"readFrameAt failed - read: "
335 << frameNumber <<
", left: " <<
mHandle->bytesLeft());
344 if (bytes_left <= 0) {
431 size_t bytesRead = 0;
436 while (bytesRead < len && mHandle->
available(len - bytesRead)) {
437 if (
mHandle->read(dst + bytesRead, 1)) {
444 while (bytesRead < len && mHandle->
available()) {
445 if (
mHandle->read(dst + bytesRead, 1)) {
fl::Video video(NUM_LEDS, 2.0f)
bool is_object() const FL_NO_EXCEPT
bool has_value() const FL_NO_EXCEPT
static json parse(const fl::string &txt) FL_NO_EXCEPT
constexpr fl::size size() const FL_NO_EXCEPT
i32 bytesRemainingInFrame() const FL_NO_EXCEPT
bool readFrame(Frame *frame) FL_NO_EXCEPT
PixelStream(int bytes_per_frame) FL_NO_EXCEPT
i32 bytesPerFrame() FL_NO_EXCEPT
i32 framesRemaining() const FL_NO_EXCEPT
bool readSample(PixelSample *out) FL_NO_EXCEPT
bool hasEmbeddedScreenMap() const FL_NO_EXCEPT
const fl::i32 mBaseBytesPerFrame
bool probeStreamingMagic() const FL_NO_EXCEPT
bool begin(fl::filebuf_ptr h) FL_NO_EXCEPT
bool readPixel(CRGB *dst) FL_NO_EXCEPT
const fl::string & embeddedScreenMapJson() const FL_NO_EXCEPT
fl::size_t mPayloadOffset
bool pixelStorage(fled::PixelStorage *out) const FL_NO_EXCEPT
bool mStreamingProbePending
fl::size_t mStreamingPrefixPos
i32 bytesRemaining() const FL_NO_EXCEPT
size_t readBytes(u8 *dst, size_t len) FL_NO_EXCEPT
void close() FL_NO_EXCEPT
virtual ~PixelStream() FL_NO_EXCEPT
bool available() const FL_NO_EXCEPT
bool hasFrame(fl::u32 frameNumber) FL_NO_EXCEPT
Type getType() const FL_NO_EXCEPT
fl::size_t mStreamingPrefixSize
bool atEnd() const FL_NO_EXCEPT
fled::VideoColor mVideoColor
fl::u8 mStreamingPrefix[4]
bool videoColor(fled::VideoColor *out) const FL_NO_EXCEPT
bool readFrameAt(fl::u32 frameNumber, Frame *frame) FL_NO_EXCEPT
fl::string mEmbeddedScreenMapJson
i32 framesDisplayed() const FL_NO_EXCEPT
bool rewind() FL_NO_EXCEPT
bool isRgb8Playback() const FL_NO_EXCEPT
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
FastLED's Elegant JSON Library: fl::json
Centralized logging categories for FastLED hardware interfaces and subsystems.
fl::u8 bytesPerLed(fl::u8 pixelFormat) FL_NO_EXCEPT
ColorStatus resolveVideoColor(const fl::json &envelope, fl::u8 pixelFormat, VideoColor *out) FL_NO_EXCEPT
bool toPixelStorage(PixelFormat fledFormat, PixelStorage *out) FL_NO_EXCEPT
ComponentByteOrder mComponentByteOrder
constexpr fl::u8 kFledVersionV1
constexpr fl::u8 kFledMagic[4]
constexpr fl::size_t kFledMaxJsonBytes
constexpr fl::size_t kFledHeaderBytes
bool isFledMagicPrefix(const fl::u8 *bytes, fl::size_t size) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
fl::shared_ptr< filebuf > filebuf_ptr
int available() FL_NO_EXCEPT
Base definition for an LED controller.
Representation of an 8-bit RGB pixel (Red, Green, Blue)
static constexpr T max() FL_NO_EXCEPT