FastLED 3.9.15
Loading...
Searching...
No Matches

◆ MP3FindFreeSync()

static int fl::third_party::MP3FindFreeSync ( const unsigned char * buf,
const unsigned char firstFH[4],
int nBytes )
static

Definition at line 153 of file mp3dec.hpp.

154{
155 int offset = 0;
156 const unsigned char *bufPtr = buf;
157
158 /* loop until we either:
159 * - run out of nBytes (FindMP3SyncWord() returns -1)
160 * - find the next valid frame header (sync word, version, layer, CRC flag, bitrate, and sample rate
161 * in next header must match current header)
162 */
163 while (1) {
164 offset = MP3FindSyncWord(bufPtr, nBytes);
165 bufPtr += offset;
166 if (offset < 0) {
167 return -1;
168 } else if ( (bufPtr[0] == firstFH[0]) && (bufPtr[1] == firstFH[1]) && ((bufPtr[2] & 0xfc) == (firstFH[2] & 0xfc)) ) {
169 /* want to return number of bytes per frame, NOT counting the padding byte, so subtract one if padFlag == 1 */
170 if ((firstFH[2] >> 1) & 0x01)
171 bufPtr--;
172 return bufPtr - buf;
173 }
174 bufPtr += 3;
175 nBytes -= (offset + 3);
176 };
177
178 return -1;
179}
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
int MP3FindSyncWord(const unsigned char *buf, int nBytes) FL_NOEXCEPT
Definition mp3dec.hpp:116

References FL_NOEXCEPT, MP3FindSyncWord(), and offset().

Referenced by MP3Decode().

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