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).
Clone and Debug derive directly: every field is either a
concrete Copy type or one of E / D themselves, so the
derive’s per-parameter bound (E: Clone, D: Clone) is exactly
what cloning the fields requires — no associated-type indirection
to route around.
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.