MCPcopy Create free account
hub / github.com/FastLED/FastLED / processChunk

Method processChunk

src/fl/codec/jpeg.cpp.hpp:159–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157 }
158
159 bool processChunk() {
160 if (mState == JpegDecoder::State::Error || mState == JpegDecoder::State::Complete) {
161 return false;
162 }
163
164 if (mState == JpegDecoder::State::NotStarted || mState == JpegDecoder::State::HeaderParsed) {
165 mState = JpegDecoder::State::Decoding;
166 }
167
168 if (!mDriver) {
169 setError("Driver not available");
170 return false;
171 }
172
173 bool more_work = mDriver->processChunk();
174
175 auto mDriverstate = mDriver->getState();
176 switch (mDriverstate) {
177 case fl::third_party::TJpgInstanceDecoder::State::NotStarted:
178 case fl::third_party::TJpgInstanceDecoder::State::HeaderParsed:
179 case fl::third_party::TJpgInstanceDecoder::State::Decoding:
180 mProgress = mDriver->getProgress();
181 break;
182 case fl::third_party::TJpgInstanceDecoder::State::Complete:
183 mState = JpegDecoder::State::Complete;
184 mProgress = 1.0f;
185 return false;
186 case fl::third_party::TJpgInstanceDecoder::State::Error: {
187 fl::string err;
188 if (mDriver->hasError(&err)) {
189 setError(err);
190 } else {
191 setError("JPEG decoding failed");
192 }
193 return false;
194 }
195 }
196
197 return more_work;
198 }
199
200 float getProgress() const { return mProgress; }
201 bool hasPartialImage() const { return mDriver ? mDriver->hasPartialImage() : false; }

Callers

nothing calls this directly

Calls 3

getStateMethod · 0.45
getProgressMethod · 0.45
hasErrorMethod · 0.45

Tested by

no test coverage detected