Skip to main content

lvqr_codec/
lib.rs

1//! Codec parsers for LVQR.
2//!
3//! This crate is Tier 2.2 of the roadmap (`tracking/ROADMAP.md`). It owns
4//! the "given raw codec-private bytes, produce enough information to build
5//! an init segment and a FragmentMeta" surface. Every protocol crate that
6//! terminates an ingest source (WHIP, SRT, RTSP, RTMP) eventually calls
7//! into one of the modules here.
8//!
9//! ## Scope
10//!
11//! * [`hevc`]: HEVC (H.265) SPS parsing. Extracts profile / tier / level /
12//!   resolution from a raw NAL unit. This is the bare minimum needed for
13//!   a codec string (`hev1.<profile>.<compat>.L<level>.<constraint>`) and
14//!   for an fMP4 `hvc1` / `hev1` sample entry. Full scaling-list parsing
15//!   is intentionally not implemented; that is only needed for pixel-
16//!   accurate decoding, which LVQR never does.
17//! * [`aac`]: Hardened AAC `AudioSpecificConfig` parser that correctly
18//!   decodes the 5-bit + 6-bit escape object-type encoding, the 15-index
19//!   explicit-frequency encoding, and HE-AAC / HE-AAC v2 SBR/PS signals.
20//!   Replaces the 2-byte ASC assumption baked into
21//!   `lvqr-ingest::remux::fmp4::esds`.
22//! * [`bit_reader`]: a forward-only MSB-first bit reader with exp-Golomb
23//!   decoders, shared across codec modules.
24//! * [`error`]: one error type, [`CodecError`].
25//!
26//! Future modules (VP9, AV1, Opus) land in this crate when the egress
27//! protocol crates need them.
28//!
29//! ## Testing
30//!
31//! Every parser ships a proptest harness (never-panic on arbitrary input)
32//! in `tests/proptest_*.rs`. Integration tests with real encoder output
33//! live in `tests/integration_*.rs`. The crate is in scope for the
34//! 5-artifact test contract at `tests/CONTRACT.md`.
35
36pub mod aac;
37pub mod bit_reader;
38pub mod error;
39pub mod hevc;
40pub mod scte35;
41pub mod ts;
42
43pub use error::CodecError;
44pub use scte35::{SpliceInfo, parse_splice_info_section};
45pub use ts::{PesPacket, StreamType, TsDemuxer};