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
impl H265Packet
Sourcepub fn with_donl(&mut self, value: bool)
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.
Sourcepub fn with_length_prefix(&mut self, value: bool)
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.
Sourcepub fn with_depacketization_buffer(&mut self, buffer: H265DepacketizationBuffer)
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).
Sourcepub fn flush_depacketization_buffer(&mut self) -> Bytes
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.
Sourcepub fn payload(&self) -> &H265Payload
pub fn payload(&self) -> &H265Payload
payload returns the populated payload. Must be casted to one of:
- H265SingleNALUnitPacket
- H265FragmentationUnitPacket
- H265AggregationPacket
- H265PACIPacket
Sourcepub fn depacketize_with_sequence_number(
&mut self,
sequence_number: u16,
payload: &Bytes,
) -> Result<Bytes>
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.
Sourcepub fn nal_units(&mut self, payload: &Bytes) -> Result<Vec<H265NalUnit>>
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
impl Clone for H265Packet
Source§impl Debug for H265Packet
impl Debug for H265Packet
Source§impl Default for H265Packet
impl Default for H265Packet
Source§impl Depacketizer for H265Packet
impl Depacketizer for H265Packet
Source§fn depacketize(&mut self, payload: &Bytes) -> Result<Bytes>
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
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
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
fn is_partition_tail(&self, marker: bool, _payload: &Bytes) -> bool
Source§fn has_key_frames(&self) -> bool
fn has_key_frames(&self) -> bool
false, the default, is a format whose
frames stand alone (audio) or one this depacketizer cannot speak for.