xaac-rs 0.1.0

High-level Rust AAC/xHE-AAC encoder and decoder bindings built on libxaac
Documentation
  • Coverage
  • 0%
    0 out of 149 items documented0 out of 0 items with examples
  • Size
  • Source code size: 66.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2m 22s Average build duration of successful builds.
  • all releases: 5m 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • egorsmkv

xaac-rs

High-level Rust bindings for AAC and xHE-AAC encoding and decoding built on top of libxaac-sys.

This crate wraps the low-level FFI API exposed by the local libxaac-sys crate and provides a safer, more idiomatic Rust interface for:

  • AAC-LC encoding
  • HE-AACv1 and HE-AACv2 encoding
  • AAC-LD and AAC-ELD encoding
  • USAC/xHE-AAC encoder configuration
  • Decoder initialization and frame decoding

Example

Basic AAC-LC ADTS encoding:

use xaac_rs::{Encoder, EncoderConfig, OutputFormat};

let mut encoder = Encoder::new(EncoderConfig {
    output_format: OutputFormat::Adts,
    ..EncoderConfig::default()
})?;

let pcm = vec![0i16; encoder.input_frame_bytes() / 2];
let packet = encoder.encode_i16_interleaved(&pcm)?;

assert!(!packet.data.is_empty());
# Ok::<(), xaac_rs::Error>(())

WAV Conversion Example

The crate includes a runnable example that converts a typical PCM WAV file to AAC ADTS:

cargo run --example convert_wav_to_aac -- input.wav output.aac
cargo run --example convert_wav_to_aac -- input.wav output.aac 192000

The example:

  • parses RIFF/WAVE input directly
  • supports PCM WAV and WAVE_FORMAT_EXTENSIBLE
  • supports 16-bit, 24-bit, and 32-bit PCM
  • zero-pads the final partial frame before encoding

See examples/convert_wav_to_aac.rs.

Public API

Main exported types:

  • Encoder
  • EncoderConfig
  • Profile
  • OutputFormat
  • Decoder
  • DecoderConfig
  • DecodedFrame
  • EncodedPacket
  • EncodedFrame
  • Error

Validation

Verified locally with:

cargo check
cargo test
cargo check --example convert_wav_to_aac