Skip to main content

Republish

Struct Republish 

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

Imports one program of a multiplex as a broadcast on origin, republishing the path under a new identity each time the source changes.

The single-program sibling of Programs. Each identity is created hidden and announced once its catalog first goes out: a relay queries a broadcast’s tracks the moment it is announced, so one announced any sooner would be asked for tracks it cannot serve yet.

A change of source is a Step: the source’s clock moving onto another timeline, or its PAT naming another program, as Import::decode judges it. decode then finishes the identity before the step, withdrawing it, and opens the next under a new identity, returning the step as Republished. Nothing crosses it but the measured mux rate: the new catalog records it from its first media rather than holding for a fresh measurement window, since the multiplex is the same. The new identity waits for the source’s own PAT, PMT and next keyframe.

Implementations§

Source§

impl Republish

Source

pub fn new( origin: Producer, name: impl Into<Path>, identity: Identity, config: Config, ) -> Result<Self, Error>

Import the multiplex onto name, its catalogs built from config, publishing the first identity as identity and each after it under a fresh one. The first is created now, so its catalog can be filled before any input.

Pass Identity::random unless the identity is shared, such as across a run’s broadcasts; see RouteOptions::with_identity.

Source

pub fn with_program(self, program: u16) -> Self

Import only the program with this PAT program number; see Import::with_program.

Source

pub fn broadcast(&self) -> &Producer

The current identity’s broadcast, such as for a track of the caller’s own.

Source

pub fn catalog(&self) -> &Producer<Ext>

The current identity’s catalog. Sections set before the importer declares a track ride the first catalog; set them again on each new identity after Republished.

Source

pub fn identity(&self) -> Identity

The current identity’s publisher identity.

Source

pub fn decode(&mut self, data: &[u8]) -> Result<Option<Republished>, Error>

Demux a chunk of the multiplex into the current identity, announcing it once its catalog goes out. A trailing partial packet is retained for the next call.

A change of source finishes the identity there and opens the next, returning Republished before the next reads anything: the rest of data is held for it, read at the start of the next call. Call again, with no data if there is none, until it returns None. A failure to finish the identity before the step returns that failure, with the next identity current.

Source

pub fn stats(&self) -> Snapshot

What every elementary stream of the current identity has delivered; see Import::stats.

Source

pub fn finish(self) -> Result<Finished, Error>

Finish the current identity’s media tracks, then its catalog while it still lists them, and return the Finished broadcast.

Input still held after a Republished, or while a step was judged, is read first, republishing again at any step in it. Fails when the input ended before the identity declared a track, so nothing was announced. A finish that fails aborts every track with the cause.

Source

pub fn abort(self, err: Error)

Abort the current identity’s catalog and media tracks with err. Consumes the importer.

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<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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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