Skip to main content

H265Packet

Struct H265Packet 

Source
pub struct H265Packet { /* private fields */ }
Expand description

Packet implementation

H265Packet represents a H265 packet, stored in the payload of an RTP packet.

As a Depacketizer it turns RTP payloads into NAL units, in an Annex B byte stream (or length-prefixed, see with_length_prefix): a single NAL unit packet’s NAL unit, each NAL unit of an aggregation packet, a NAL unit reassembled from its fragmentation units, and whichever of those a PACI packet carries. Nothing of type 48 to 63 is ever passed on (RFC 7798 section 6).

Implementations§

Source§

impl H265Packet

Source

pub fn with_donl(&mut self, value: bool)

with_donl can be called to specify whether or not DONL might be parsed. DONL may need to be parsed if sprop-max-don-diff is greater than 0 on the RTP stream.

Source

pub fn with_length_prefix(&mut self, value: bool)

Emits each NAL unit with a four-byte big-endian length before it (the hvcC sample format) in place of an Annex B start code.

Source

pub fn with_depacketization_buffer(&mut self, buffer: H265DepacketizationBuffer)

Receives a stream whose sprop-max-don-diff is greater than 0 in decoding order: DONL and DOND are parsed, and NAL units go through buffer before depacketize returns them (RFC 7798 section 6).

Source

pub fn flush_depacketization_buffer(&mut self) -> Bytes

The NAL units still in the de-packetization buffer, in decoding order and in the output format of depacketize: for the end of the stream.

Source

pub fn payload(&self) -> &H265Payload

payload returns the populated payload. Must be casted to one of:

  • H265SingleNALUnitPacket
  • H265FragmentationUnitPacket
  • H265AggregationPacket
  • H265PACIPacket
Source

pub fn depacketize_with_sequence_number( &mut self, sequence_number: u16, payload: &Bytes, ) -> Result<Bytes>

As depacketize, given the packet’s RTP sequence number: when a packet is missing before this one, the fragments collected so far are discarded with the rest of their NAL unit, in place of a NAL unit with a hole in it (RFC 7798 section 4.4.3). Give the packets in sequence number order.

§Errors

As depacketize.

Source

pub fn nal_units(&mut self, payload: &Bytes) -> Result<Vec<H265NalUnit>>

The NAL units a payload completes, with their decoding order numbers when the stream carries them: one for a single NAL unit packet, two or more for an aggregation packet, none or one for a fragmentation unit, and those of the packet a PACI carries. The de-packetization buffer is not involved. payload is the parsed packet afterwards.

§Errors

Fails for a payload cut short, a packet with the F bit set, and a reassembly over MAX_H265_FU_NALU_SIZE.

Trait Implementations§

Source§

impl Clone for H265Packet

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 Debug for H265Packet

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for H265Packet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Depacketizer for H265Packet

Source§

fn depacketize(&mut self, payload: &Bytes) -> Result<Bytes>

Parses one RTP payload and returns the NAL units it completes, each behind an Annex B start code (or a length prefix): empty for a fragment that does not end its NAL unit.

Source§

fn is_partition_head(&self, payload: &Bytes) -> bool

is_partition_head checks if this is the head of a packetized nalu stream.

Every payload begins a NAL unit except a fragmentation unit whose start bit is clear (RFC 7798 4.4.3: the FU header’s S bit marks the first fragment). A fragmentation unit too short to carry its FU header cannot begin anything.

Source§

fn is_key_frame_start(&self, payload: &Bytes) -> bool

A packet that carries the first slice segment of an intra random access point picture (nal_unit_type 16 to 21: BLA, IDR and CRA, with first_slice_segment_in_pic_flag set; ITU-T H.265 sections 3.69 and 7.3.6.1: decoding can begin there, and the pictures that follow it in output order need nothing before it): as a single NAL unit packet, as the first fragment of a fragmentation unit, or inside an aggregation packet behind nothing but parameter sets, SEI and access unit delimiters (RFC 7798 sections 4.4.1 to 4.4.3). A PACI packet is not looked into.

Source§

fn is_partition_tail(&self, marker: bool, _payload: &Bytes) -> bool

Checks if the packet is at the end of a partition. This should return false if the result could not be determined.
Source§

fn has_key_frames(&self) -> bool

Whether frames of this format are predicted from earlier frames, so that a receiver that lost one cannot use what follows until a key frame (a decoder refresh point, RFC 5104 section 2.2) arrives: the video formats. false, the default, is a format whose frames stand alone (audio) or one this depacketizer cannot speak for.
Source§

impl Eq for H265Packet

Source§

impl PartialEq for H265Packet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for H265Packet

Auto Trait Implementations§

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<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> 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.