Expand description
Β§truehd
A low-level parser and decoder for Dolby TrueHD audio bitstreams, implemented in Rust.
β οΈ Experimental:
This crate is intended for internal or research use only.
It is not designed for production or end-user playback systems.
Β§Development Status
| Category | Feature | Status | Priority | Criticality | Notes |
|---|---|---|---|---|---|
| Parser | FBA sync bitstream (Dolby) | π’ | High | Essential | |
| FBB sync bitstream (Meridian) | π΄ | Low | Nice-to-have | Do you really need it? | |
| Evolution frame | π’ | High | Essential | ||
| CRC and parity validation | π’ | High | Essential | ||
| SMPTE timestamp | π’ | Medium | Optional | ||
| FBA hires output timing | π’ | Medium | Optional | ||
| Object audio metadata | π‘ | High | Essential | Mostly done | |
| FIFO conformance tests | π‘ | Medium | Optional | Partially done | |
| FBA bitstream seeking | π΄ | Low | Nice-to-have | Yes, itβs possible | |
| Decoder | 31EA / 31EB sync substream | π’ | High | Essential | |
| 31EC sync substream | π’ | High | Essential | 4th / 16ch presentation | |
| Lossless check | π’ | High | Essential | ||
| Optimize DSP performance | π΄ | Medium | Important | ||
| Dynamic range control | π΄ | Low | Optional | ||
| Intermediate spatial format | π΄ | Low | Out-of-scope | I have no idea | |
| Other TODOs | Documentation | π‘ | High | Essential | With kind support from Claude |
| Unit tests | π΄ | High | Essential | ||
| Benchmarking | π΄ | Medium | Important | ||
| Metadata interpolation | π΄ | Low | Nice-to-have | ||
| Bitstream editing | π΄ | Low | Nice-to-have | ||
| Encoding | π΄ | Low | Nice-to-have | ||
| Object audio rendering | π΄ | Low | Out-of-scope |
Legend: π’ Completed β’ π‘ In Progress β’ π΄ Not Started
Β§License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Β§Technical Overview
Parser and decoder for Dolby TrueHD (MLP) bitstreams according to FBA syntax specification.
Β§Bitstream Organization
External Structure: Access units containing MLP Syncs and substream segments. Internal Structure: Blocks with optional restart headers.
Β§Audio Presentations
- 2-channel (stereo, Lt/Rt, binaural, mono)
- 6-channel
- 8-channel
- 16-channel
Β§Data Rate Management
Variable bitrate compression with FIFO buffering. Peak data rates limited to 18 Mbps for FBA streams.
Β§Quick Start
Steps for processing audio streams:
- Extract access units from a bitstream using
process::extract::Extractor - Parse access units into structured data using
process::parse::Parser - Decode audio to PCM samples using
process::decode::Decoder
use truehd::process::{extract::Extractor, parse::Parser, decode::Decoder, EXAMPLE_DATA};
// Initialize processing components
let mut extractor = Extractor::default();
let mut parser = Parser::default();
let mut decoder = Decoder::default();
// Push bitstream data
let data = &EXAMPLE_DATA; // Example data
extractor.push_bytes(data);
// Process frames with error recovery
for frame_result in extractor {
match frame_result {
Ok(frame) => {
let access_unit = parser.parse(&frame)?;
// Decode the first presentation
let decoded = decoder.decode_presentation(&access_unit, 0)?;
// Access PCM data
let pcm_samples = &decoded.pcm_data;
}
Err(extract_error) => {
// Handle extraction errors - stream continues automatically
eprintln!("Frame extraction error: {}", extract_error);
}
}
}ModulesΒ§
- process
- Processing functionality for audio bitstreams.
- structs
- Data structures representing TrueHD format components.
- utils
- Utility functions and supporting infrastructure.