pub struct Packet {
    pub ts: u64,
    pub dur: u64,
    pub trim_start: u32,
    pub trim_end: u32,
    pub data: Box<[u8]>,
    /* private fields */
}
Expand description

A Packet contains a discrete amount of encoded data for a single codec bitstream. The exact amount of data is bounded, but not defined, and is dependant on the container and/or the encapsulated codec.

Fields

ts: u64

The timestamp of the packet. When gapless support is enabled, this timestamp is relative to the end of the encoder delay.

This timestamp is in TimeBase units.

dur: u64

The duration of the packet. When gapless support is enabled, the duration does not include the encoder delay or padding.

The duration is in TimeBase units.

trim_start: u32

When gapless support is enabled, this is the number of decoded frames that should be trimmed from the start of the packet to remove the encoder delay. Must be 0 in all other cases.

trim_end: u32

When gapless support is enabled, this is the number of decoded frames that should be trimmed from the end of the packet to remove the encoder padding. Must be 0 in all other cases.

data: Box<[u8]>

The packet buffer.

Implementations

Create a new Packet from a slice.

Create a new Packet from a boxed slice.

Create a new Packet with trimming information from a slice.

Create a new Packet with trimming information from a boxed slice.

The track identifier of the track this packet belongs to.

Get the timestamp of the packet in TimeBase units.

If gapless support is enabled, then this timestamp is relative to the end of the encoder delay.

Get the duration of the packet in TimeBase units.

If gapless support is enabled, then this is the duration after the encoder delay and padding is trimmed.

Get the duration of the packet in TimeBase units if no decoded frames are trimmed.

If gapless support is disabled, then this is the same as the duration.

Get the number of frames to trim from the start of the decoded packet.

Get the number of frames to trim from the end of the decoded packet.

Get an immutable slice to the packet buffer.

Get a BufStream to read the packet data buffer sequentially.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.