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§
- Audio
Encode Stats - The audio publication.
- Audio
Encoding - How an audio source is encoded: moq-audio’s encoder settings and the span of each group.
- Encode
Stats - One video rendition’s encoder.
- Local
Broadcast - A broadcast this process produces.
- Media
Encoding - How
LocalBroadcast::set_specencodes the sources it opens. - Publish
Stats - What a
LocalBroadcastis sending. - Publish
Status - The state of both slots of a broadcast, and of every rendition.
- Source
Closed - The source a
FrameSenderfeeds has gone. - Value
Error - An error from a value track: a
moq_json::Errorthat?can convert. - Value
Writer - Writes a latest-value JSON track, stamping each update with the time it is made.
- Video
Encoding - How a video source is encoded: one or more renditions of the same picture.
- Video
Rendition - One encoding of a broadcast’s picture.
Enums§
- Error
- An error from the media crates.
- Rendition
State - Whether one rendition is encoding.
- Slot
State - The state of one media slot, on a broadcast or on a player.