FastLED 3.10.8
Loading...
Searching...
No Matches

◆ readSample()

bool fl::video::PixelStream::readSample ( PixelSample * out)

Definition at line 225 of file pixel_stream.cpp.hpp.

225 {
226 if (!mHandle || !out) {
227 return false;
228 }
229 fled::PixelStorage storage;
230 fled::VideoColor color;
231 if (!pixelStorage(&storage) || !videoColor(&color) ||
232 storage.mFormat != fl::PixelFormat::Rgb16 ||
233 storage.mComponentByteOrder != fled::ComponentByteOrder::LittleEndian) {
234 return false;
235 }
236 fl::u8 bytes[6];
237 if (readBytes(bytes, sizeof(bytes)) != sizeof(bytes)) {
238 return false;
239 }
240 out->mStorage = storage;
241 out->mColor = color;
242 for (fl::u8 i = 0; i < 3; ++i) {
243 const fl::size_t offset = static_cast<fl::size_t>(i) * 2;
244 out->mComponents[i] = static_cast<fl::u16>(bytes[offset]) |
245 (static_cast<fl::u16>(bytes[offset + 1]) << 8);
246 }
247 return true;
248}
fl::filebuf_ptr mHandle
bool pixelStorage(fled::PixelStorage *out) const FL_NO_EXCEPT
size_t readBytes(u8 *dst, size_t len) FL_NO_EXCEPT
bool videoColor(fled::VideoColor *out) const FL_NO_EXCEPT
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
__SIZE_TYPE__ size_t
Definition s16x16x4.h:16
unsigned char u8
Definition stdint.h:131

References fl::FL_NO_EXCEPT, fl::fled::LittleEndian, fl::fled::PixelStorage::mComponentByteOrder, fl::fled::PixelStorage::mFormat, mHandle, offset(), pixelStorage(), readBytes(), fl::Rgb16, and videoColor().

+ Here is the call graph for this function: