Where the MP3 audio frames begin and end (excluding any ID3v2 prefix and
ID3v1 trailer). Unlike FLAC there is no preserved structural metadata: the
ID3v2 tag is regenerated from the DB, and the Xing/LAME info frame lives
inside the first audio frame, carried by the backing-audio segment.
Build the ID3v2.4 tag region for tags/arts: an inline 10-byte header
followed by text/TXXX frames and APIC frames whose image bytes are
streamed as ArtImage segments. Returns the segments (no backing audio) and
the total tag length (10 + frames_len). Shared by MP3 synthesis and the WAV
id3 chunk.
Locate the audio region: skip a leading ID3v2 tag (if present) and a trailing
128-byte ID3v1 tag (if present), then require an MPEG frame sync at the audio
offset. The synthesized file re-prepends a fresh ID3v2 tag, so the original
one is intentionally not preserved.
Bounded twin of locate_audio. prefix is a front window; file_len is the
true size; tail is the file’s last 128 bytes (or None if the file is
shorter than 128 bytes). The audio start is the end of any leading ID3v2 tag
(declared in its 10-byte header); if that end is past the prefix, returns
NeedMore. The audio end is file_len minus a 128-byte ID3v1 trailer when the
tail begins with TAG.
Read an existing ID3v2 tag and fold it into canonical (key, value) pairs.
Text frames map via the vocabulary (NUL-separated multi-value yields one pair
per value); unmapped text frames pass through keyed by their frame id; TXXX
frames key on their description (folded to canonical when known); COMM/USLT
yield comment/lyrics (text only). Other/binary frames are skipped.
Multiple COMM or USLT frames (e.g. one per language) each emit a separate
pair; their language and description fields are not preserved.
Build the synthesized region for an MP3: a fresh ID3v2.4 tag (text frames +
APIC frames, with image bytes streamed as ArtImage segments) followed by the
backing audio.