Skip to main content

identify_mqa_reader

Function identify_mqa_reader 

Source
pub fn identify_mqa_reader(reader: impl Read) -> Result<bool, Error>
Expand description

Checks if the FLAC stream read from reader is an MQA file by looking for the MQA magic word in the least significant bits of the samples.

The magic word is searched for in the three least significant bit planes of the XOR of the two channels, over the first three seconds of audio data, which is enough to find it if it is present. Note that the magic word may also happen to appear in a non-MQA file, but this is very unlikely.

Streams that cannot carry MQA at all — anything that is not stereo, or that has fewer than 16 bits per sample — return Ok(false) without being decoded.

§Errors

Returns an error if the stream is not a valid FLAC stream or cannot be decoded.