pub struct Packet {
pub stream_index: usize,
pub pts: Option<i64>,
pub dts: Option<i64>,
pub duration: i64,
pub end_position: Option<i64>,
pub discard_padding: u32,
pub time_base: Rational,
pub data: Vec<u8>,
pub flags: PacketFlags,
}Expand description
A compressed packet belonging to a single stream.
Fields§
§stream_index: usizeIndex of the stream this packet belongs to within its container.
pts: Option<i64>Presentation timestamp, in the stream’s time_base units. None if unset.
dts: Option<i64>Decode timestamp, in the stream’s time_base units. None if unset.
duration: i64Duration of this packet, in time_base units (0 if unknown).
end_position: Option<i64>Where the stream’s decoded output ENDS once this packet is decoded, in
time_base units, when the container records it — Ogg’s granule
position, which sits on the last packet completing each page (None
on the others, and in containers without one). Unlike pts it marks an
end, not a start: decoders count samples from it to trim end padding
off the end_of_stream packet.
discard_padding: u32Samples (per channel, at the stream’s sample rate) to drop from the
END of this packet’s decoded output; 0 = none. The container’s record
of the encoder’s end padding on a stream’s last packet — Matroska’s
DiscardPadding, FFmpeg’s AV_PKT_DATA_SKIP_SAMPLES end field — for
containers whose timestamps are too coarse to carry it as an
end_position. As in FFmpeg, audio decoders drop
that many samples when it fits in what the packet decodes to and
ignore it otherwise.
time_base: RationalThe stream time base these timestamps are expressed in.
data: Vec<u8>The compressed payload.
flags: PacketFlagsPacket flags (keyframe, …).