Skip to main content

Broadcaster

Struct Broadcaster 

Source
pub struct Broadcaster { /* private fields */ }
Expand description

All renditions of one broadcast, kept in sync with its catalog.

Implementations§

Source§

impl Broadcaster

Source

pub async fn new(source: Source, config: Config) -> Result<Arc<Self>>

Resolve source’s catalog broadcast and start tracking its renditions.

Source

pub fn is_closed(&self) -> bool

Whether the source broadcast has closed (ended or dropped).

Source

pub async fn closed(&self)

Resolve once the source broadcast closes, so a pool can evict a dead broadcaster.

Source

pub fn rendition(&self, kind: Kind, name: &str) -> Option<Arc<Rendition>>

Look up a rendition by kind and name. Video and audio are separate axes, so a video and an audio rendition may share a name without colliding.

Source

pub fn renditions(&self) -> Consumer

A cursor over rendition add/remove events, for a consumer that mirrors or records the whole broadcast. It replays the current renditions, then yields changes, and returns None once the source closes.

Source

pub async fn ready(&self)

Resolve once at least one rendition has a playable media playlist. How long to wait is the caller’s policy: wrap this in a timeout (or select against it) as needed.

Source

pub fn set_generation(&self, generation: Option<&str>) -> Result<()>

Version every segment URL with generation, a label for the publisher run the broadcast carries now, or stop versioning with None (the default).

A restarted publisher is spliced into the same broadcast and restarts its segment numbers, so seg/0.m4s would name different bytes on each run. Supply a new generation before the new run’s media flows. Replacing one drops every listed segment and every init built from the old run’s media, while the first only labels the run already flowing. A segment URL carrying any other generation is refused. Init URLs need none: they carry a hash of their bytes.

Fails unless generation is non-empty ASCII letters, digits, -, and _.

Source

pub fn master_playlist(&self, query: Option<&str>) -> String

Render the multivariant (master) playlist from the current renditions.

query is an optional query string (without the leading ?, e.g. jwt=<token>) appended to every child media-playlist URL, so a credential the master was fetched with propagates to the rendition playlists a stock player loads next. It is an argument rather than a Config field because one broadcaster fans out to viewers holding different tokens; a credential in Config would embed one viewer’s in another’s playlist.

Source

pub fn manifest(&self, query: Option<&str>) -> Option<String>

Render the DASH manifest (MPD) from the current renditions and their views of the broadcast timeline, or None while nothing is listable yet (every SegmentTimeline would be empty, which players reject).

Live broadcasts render a dynamic presentation anchored at the catalog’s declared wall clock (or, absent one, at an anchor estimated from the first record’s arrival); a finished broadcast renders static. query propagates to every child URL exactly as in master_playlist.

Each representation names its init by a hash of the bytes, so a rendition is left out until its init is known. An inline-parameter-set codec only learns it from media: await each rendition’s init first.

Trait Implementations§

Source§

impl Drop for Broadcaster

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more