Skip to main content

DemuxedPacket

Enum DemuxedPacket 

Source
pub enum DemuxedPacket<E: DemuxAdapter, D> {
    Video(VideoTrackPacket<E, D>),
    Audio(AudioTrackPacket<E, D>),
    Subtitle(SubtitleTrackPacket<E, D>),
    Data(DataTrackPacket<E, D>),
    Attachment(AttachmentTrackPacket<E, D>),
}
Expand description

One demuxed packet, with the track it came from.

Five arms — the whole delivery roster. Packets do not carry track coordinates; this envelope does, which is what lets the same VideoPacket type be handed straight to a decoder without stripping a field the decoder has no use for.

A track whose kind is TrackKind::Unknown has no arm, and its packets are therefore never delivered. The roster is closed at five on purpose: a kind nothing can name is a kind nothing can consume.

Variants§

§

Video(VideoTrackPacket<E, D>)

A compressed video packet.

§

Audio(AudioTrackPacket<E, D>)

A compressed audio packet.

§

Subtitle(SubtitleTrackPacket<E, D>)

A compressed subtitle packet.

§

Data(DataTrackPacket<E, D>)

A timed opaque-data packet.

§

Attachment(AttachmentTrackPacket<E, D>)

An attachment payload.

Implementations§

Source§

impl<E: DemuxAdapter, D> DemuxedPacket<E, D>

Source

pub const fn is_video(&self) -> bool

Returns true if this value is of type Video. Returns false otherwise

Source

pub const fn is_audio(&self) -> bool

Returns true if this value is of type Audio. Returns false otherwise

Source

pub const fn is_subtitle(&self) -> bool

Returns true if this value is of type Subtitle. Returns false otherwise

Source

pub const fn is_data(&self) -> bool

Returns true if this value is of type Data. Returns false otherwise

Source

pub const fn is_attachment(&self) -> bool

Returns true if this value is of type Attachment. Returns false otherwise

Source§

impl<E: DemuxAdapter, D> DemuxedPacket<E, D>

Source

pub fn unwrap_video(self) -> VideoTrackPacket<E, D>

Unwraps this value to the DemuxedPacket::Video variant. Panics if this value is of any other type.

Source

pub fn unwrap_video_ref(&self) -> &VideoTrackPacket<E, D>

Unwraps this reference to the DemuxedPacket::Video variant. Panics if this value is of any other type.

Source

pub fn unwrap_video_mut(&mut self) -> &mut VideoTrackPacket<E, D>

Unwraps this mutable reference to the DemuxedPacket::Video variant. Panics if this value is of any other type.

Source

pub fn unwrap_audio(self) -> AudioTrackPacket<E, D>

Unwraps this value to the DemuxedPacket::Audio variant. Panics if this value is of any other type.

Source

pub fn unwrap_audio_ref(&self) -> &AudioTrackPacket<E, D>

Unwraps this reference to the DemuxedPacket::Audio variant. Panics if this value is of any other type.

Source

pub fn unwrap_audio_mut(&mut self) -> &mut AudioTrackPacket<E, D>

Unwraps this mutable reference to the DemuxedPacket::Audio variant. Panics if this value is of any other type.

Source

pub fn unwrap_subtitle(self) -> SubtitleTrackPacket<E, D>

Unwraps this value to the DemuxedPacket::Subtitle variant. Panics if this value is of any other type.

Source

pub fn unwrap_subtitle_ref(&self) -> &SubtitleTrackPacket<E, D>

Unwraps this reference to the DemuxedPacket::Subtitle variant. Panics if this value is of any other type.

Source

pub fn unwrap_subtitle_mut(&mut self) -> &mut SubtitleTrackPacket<E, D>

Unwraps this mutable reference to the DemuxedPacket::Subtitle variant. Panics if this value is of any other type.

Source

pub fn unwrap_data(self) -> DataTrackPacket<E, D>

Unwraps this value to the DemuxedPacket::Data variant. Panics if this value is of any other type.

Source

pub fn unwrap_data_ref(&self) -> &DataTrackPacket<E, D>

Unwraps this reference to the DemuxedPacket::Data variant. Panics if this value is of any other type.

Source

pub fn unwrap_data_mut(&mut self) -> &mut DataTrackPacket<E, D>

Unwraps this mutable reference to the DemuxedPacket::Data variant. Panics if this value is of any other type.

Source

pub fn unwrap_attachment(self) -> AttachmentTrackPacket<E, D>

