Skip to main content

Producer

Struct Producer 

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

Publishes encoded video frames as a moq track (avc3 / hev1 depending on the codec).

Built on the async side so the track is advertised (and the catalog registered) before the camera opens; this is what lets a subscriber trigger capture on demand. The moq_mux::codec importer for the codec handles catalog registration and framing.

Implementations§

Source§

impl Producer

Source

pub fn new( broadcast: Producer, catalog: Producer, codec: Codec, ) -> Result<Self, Error>

Publish a track for codec into broadcast, registering its rendition in catalog. The frames fed to publish must be in that codec’s framing (the matching Encoder emits it).

Source

pub fn demand(&self) -> Demand

A watch-only handle to the track’s subscriber demand, created eagerly so subscription state is observable before any frames arrive. Watch it via used / unused.

Source

pub fn publish(&mut self, encoded: &[Encoded]) -> Result<(), Error>

Publish already-encoded frames, each at its own timestamp. Each frame is one whole access unit in the producer’s codec framing.

Source

pub fn discontinuity(&mut self) -> Result<(), Error>

Mark a break in the published timeline: whatever is published next does not continue what came before.

Call this when the encoder stops rather than merely pausing between frames – a capture that goes idle, a source switch, anything that will resume on a re-anchored clock. See Producer::discontinuity for what the marker buys a consumer.

Source

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

Finalize the track.

Consumes the producer: nothing can be published after the track ends, so this is the last call rather than one leaving a dead producer in your hands.

Source

pub fn abort(self, err: Error)

Abort the track with err instead of finishing it cleanly, so subscribers see the real cause rather than moq_net::Error::Dropped.

Consumes the producer, like finish.

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> MaybeSend for T
where T: Send,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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