pub struct VideoPacket<E, D> { /* private fields */ }Expand description
A compressed video packet.
Generic over the [VideoAdapter] (which contributes
A::PacketExtra) and the buffer type B: AsRef<[u8]>.
pts / dts / duration are Option<Timestamp> because not
every backend supplies all three (WebCodecs EncodedVideoChunk
has no DTS; vendor RAW SDKs that produce packets at all derive
timestamps from frame index × fps).
Implementations§
Source§impl<E, D> VideoPacket<E, D>
impl<E, D> VideoPacket<E, D>
Sourcepub const fn new(data: D, extra: E) -> Self
pub const fn new(data: D, extra: E) -> Self
Constructs a VideoPacket from data and extra. All
timestamps default to None and flags to empty.
Sourcepub const fn flags(&self) -> PacketFlags
pub const fn flags(&self) -> PacketFlags
Returns the packet flags.
Sourcepub fn extra_mut(&mut self) -> &mut E
pub fn extra_mut(&mut self) -> &mut E
Returns a mutable reference to the backend-specific extras.
Sourcepub fn into_parts(self) -> (D, E)
pub fn into_parts(self) -> (D, E)
Consumes the packet and returns (buffer, extras).
Sourcepub const fn with_duration(self, v: Option<Timestamp>) -> Self
pub const fn with_duration(self, v: Option<Timestamp>) -> Self
Sets the duration (consuming builder).
Sourcepub const fn with_flags(self, v: PacketFlags) -> Self
pub const fn with_flags(self, v: PacketFlags) -> Self
Sets the flags (consuming builder).
Sourcepub const fn set_duration(&mut self, v: Option<Timestamp>) -> &mut Self
pub const fn set_duration(&mut self, v: Option<Timestamp>) -> &mut Self
Sets the duration in place.
Sourcepub const fn set_flags(&mut self, v: PacketFlags) -> &mut Self
pub const fn set_flags(&mut self, v: PacketFlags) -> &mut Self
Sets the flags in place.
Auto Trait Implementations§
impl<E, D> Freeze for VideoPacket<E, D>
impl<E, D> RefUnwindSafe for VideoPacket<E, D>where
D: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, D> Send for VideoPacket<E, D>
impl<E, D> Sync for VideoPacket<E, D>
impl<E, D> Unpin for VideoPacket<E, D>
impl<E, D> UnsafeUnpin for VideoPacket<E, D>where
D: UnsafeUnpin,
E: UnsafeUnpin,
impl<E, D> UnwindSafe for VideoPacket<E, D>where
D: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more