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

◆ read() [1/3]

fl::size_t fl::Mpeg1FileHandle::read ( char * dst,
fl::size_t bytesToRead )
inlineoverridevirtual

Implements fl::filebuf.

Definition at line 49 of file file_system_codecs.cpp.hpp.

49 {
50 if (!mDecoder || !mHasValidFrame) return 0;
51 fl::size totalRead = 0;
52 while (bytesToRead > 0 && mHasValidFrame) {
53 fl::size rem = mFrameSize - mCurrentPos;
54 if (rem == 0) { if (!decodeNextFrameIfNeeded()) break; rem = mFrameSize - mCurrentPos; }
55 fl::size toRead = fl::min(bytesToRead, rem);
56 if (toRead > 0 && mCurrentFrame && mCurrentFrame->rgb().data()) {
57 fl::memcpy(dst + totalRead, (fl::u8*)mCurrentFrame->rgb().data() + mCurrentPos, toRead);
58 mCurrentPos += toRead; totalRead += toRead; bytesToRead -= toRead;
59 } else break;
60 }
61 return totalRead;
62 }
bool decodeNextFrameIfNeeded() FL_NO_EXCEPT
fl::shared_ptr< Frame > mCurrentFrame
unsigned char u8
Definition stdint.h:131
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NO_EXCEPT
Definition math.h:71
FASTLED_FORCE_INLINE void * memcpy(void *dest, const void *src, size_t n) FL_NO_EXCEPT
Definition cstring.h:136

References decodeNextFrameIfNeeded(), fl::FL_NO_EXCEPT, mCurrentFrame, mCurrentPos, mDecoder, fl::memcpy(), mFrameSize, mHasValidFrame, and fl::min().

+ Here is the call graph for this function: