The metadata region of a FLAC file: where audio begins and the structural
blocks to carry over. Unlike FlacScan, this does not include audio_length
(which requires the full file size), so it can be computed from the front alone.
Parse just the FLAC metadata region (the front of the file), recovering the
audio boundary and structural blocks. Use when the audio length is already
known (e.g. stored in a database) and the full file should not be read.
Bounded twin of read_metadata: walk the metadata blocks present in
prefix (which may be a front-only window of the file). If a block’s declared
body runs past the prefix, return NeedMore { up_to } with the exact end of
that block — the caller widens the window and retries. Otherwise Complete.
Read the existing VORBIS_COMMENT block from a complete FLAC file, returning
(FIELD, value) pairs in order. Comments without a = are skipped. Returns
an empty vec if there is no comment block. Used by the scanner to seed tags.
Split a FLAC file’s preserved metadata blocks into the read-only structural
store (STREAMINFO/SEEKTABLE, as (kind, body) pairs in file order) and the
editable binary tags (APPLICATION/CUESHEET, as EmbeddedBinaryTags keyed by
block name; payload is the full block body, including APPLICATION’s 4-byte
app id). Blocks of any other type are ignored (PICTURE/VORBIS_COMMENT are
handled by their own paths and are never in preserved).
Map a stored structural-block kind string back to its FLAC block type.
Only STREAMINFO/SEEKTABLE live in the structural store; everything else
returns None (APPLICATION/CUESHEET are binary tags, not structural).
Build the ordered segment layout for a synthesized FLAC file:
fLaC + structural blocks (sorted by type) + a regenerated VORBIS_COMMENT +
streamed APPLICATION/CUESHEET binary tags + PICTURE blocks (one ArtImage
segment each) + the backing audio. Structural blocks must be only
STREAMINFO/SEEKTABLE; APPLICATION/CUESHEET ride through binary_tags.