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

◆ readFrameAt()

bool fl::video::PixelStream::readFrameAt ( fl::u32 frameNumber,
Frame * frame )

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

313 {
314 if (!mHandle || !frame || mType == kStreaming) {
315 // Streaming handle doesn't support seeking
316 FL_DBG("Streaming handle doesn't support seeking");
317 return false;
318 }
319 if (!isRgb8Playback()) {
320 return false;
321 }
322 fl::size_t frameBytes = static_cast<fl::size_t>(frameNumber)
323 * static_cast<fl::size_t>(mbytesPerFrame);
324 mHandle->seek(mPayloadOffset + frameBytes);
325 if (mHandle->bytesLeft() == 0) {
326 return false;
327 }
328 size_t read =
329 mHandle->readRGB8(frame->rgb()) * 3;
330
331 bool ok = int(read) == mbytesPerFrame;
332 if (!ok) {
333 DBG("readFrameAt failed - read: "
334 << read << ", mbytesPerFrame: " << mbytesPerFrame << ", frame:"
335 << frameNumber << ", left: " << mHandle->bytesLeft());
336 }
337 return ok;
338}
fl::filebuf_ptr mHandle
bool isRgb8Playback() const FL_NO_EXCEPT
#define FL_DBG
Definition log.h:553
__SIZE_TYPE__ size_t
Definition s16x16x4.h:16
int read() FL_NO_EXCEPT
#define DBG
Definition time.cpp.hpp:7

References DBG, FL_DBG, fl::FL_NO_EXCEPT, isRgb8Playback(), kStreaming, mbytesPerFrame, mHandle, mPayloadOffset, mType, and fl::read().

+ Here is the call graph for this function: