FastLED 3.10.6
Loading...
Searching...
No Matches

◆ videoFrame()

bool fl::Fled::videoFrame ( fl::size frameIndex,
fl::size ledCount,
fled::VideoFrameView * out ) const

Definition at line 147 of file fled.cpp.hpp.

148 {
149 if (!mImpl || !out || ledCount == 0) {
150 return false;
151 }
152 fled::PixelStorage storage;
154 &storage)) {
155 return false;
156 }
157 fled::VideoColor color;
158 if (videoColor(&color) != fled::ColorStatus::Ok) {
159 return false;
160 }
161 const fl::size bytesPerLed = fled::bytesPerLed(pixelFormat());
162 const fl::size payloadBytes = mImpl->payloadLen();
163 if (bytesPerLed == 0 || ledCount > payloadBytes / bytesPerLed) {
164 return false;
165 }
166 const fl::size stride = ledCount * bytesPerLed;
167 if (stride == 0 || payloadBytes % stride != 0 ||
168 frameIndex >= payloadBytes / stride) {
169 return false;
170 }
171 fl::size completePayloadBytes = 0;
172 fl::shared_ptr<const fl::u8> payload = blob("frame_payload",
173 &completePayloadBytes);
174 if (!payload) {
175 return false;
176 }
177 const fl::size offset = frameIndex * stride;
178 out->mStorage = storage;
179 out->mColor = color;
180 out->mPayload = fl::shared_ptr<const fl::u8>(payload, payload.get() + offset);
181 out->mPayloadBytes = stride;
182 out->mStride = stride;
183 return true;
184}
fl::u8 pixelFormat() const FL_NO_EXCEPT
Definition fled.cpp.hpp:85
fl::size payloadBytes() const FL_NO_EXCEPT
Definition fled.cpp.hpp:93
fl::shared_ptr< const fl::u8 > blob(const char *sectionName, fl::size *outLen) const FL_NO_EXCEPT
Definition fled.cpp.hpp:188
fled::ColorStatus videoColor(fled::VideoColor *out) const FL_NO_EXCEPT
Definition fled.cpp.hpp:135
fl::u8 bytesPerLed() const FL_NO_EXCEPT
Definition fled.cpp.hpp:89
fl::shared_ptr< fled::FledImpl > mImpl
Definition fled.h:156
T * get() const FL_NO_EXCEPT
Definition shared_ptr.h:334
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
fl::u8 bytesPerLed(fl::u8 pixelFormat) FL_NO_EXCEPT
bool toPixelStorage(PixelFormat fledFormat, PixelStorage *out) FL_NO_EXCEPT

References blob(), bytesPerLed(), fl::fled::bytesPerLed(), fl::FL_NO_EXCEPT, fl::shared_ptr< T >::get(), mImpl, offset(), fl::fled::Ok, payloadBytes(), pixelFormat(), fl::fled::toPixelStorage(), and videoColor().

+ Here is the call graph for this function: