moq_audio/lib.rs
1//! Native audio encoding and decoding for Media over QUIC.
2//!
3//! Sits on top of [`moq_mux`] and [`hang`] and adds the missing piece
4//! for native callers: a Rust-native Opus codec implementation that
5//! turns raw PCM into the bitstreams `moq_mux::codec::opus` already
6//! knows how to ingest (and vice versa for decode).
7//!
8//! - [`AudioFormat`] mirrors WebCodecs `AudioData.format`. The helpers
9//! convert between any supported layout and the interleaved `f32`
10//! representation libopus expects.
11//! - [`Frame`] is a thin owned buffer: just a timestamp and a payload.
12//! PCM layout lives on the [`Encoder`] / [`Decoder`] via
13//! [`EncoderInput`] / [`EncoderOutput`] / [`DecoderOutput`], not on
14//! each frame, so callers can't drift between calls.
15//! - [`Encoder`] / [`Decoder`] are the Opus codec types.
16//! - [`AudioProducer`] / [`AudioConsumer`] wire those together with
17//! `moq_mux::container` and the `hang` catalog.
18
19mod codec;
20mod error;
21mod format;
22mod frame;
23mod resample;
24
25#[cfg(feature = "capture")]
26pub mod capture;
27pub mod consumer;
28pub mod producer;
29
30pub use codec::*;
31pub use error::*;
32pub use format::*;
33pub use frame::*;
34pub use resample::Resampler;
35
36pub use consumer::AudioConsumer;
37pub use producer::AudioProducer;