RtpHeader

Struct RtpHeader 

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

RTP header.

Implementations§

Source§

impl RtpHeader

Source

pub const fn new() -> Self

Create a new RTP header.

Source

pub fn decode(data: &mut Bytes) -> Result<Self, InvalidInput>

Decode an RTP header from given data.

Source

pub fn encode(&self, buf: &mut BytesMut)

Encode the header.

Source

pub fn padding(&self) -> bool

Check if the RTP packet contains any padding.

Source

pub fn with_padding(self, padding: bool) -> Self

Set the padding bit.

Source

pub fn extension(&self) -> Option<&RtpHeaderExtension>

Check if there is an RTP header extension.

Source

pub fn with_extension(self, extension: Option<RtpHeaderExtension>) -> Self

Set the extension bit.

Source

pub fn marker(&self) -> bool

Check if the RTP marker bit is set.

Source

pub fn with_marker(self, marker: bool) -> Self

Set the marker bit.

Source

pub fn payload_type(&self) -> u8

Get RTP payload type.

Note: Only the lower 7 bits are used.

Source

pub fn with_payload_type(self, payload_type: u8) -> Self

Set the payload type.

§Panics

The method panics if the payload type is greater than 127.

Source

pub fn sequence_number(&self) -> u16

Get RTP sequence number.

Source

pub fn with_sequence_number(self, n: u16) -> Self

Set the sequence number.

Source

pub fn timestamp(&self) -> u32

Get RTP timestamp.

Source

pub fn with_timestamp(self, timestamp: u32) -> Self

Set RTP timestamp.

Source

pub fn ssrc(&self) -> u32

Get the SSRC identifier.

Source

pub fn with_ssrc(self, ssrc: u32) -> Self

Set the SSRC identifier.

Source

pub fn csrcs(&self) -> &[u32]

Get a list of CSRC identifiers.

Source

pub fn with_csrcs<T>(self, csrcs: T) -> Self
where T: Into<Vec<u32>>,

Set the CSRC identifiers.

§Panics

The method panics if the number of identifiers is greater than 255.

Source

pub fn raw_size(&self) -> usize

Get raw size of the header (i.e. byte length of the encoded header).

Trait Implementations§

Source§

impl Clone for RtpHeader

Source§

fn clone(&self) -> RtpHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RtpHeader

Source§

fn default() -> Self

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

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V