Crate flac [] [src]

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),
}

Reexports

pub use stream::Stream;
pub use stream::StreamBuffer;
pub use stream::StreamReader;

Modules

metadata

Provides an interface for dealing with FLAC metadata blocks.

stream

Structs

ByteStream

Structure that hold a slice of bytes.

Metadata

Data associated with a single metadata block.

ReadStream

Structure that hold a reader for a source of bytes.

Enums

ErrorKind

Represent the different kinds of errors.

Traits

Sample

An abstraction trait for keeping different sized integers.

SampleSize

A trait for defining the size of a sample.

StreamProducer

An interface for parsing through some type of producer to a byte stream.