Skip to main content

H264Packet

Struct H264Packet 

Source
pub struct H264Packet {
    pub is_avc: bool,
    /* private fields */
}
Expand description

H264Packet represents the H264 header that is stored in the payload of an RTP Packet

Fields§

§is_avc: bool

Whether to emit AVCC length-prefixed output instead of Annex B start codes.

Implementations§

Source§

impl H264Packet

Source

pub fn with_deinterleaving(self, buffer: H264DeinterleavingBuffer) -> Self

Receives an interleaved stream (packetization-mode=2) in decoding order: NAL units that carry a DON go through buffer before depacketize returns them (RFC 6184 section 7.2.2). Without this, NAL units come out in the order their packets hold them, which is decoding order for modes 0 and 1.

Source

pub fn flush_deinterleaving(&mut self) -> Bytes

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

Source

pub fn depacketize_with_sequence_number( &mut self, sequence_number: u16, packet: &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 6184 section 5.8: a receiver discards the following fragmentation units of a NAL unit after a lost one). Give the packets in sequence number order.

§Errors

As depacketize.

Source

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

The NAL units a payload completes, with the decoding order number and timestamp offset its packet type gives them: one for a single NAL unit packet, several for an aggregate, none or one for a fragment. Reserved packet types yield nothing (RFC 6184 section 5.4: a receiver ignores them). The de-interleaving buffer is not involved.

§Errors

Fails for an empty payload, an aggregate or fragment cut short, a NAL unit size that runs past the payload, and a reassembly over MAX_FUA_NALU_SIZE.

Trait Implementations§

Source§

impl Clone for H264Packet

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 H264Packet

Source§

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

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

impl Default for H264Packet

Source§

fn default() -> Self

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

impl Depacketizer for H264Packet

Source§

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

depacketize parses the passed byte slice and stores the result in the H264Packet this method is called upon

Source§

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

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

Source§

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

A packet that carries the first slice of an IDR picture (nal_unit_type 5 with first_mb_in_slice 0, ITU-T H.264 sections 7.3.3 and 7.4.1.2.4: an IDR picture is decoded without reference to any earlier picture): as a single NAL unit packet, as the first fragment of an FU-A or FU-B, or inside an STAP-A or STAP-B behind nothing but parameter sets, SEI and access unit delimiters (RFC 6184 sections 5.6 to 5.8). Parameter sets sent in packets of their own before it belong to the same access unit (the same RTP timestamp) and are not what this names.

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 H264Packet

Source§

impl PartialEq for H264Packet

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 H264Packet

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.