Skip to main content

Output

Enum Output 

Source
#[non_exhaustive]
pub enum Output { Init(Vec<u8>), Samples { track_id: TrackId, samples: Vec<Sample>, }, Discontinuity, EndOfStream, Tracks(Vec<TrackSpec>), DisplayChanged { track_id: TrackId, pts: Option<i64>, display: Arc<DisplayInfo>, }, TrackDropped { track_id: TrackId, stream_type: Option<u8>, }, TrackSkipped { track_id: Option<TrackId>, fourcc: String, reason: String, }, FragmentDamaged { id: ResourceId, skipped: usize, }, Master(MasterSelection), }
Expand description

One unit of decoded output, drained in order via crate::client::HlsClient::next_output.

The ordering contract: exactly one Output::Init is emitted before any Output::Samples for a given track, and Samples are emitted in decode order with no gap and no repeat — a fetched Part’s samples are emitted exactly once, whether it arrived as a standalone Part fetch or was coalesced into its parent’s closed-segment view (see the crate docs’ “Dedup” section).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Init(Vec<u8>)

The Media Initialization Section bytes (ftyp+moov, RFC 8216bis §4.4.4.5’s EXT-X-MAP resource) — hand to the decoder once before any Samples. Re-emitted only when the playlist’s EXT-X-MAP changes (e.g. across an EXT-X-DISCONTINUITY).

§

Samples

Newly available coded samples (access units) for one track, in decode order, demuxed from a fetched Part or Segment resource via transmux::Fmp4Demux.

Fields

§track_id: TrackId

Track ID, matching the moov’s trak.tkhd.track_ID (ISO/IEC 14496-12 §8.3.2) carried by the preceding Output::Init.

§samples: Vec<Sample>

The samples, in decode order.

§

Discontinuity

EXT-X-DISCONTINUITY (RFC 8216 §4.3.4.3): the encoding, timestamps, tracks, or codec parameters may have changed between the previously emitted samples and the ones that follow this marker. Forwarded verbatim so the sink can flush/reset its decoder pipeline.

§

EndOfStream

The playlist reached #EXT-X-ENDLIST (RFC 8216 §4.3.3.4) with no further open segment or preload hint outstanding — playback is complete, no more output will ever be produced.

§

Tracks(Vec<TrackSpec>)

The full current track set for the stream. Emitted before Init on the classic TS-segment path and after the first Init on the fMP4 path.

§

DisplayChanged

A track’s display state changed (SPS geometry etc.).

Fields

§track_id: TrackId

Track ID.

§pts: Option<i64>

PTS of the affected access unit, if known.

§display: Arc<DisplayInfo>

The full new display state, shared with the following sample.

§

TrackDropped

A PMT-listed elementary stream of a TS segment was left out of the track set, the synthesized init and the samples because it cannot be carried in fragmented MP4 (transmux::CodecConfig::is_muxable_in_bmff is false: opaque data such as SCTE-35, ID3 or private PES, or a subtitle without a sample entry). Emitted each time the demuxer (re)announces such a track, so a consumer that reports it must deduplicate by track_id. A TS-segment stream with no muxable track at all produces only these.

Fields

§track_id: TrackId

The dropped track’s id.

§stream_type: Option<u8>

The PMT stream_type (ISO/IEC 13818-1 Table 2-34) when the track is opaque data.

§

TrackSkipped

A track of an fMP4 Media Initialization Section was left out of the track set and the samples because the demuxer could not model it: an encrypted sample entry (encv, enca, … — this client decrypts only AES-128 segments, never CENC/CBCS sample encryption) or an unrecognised codec. Emitted once per track and init, so a consumer that reports it deduplicates by track_id across inits. A stream whose every track is skipped produces only these, followed by an empty Output::Tracks.

Fields

§track_id: Option<TrackId>

The skipped trak’s tkhd.track_ID, None when the demuxer could not name it.

§fourcc: String

The track’s sample-entry four-character code (encv, enca, …).

§reason: String

The demuxer’s reason.

§

FragmentDamaged

The demuxer skipped one or more moof fragments of a Part/Segment resource — unparsable, or addressing sample data outside the resource (an absolute tfhd base-data-offset, which only holds when the segment sits at that offset of the whole file; CMAF uses default-base-is-moof). The samples of the other fragments are still emitted; those of the skipped ones are lost.

Fields

§id: ResourceId

The resource that held the skipped fragments.

§skipped: usize

How many fragments (or per-track fragment runs) were skipped.

§

Master(MasterSelection)

A master (multivariant) playlist was parsed and a variant selected. The caller may inspect MasterSelection and, for renditions with a url, create a second client via HlsClient::new(rendition.url).

Trait Implementations§

Source§

impl Clone for Output

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Output

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DescriptorObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> ExtensionObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TableObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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