moq_video/encode/mod.rs
1//! Encode captured video and publish it as a moq video track.
2//!
3//! The output codec is selected via [`Codec`] (H.264 or H.265); see its docs
4//! for which backends cover each on this platform.
5//!
6//! Entry points, high to low level:
7//! - `publish_capture` captures and publishes a webcam (turnkey). Requires the
8//! `capture` feature.
9//! - [`Encoder`] encodes raw [`Frame`](crate::Frame)s you supply into
10//! [`Encoded`] access units, and [`Producer`] publishes those (bring your own
11//! frames). Build both for the same [`Codec`].
12//! - [`Sink`] is an [`Encoder`] that owns the thread it runs on, for an encoder
13//! outliving a single thread's stack (a shared object, an FFI handle, a task
14//! that migrates between workers).
15//! - [`Producer`] alone publishes frames you already encoded.
16//!
17//! A [`Producer`] advertises its catalog rendition as soon as the track exists,
18//! resolved from the encoder itself via [`Config::probe`], so a subscriber can
19//! discover a track nothing has encoded yet. That's what makes on-demand
20//! encoding possible at all.
21//!
22//! [`Options`] / [`Kind`] / [`Config`] configure them. The decode/consume
23//! counterpart (mirror of `moq-audio`'s consumer) lives in the sibling
24//! [`decode`](crate::decode) module.
25//!
26//! [`rate`] holds the policy mapping a congestion-control bandwidth estimate
27//! onto the encoder's bitrate, which `publish_capture` drives for you.
28
29mod backend;
30mod encoded;
31mod encoder;
32mod producer;
33mod sink;
34
35pub mod rate;
36
37pub use encoded::Encoded;
38pub use encoder::{Codec, Config, Encoder, Kind};
39pub use producer::Producer;
40#[cfg(feature = "capture")]
41pub use producer::{Options, publish_capture};
42pub use sink::Sink;