Unwraps this value to the DemuxedPacket::Attachment variant. Panics if this value is of any other type.

Source

pub fn unwrap_attachment_ref(&self) -> &AttachmentTrackPacket<E, D>

Unwraps this reference to the DemuxedPacket::Attachment variant. Panics if this value is of any other type.

Source

pub fn unwrap_attachment_mut(&mut self) -> &mut AttachmentTrackPacket<E, D>

Unwraps this mutable reference to the DemuxedPacket::Attachment variant. Panics if this value is of any other type.

Source§

impl<E: DemuxAdapter, D> DemuxedPacket<E, D>

Source

pub fn try_unwrap_video( self, ) -> Result<VideoTrackPacket<E, D>, TryUnwrapError<Self>>

Attempts to unwrap this value to the DemuxedPacket::Video variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_video_ref( &self, ) -> Result<&VideoTrackPacket<E, D>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the DemuxedPacket::Video variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_video_mut( &mut self, ) -> Result<&mut VideoTrackPacket<E, D>, TryUnwrapError<&mut Self>>

Attempts to unwrap this mutable reference to the DemuxedPacket::Video variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_audio( self, ) -> Result<AudioTrackPacket<E, D>, TryUnwrapError<Self>>

Attempts to unwrap this value to the DemuxedPacket::Audio variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_audio_ref( &self, ) -> Result<&AudioTrackPacket<E, D>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the DemuxedPacket::Audio variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_audio_mut( &mut self, ) -> Result<&mut AudioTrackPacket<E, D>, TryUnwrapError<&mut Self>>

Attempts to unwrap this mutable reference to the DemuxedPacket::Audio variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_subtitle( self, ) -> Result<SubtitleTrackPacket<E, D>, TryUnwrapError<Self>>

Attempts to unwrap this value to the DemuxedPacket::Subtitle variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_subtitle_ref( &self, ) -> Result<&SubtitleTrackPacket<E, D>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the DemuxedPacket::Subtitle variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_subtitle_mut( &mut self, ) -> Result<&mut SubtitleTrackPacket<E, D>, TryUnwrapError<&mut Self>>

Attempts to unwrap this mutable reference to the DemuxedPacket::Subtitle variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_data( self, ) -> Result<DataTrackPacket<E, D>, TryUnwrapError<Self>>

Attempts to unwrap this value to the DemuxedPacket::Data variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_data_ref( &self, ) -> Result<&DataTrackPacket<E, D>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the DemuxedPacket::Data variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_data_mut( &mut self, ) -> Result<&mut DataTrackPacket<E, D>, TryUnwrapError<&mut Self>>

Attempts to unwrap this mutable reference to the DemuxedPacket::Data variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_attachment( self, ) -> Result<AttachmentTrackPacket<E, D>, TryUnwrapError<Self>>

Attempts to unwrap this value to the DemuxedPacket::Attachment variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_attachment_ref( &self, ) -> Result<&AttachmentTrackPacket<E, D>, TryUnwrapError<&Self>>

Attempts to unwrap this reference to the DemuxedPacket::Attachment variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source

pub fn try_unwrap_attachment_mut( &mut self, ) -> Result<&mut AttachmentTrackPacket<E, D>, TryUnwrapError<&mut Self>>

Attempts to unwrap this mutable reference to the DemuxedPacket::Attachment variant. Returns a [TryUnwrapError] with the original value if this value is of any other type.

Source§

impl<E: DemuxAdapter, D> DemuxedPacket<E, D>

Source

pub const fn track(&self) -> TrackIndex

Returns the track this packet belongs to.

Source

pub const fn kind(&self) -> TrackKind

Returns the kind of track this packet came from.

Always equal to demuxer.tracks()[self.track().get()].kind().

Trait Implementations§

Source§

impl<E, D> Clone for DemuxedPacket<E, D>

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<E, D> Debug for DemuxedPacket<E, D>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E, D> Freeze for DemuxedPacket<E, D>

§

impl<E, D> RefUnwindSafe for DemuxedPacket<E, D>

§

impl<E, D> Send for DemuxedPacket<E, D>

§

impl<E, D> Sync for DemuxedPacket<E, D>

§

impl<E, D> Unpin for DemuxedPacket<E, D>

§

impl<E, D> UnsafeUnpin for DemuxedPacket<E, D>

§

impl<E, D> UnwindSafe for DemuxedPacket<E, D>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.