76 {
80 if (bytes.
size() < 40) {
81 return false;
82 }
85 if (frame[0] != 0xFF || (frame[1] & 0xE0) != 0xE0) {
86 return false;
87 }
88
89 const int version_bits = (frame[1] >> 3) & 0x03;
90 const int layer_bits = (frame[1] >> 1) & 0x03;
91 if (layer_bits != 0x01) {
92 return false;
93 }
94 const bool mpeg1 = version_bits == 0x03;
95 const bool mono = ((frame[3] >> 6) & 0x03) == 0x03;
96
97
98
99 const fl::size side_info = mpeg1 ? (mono ? 17u : 32u) : (mono ? 9u : 17u);
100
101
102
105 return true;
106 }
107
108 const fl::size xing = 4 + side_info;
110 return false;
111 }
114 return false;
115 }
117
119 fl::size cursor = xing + 8;
120 if (flags & 0x0001) { cursor += 4; }
121 if (flags & 0x0002) { cursor += 4; }
122 if (flags & 0x0004) { cursor += 100; }
123 if (flags & 0x0008) { cursor += 4; }
124
125
126
127 if (cursor + 24 >
length) {
128 return true;
129 }
133 if (!lame) {
134 return true;
135 }
136 const fl::u8* gap = frame + cursor + 21;
138 (static_cast<fl::u32>(gap[0]) << 4) | (static_cast<fl::u32>(gap[1]) >> 4);
140 ((static_cast<fl::u32>(gap[1]) & 0x0F) << 8) | static_cast<fl::u32>(gap[2]);
141 return true;
142}
const T * data() const FL_NO_EXCEPT
constexpr fl::size size() const FL_NO_EXCEPT
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
fl::u32 mp3VbrRead32(const fl::u8 *p) FL_NO_EXCEPT
bool mp3VbrMagic(const fl::u8 *p, const char *magic) FL_NO_EXCEPT
bool present
The frame is metadata and must not be emitted as audio.
fl::u32 encoderDelay
Samples per channel of encoder priming to drop from the start.
fl::u32 encoderPadding
Samples per channel of padding to drop from the end.