61 return (
static_cast<fl::u32
>(p[0]) << 24) |
62 (
static_cast<fl::u32
>(p[1]) << 16) |
63 (
static_cast<fl::u32
>(p[2]) << 8) |
static_cast<fl::u32
>(p[3]);
67 return p[0] ==
static_cast<fl::u8>(magic[0]) &&
68 p[1] ==
static_cast<fl::u8>(magic[1]) &&
69 p[2] ==
static_cast<fl::u8>(magic[2]) &&
70 p[3] ==
static_cast<fl::u8>(magic[3]);
78 out->encoderDelay = 0;
79 out->encoderPadding = 0;
80 if (bytes.size() < 40) {
83 const fl::u8*
const frame = bytes.data();
84 const fl::size
length = bytes.size();
85 if (frame[0] != 0xFF || (frame[1] & 0xE0) != 0xE0) {
89 const int version_bits = (frame[1] >> 3) & 0x03;
90 const int layer_bits = (frame[1] >> 1) & 0x03;
91 if (layer_bits != 0x01) {
94 const bool mpeg1 = version_bits == 0x03;
95 const bool mono = ((frame[3] >> 6) & 0x03) == 0x03;
99 const fl::size side_info = mpeg1 ? (mono ? 17u : 32u) : (mono ? 9u : 17u);
108 const fl::size xing = 4 + side_info;
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; }
127 if (cursor + 24 >
length) {
136 const fl::u8* gap = frame + cursor + 21;
138 (
static_cast<fl::u32
>(gap[0]) << 4) | (
static_cast<fl::u32
>(gap[1]) >> 4);
139 out->encoderPadding =
140 ((
static_cast<fl::u32
>(gap[1]) & 0x0F) << 8) |
static_cast<fl::u32
>(gap[2]);
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
Inspect one complete MPEG audio frame for a VBR metadata header.
bool Mp3ParseVbrTag(fl::span< const fl::u8 > bytes, Mp3VbrTag *out) FL_NO_EXCEPT
static const fl::u32 MP3D_DECODER_DELAY
Metadata carried by an MP3's first frame when an encoder wrote a Xing, Info, or VBRI header there.
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.
InputGamut g FL_NO_EXCEPT
Base definition for an LED controller.