Skip to main content

Module encode

Module encode 

Source
Expand description

Encode raw PCM and publish it as a moq audio track.

The output codec is selected via Codec, and the implementation behind it via Backend: a platform encoder when the host has one, software otherwise. Kind says what the audio carries, so Opus tunes for voice or music. AAC has no software encoder, so a host without a platform one refuses it.

Entry points, high to low level:

  • publish_capture publishes an independent capture consumer. Requires the capture feature.
  • Encoder encodes raw PCM you supply into Encoded packets, and Producer publishes them (bring your own PCM).
  • Producer alone publishes PCM you hand it, encoding as it goes.

Input declares the source PCM while Config describes exactly what the codec accepts. Options combines that config with publication policy.

publish_capture is unlinked above because it only exists with the capture feature, so a default-feature rustdoc build has nothing to link to.

Structs§

Capture
Capture and encode settings for publish_capture.
Config
Audio codec config shared by Encoder and Producer.
Driver
The task that encodes one consumer without owning its capture device.
Encoded
One encoded audio packet, plus what the codec was doing when it produced it.
Encoder
Audio encoder over codec-sized interleaved f32 PCM.
Finish
Packets emitted by Encoder::finish and the decoded padding at their end.
Finished
An audio track whose Producer finished it: every packet is published, and it can still be watched or aborted, but not written to.
Input
PCM supplied to Producer::write.
Options
Encode and publication policy for Producer.
Producer
Encode raw PCM and publish it as a moq-mux audio track.
Publication
A handle that observes a capture publication.
State
A snapshot of a capture publication’s lifecycle.

Enums§

Backend
Encoder backend selection.
Codec
Output audio codec. #[non_exhaustive] so new codecs can be added without breaking external matches.
Kind
What the audio carries, which tunes the codec for it.
Status
The capture publication’s current lifecycle state.

Functions§

publish_capture
Capture audio and publish it as an encoded MoQ track.