Crate flac

Source
Expand description

An implementation of FLAC, free lossless audio codec, written in Rust.

The code is available on GitHub.

§Examples

Basic decoding from a file.

use flac::StreamReader;
use std::fs::File;

match StreamReader::<File>::from_file("path/to/file.flac") {
  Ok(mut stream) => {
    // Copy of `StreamInfo` to help convert to a different audio format.
    let info = stream.info();

    // The explicit size for `Stream::iter` is the resulting decoded
    // sample. You can usually find out the desired size of the
    // samples with `info.bits_per_sample`.
    for sample in stream.iter::<i16>() {
      // Iterate over each decoded sample
    }
  }
  Err(error)     => println!("{:?}", error),
}

Re-exports§

Modules§

  • Provides an interface for dealing with FLAC metadata blocks.

Structs§

  • Structure that hold a slice of bytes.
  • Structure that hold a reader for a source of bytes.

Enums§

  • Represent the different kinds of errors.

Traits§

  • An abstraction trait for keeping different sized integers.
  • A trait for defining the size of a sample.
  • An interface for parsing through some type of producer to a byte stream.