Skip to main content

Crate moq_ext_publisher

Crate moq_ext_publisher 

Source
Expand description

A broadcast that encodes sources into renditions, apart from any transport.

A LocalBroadcast holds a catalog, a media clock, one video slot and one audio slot. The video slot opens its source once and encodes it into a ladder of renditions, each encoding only while someone watches it. A transport publishes the broadcast by creating the broadcast::Producer it fills (LocalBroadcast::new_in, or TryFrom), so readers get it without a copy. LocalBroadcast::consume reads it in-process.

The sources come from moq-ext-sources, and the codecs from moq_video and moq_audio. Nothing here depends on iroh or on a player. LocalBroadcast::set_spec opens the sources a text specifier such as cam or file:clip.mp4 names, and sets them in one call.

§Examples

use moq_ext_publisher::{LocalBroadcast, VideoEncoding, VideoRendition};
use moq_ext_sources::VideoSource;
use moq_video as video;

let source = VideoSource::test_pattern(
    video::Size::new(1280, 720),
    video::FrameRate::new(30, 1).expect("a valid rate"),
)
.expect("the pattern thread starts");
let broadcast = LocalBroadcast::new();
broadcast.set_video(
    source,
    VideoEncoding::ladder([VideoRendition::p360(), VideoRendition::p720()]),
)?;

A microphone is opened inside the publication that encodes it, so a device that fails after AudioSource::microphone returned shows in LocalBroadcast::status. A failed microphone is not opened again: the audio slot stays failed until the audio is set again.

Modules§

audio_encoding
Audio encoding presets for LocalBroadcast::set_audio.

Structs§

AudioEncodeStats
The audio publication.
AudioEncoding
How an audio source is encoded: moq-audio’s encoder settings and the span of each group.
EncodeStats
One video rendition’s encoder.
LocalBroadcast
A broadcast this process produces.
MediaEncoding
How LocalBroadcast::set_spec encodes the sources it opens.
PublishStats
What a LocalBroadcast is sending.
PublishStatus
The state of both slots of a broadcast, and of every rendition.
SourceClosed
The source a FrameSender feeds has gone.
ValueError
An error from a value track: a moq_json::Error that ? can convert.
ValueWriter
Writes a latest-value JSON track, stamping each update with the time it is made.
VideoEncoding
How a video source is encoded: one or more renditions of the same picture.
VideoRendition
One encoding of a broadcast’s picture.

Enums§

Error
An error from the media crates.
RenditionState
Whether one rendition is encoding.
SlotState
The state of one media slot, on a broadcast or on a player.