Skip to main content

Crate rockbox_metadata

Crate rockbox_metadata 

Source
Expand description

Audio file metadata / tag parsing extracted from Rockbox as a reusable library.

One call parses tags, duration, bitrate, sample rate, ReplayGain and embedded album-art / cuesheet positions for 40+ audio formats — MP3 (ID3v1/v2), FLAC, Ogg Vorbis, Opus, Speex, MP4/M4A (AAC & ALAC), WavPack, Monkey’s Audio, Musepack, WMA, AIFF, WAV/AU/VOX, TTA, ADX, SHN, and the chiptune family (SPC, NSF, SID, VGM, KSS, AY, GBS, HES, SGC, VTX, MOD, SAP, …).

let meta = rockbox_metadata::read("song.flac").unwrap();
println!(
    "{} — {} [{}] {:?}",
    meta.artist, meta.title, meta.codec, meta.duration,
);

The parsers are the battle-tested Rockbox C sources (lib/rbcodec/metadata/), compiled by build.rs and bridged through a small flat struct (shim/rbmeta.h). Pairs with the rockbox-dsp crate: the raw Q7.24 ReplayGain values from ReplayGain feed directly into its set_replaygain_gains_raw().

Structs§

AlbumArt
Location of album art embedded in the audio file (ID3 APIC, FLAC PICTURE, MP4 covr). Read size bytes at byte offset to extract the image — unless one of the transform flags is set, in which case the data first needs ID3 de-unsynchronization or base64 decoding.
Cuesheet
Location of a cuesheet embedded in the file’s tags.
Metadata
Parsed metadata for one audio file.
ReplayGain
ReplayGain values parsed from the file’s tags.

Enums§

AlbumArtKind
Image format of embedded album art.
CueEncoding
Character encoding of an embedded cuesheet.
Error
Errors returned by read.

Functions§

probe
Guess the codec from a filename’s extension without opening the file. Returns the format label (e.g. "FLAC") or None if unknown.
read
Parse the metadata of the audio file at path.