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

◆ readBytes()

size_t fl::video::PixelStream::readBytes ( u8 * dst,
size_t len )

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

423 {
424 if (!mHandle || !dst) {
425 return 0;
426 }
427 if (mType == kStreaming &&
429 return 0;
430 }
431 size_t bytesRead = 0;
432 while (bytesRead < len && mStreamingPrefixPos < mStreamingPrefixSize) {
433 dst[bytesRead++] = mStreamingPrefix[mStreamingPrefixPos++];
434 }
435 if (mType == kStreaming) {
436 while (bytesRead < len && mHandle->available(len - bytesRead)) {
437 if (mHandle->read(dst + bytesRead, 1)) {
438 bytesRead++;
439 } else {
440 break;
441 }
442 }
443 } else {
444 while (bytesRead < len && mHandle->available()) {
445 if (mHandle->read(dst + bytesRead, 1)) {
446 bytesRead++;
447 } else {
448 break;
449 }
450 }
451 }
452 return bytesRead;
453}
fl::filebuf_ptr mHandle
bool probeStreamingMagic() const FL_NO_EXCEPT
fl::size_t mStreamingPrefixPos
bool available() const FL_NO_EXCEPT
fl::size_t mStreamingPrefixSize

References fl::available(), fl::FL_NO_EXCEPT, kStreaming, mHandle, mStreamingPrefix, mStreamingPrefixPos, mStreamingPrefixSize, mStreamingProbePending, mType, and probeStreamingMagic().

Referenced by readPixel(), and readSample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: