Skip to main content

moq_audio/encode/
mod.rs

1//! Encode raw PCM and publish it as a moq audio track.
2//!
3//! The output codec is selected via [`Codec`].
4//!
5//! Entry points, high to low level:
6//! - `publish_capture` captures a microphone (or system audio) and publishes
7//!   it (turnkey). Requires the `capture` feature.
8//! - [`Encoder`] encodes raw PCM you supply, and [`Producer`] publishes the
9//!   resulting packets (bring your own PCM).
10//! - [`Producer`] alone publishes PCM you hand it, encoding as it goes.
11//!
12//! [`Input`] declares the PCM layout going in. [`Config`] configures the
13//! bring-your-own-PCM [`Encoder`], which needs that layout up front; [`Options`]
14//! configures [`Producer`] and `publish_capture`, which learn it from the
15//! caller's frames or the capture source instead. The decode/consume counterpart
16//! lives in the sibling [`decode`](crate::decode) module.
17//!
18//! `publish_capture` is unlinked above because it only exists with the `capture`
19//! feature, so a default-feature rustdoc build has nothing to link to.
20
21mod encoder;
22mod producer;
23
24#[cfg(feature = "capture")]
25mod capture;
26
27pub use encoder::{Codec, Config, Encoder, Input};
28pub use producer::{Options, Producer};
29
30#[cfg(feature = "capture")]
31pub use capture::publish_capture;