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

Function validateMp3

tests/fl/codec/decode_file.hpp:240–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240static void validateMp3(const fl::vector<fl::u8>& data) {
241 FL_CHECK_GT(data.size(), 0);
242 fl::third_party::Mp3HelixDecoder decoder;
243 FL_CHECK(decoder.init());
244 int frames_decoded = 0;
245 int sample_rate = 0;
246 decoder.decode(data.data(), data.size(), [&](const fl::third_party::Mp3Frame& frame) {
247 frames_decoded++;
248 if (sample_rate == 0) {
249 sample_rate = frame.sample_rate;
250 }
251 });
252 FL_CHECK_GT(frames_decoded, 0);
253 FL_CHECK_GT(sample_rate, 0);
254 FL_MESSAGE("MP3: " << frames_decoded << " frames, " << sample_rate << " Hz");
255}
256
257static void validateWebP(const fl::vector<fl::u8>& data) {
258 if (fl::Jpeg::isSupported()) {

Callers 1

FL_TEST_FILEFunction · 0.85

Calls 4

sizeMethod · 0.45
initMethod · 0.45
decodeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected