FastLED 3.10.6
Loading...
Searching...
No Matches

◆ findSyncWord()

int fl::third_party::Mp3Minimp3Decoder::findSyncWord ( const fl::u8 * buf,
fl::size len )

Definition at line 177 of file mp3.cpp.hpp.

178 {
179 if (!buf || len < 4) {
180 return -1;
181 }
182
183 for (fl::size i = 0; i <= len - 4; ++i) {
184 const fl::u8 version = (buf[i + 1] >> 3) & 0x03;
185 const fl::u8 layer = (buf[i + 1] >> 1) & 0x03;
186 const fl::u8 bitrate = (buf[i + 2] >> 4) & 0x0f;
187 const fl::u8 sample_rate = (buf[i + 2] >> 2) & 0x03;
188 if (buf[i] == 0xff && (buf[i + 1] & 0xe0) == 0xe0 &&
189 version != 0x01 && layer != 0x00 && bitrate != 0x0f &&
190 sample_rate != 0x03) {
191 return static_cast<int>(i);
192 }
193 }
194 return -1;
195}
unsigned char u8
Definition stdint.h:131

References fl::FL_NO_EXCEPT.

Referenced by decode(), and fl::Mp3::parseMp3Info().

+ Here is the caller graph for this function: