Add AAC support and update version

This commit adds support for AAC audio decoding via the fdk-aac library, including:
- New AAC decoder module (ADTS streaming)
- Integration into the autodetection system
- Support for AAC in transcoding
- Updated version to 0.3.23
- Added necessary dependencies in Cargo.toml and Cargo.lock
- Added tests for AAC decoding
This commit is contained in:
2026-02-27 00:00:21 +01:00
parent 6fe2f6be95
commit 18b9194530
10 changed files with 288 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
use pmoflac::decode_aac_stream;
use tokio::io::AsyncReadExt;
#[tokio::test]
async fn test_decode_adts_file() {
let file = tokio::fs::File::open("/tmp/test_adts.aac")
.await
.expect("test ADTS file not found — run: ffmpeg -i tests/SBRtestStereoHiBr.mp4 -vn -acodec copy -f adts /tmp/test_adts.aac");
let mut stream = decode_aac_stream(file)
.await
.expect("decode_aac_stream failed");
let info = stream.info().clone();
println!("StreamInfo: {} Hz, {} ch, {} bps", info.sample_rate, info.channels, info.bits_per_sample);
assert!(info.sample_rate > 0, "sample_rate should be > 0");
assert!(info.channels == 1 || info.channels == 2, "channels should be 1 or 2");
assert_eq!(info.bits_per_sample, 16);
let mut pcm = Vec::new();
stream.read_to_end(&mut pcm).await.expect("read_to_end failed");
println!("Decoded {} PCM bytes ({} samples)", pcm.len(), pcm.len() / 2);
assert!(pcm.len() > 0, "should have decoded some PCM data");
}
#[tokio::test]
async fn test_autodetect_adts() {
use pmoflac::decode_audio_stream;
let file = tokio::fs::File::open("/tmp/test_adts.aac")
.await
.expect("test ADTS file not found");
let stream = decode_audio_stream(file)
.await
.expect("decode_audio_stream failed");
let info = stream.info().clone();
println!("Autodetect: {} Hz, {} ch, {} bps", info.sample_rate, info.channels, info.bits_per_sample);
assert!(info.sample_rate > 0);
}