[][src]Crate flac_bound

FLAC encoding via libflac FFI

Examples

let mut outf = File::create("ЦшЦ.flac").unwrap();
let mut outw = WriteWrapper(&mut outf);
let mut enc = FlacEncoder::new().unwrap().compression_level(8).init_write(&mut outw).unwrap();

// The following two calls are equivalent for a two-channel encoder
enc.process(&[&[0xA1], &[0xF3]]).unwrap();
enc.process_interleaved(&[0xA1, 0xF3], 1).unwrap();

// If you don't care about errors that may arise when writing the final frames,
// you can just drop the encoder; or you can inspect them:
match enc.finish() {
    Ok(mut conf) => {
        // Encoding succeeded, a new encoder can be initialised in the same place and memory
        enc = conf.compression_level(0).channels(1).init_stdout_ogg().unwrap();
        // &c.
    }
    Err(enc) => {
        eprintln!("Encoding failed: {:?}", enc.state());
    }
};

Special thanks

To all who support further development on Patreon, in particular:

Structs

FlacEncoder

The stream encoder can encode to native FLAC, and optionally Ogg FLAC (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files.

FlacEncoderConfig

Wrapper around a FLAC encoder for configuring the output settings.

WriteWrapper

This wrapper is necessary due to fat pointers.

Enums

FlacEncoderInitError

Possible erroneous return values for the FlacEncoderConfig::init_*() functions.

FlacEncoderState

State values for a FlacEncoder.