RtpPacketMut

Struct RtpPacketMut 

Source
pub struct RtpPacketMut<'a> { /* private fields */ }
Expand description

Mutable parsed RTP packet for editing of some fields.

Implementations§

Source§

impl<'a> RtpPacketMut<'a>

Source

pub const MIN_RTP_PACKET_LEN: usize = 12usize

The minimum number of bytes a RTP packet must be to be parsed correctly.

Source

pub fn parse(data: &'a mut [u8]) -> Result<RtpPacketMut<'a>, RtpParseError>

Parse a byte slice into an editable RtpPacketMut. The packet is first parsed using RtpPacket::parse and will fail if parsing fails.

Source

pub fn set_marker(&mut self, marker: bool)

👎Deprecated: Use set_marker_bit() instead

Change the marker bit of this packet.

Source

pub fn set_marker_bit(&mut self, marker_bit: bool)

Change the marker bit of this packet.

Source

pub fn set_payload_type(&mut self, pt: u8) -> Result<(), RtpWriteError>

Change the payload type of this packet.

Source

pub fn set_sequence_number(&mut self, sequence: u16)

Change the sequence number of this packet.

Source

pub fn set_timestamp(&mut self, timestamp: u32)

Change the timestamp of this packet.

Source

pub fn set_ssrc(&mut self, ssrc: u32)

Change the SSRC of this packet.

Source

pub fn set_extension_id(&mut self, id: u16)

Change the extension identifier of this packet.

This has no effect if the packet does not contain any extension data.

Source

pub fn extension_mut(&mut self) -> Option<&mut [u8]>

Returns a mutable reference to the extension data for this packet, if any.

Source

pub fn payload_mut(&mut self) -> &mut [u8]

Returns a mutable reference to the payload data of this packet.

Methods from Deref<Target = RtpPacket<'a>>§

Source

pub const MIN_RTP_PACKET_LEN: usize = 12usize

Source

pub const MAX_N_CSRCS: usize = 15usize

Source

pub fn version(&self) -> u8

The RTP version in this packet. Only version 2 is supported.

Source

pub fn padding_bit(&self) -> bool

Returns whether the padding bit is set for this packet.

Source

pub fn padding(&self) -> Option<u8>

Returns the number of bytes of padding used by this packet or None.

Source

pub fn extension_bit(&self) -> bool

Returns whether the extension bit is set for this packet.

Source

pub fn n_csrcs(&self) -> u8

Returns the number of Contribution Sources for this packet. May not be used by this packet.

Source

pub fn marker(&self) -> bool

👎Deprecated: Use marker_bit() instead

Returns whether the marker bit is set for this packet. The meaning of the marker bit is payload-specific.

Source

pub fn marker_bit(&self) -> bool

Returns whether the marker bit is set for this packet. The meaning of the marker bit is payload-specific.

Source

pub fn payload_type(&self) -> u8

Returns the payload type for this packet.

Source

pub fn sequence_number(&self) -> u16

Returns the sequence number for this packet.

Source

pub fn timestamp(&self) -> u32

Returns the RTP timestamp for this packet

Source

pub fn ssrc(&self) -> u32

Returns the Sychronisation Source for this packet.

Source

pub fn csrc(&self) -> impl Iterator<Item = u32> + '_

Returns a (potentially empty) iterator over the Contribution Sources for this packet.

Source

pub fn extension_len(&self) -> usize

Returns the length of the extension data in this packet.

Source

pub fn extension(&self) -> Option<(u16, &[u8])>

Returns the extension data for this packet. The first value is an identifier and is ‘defined by the RTP profile’. The second value is the extension data.

Source

pub fn payload_offset(&self) -> usize

Returns the offset of the payload in this packet relative to the beginning of the packet.

Source

pub fn payload_len(&self) -> usize

Returns the length of the payload in this packet without padding.

Source

pub fn payload(&self) -> &[u8]

Returns the payload data.

Source

pub fn as_builder(&'a self) -> RtpPacketBuilder<&'a [u8], &'a [u8]>

Creates a builder that will be able to reconstruct this packet byte for byte (excluding any padding bytes). Any aspect of the returned builder can be modified.

Trait Implementations§

Source§

impl<'a> Debug for RtpPacketMut<'a>

Source§

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

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

impl<'a> Deref for RtpPacketMut<'a>

Source§

type Target = RtpPacket<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for RtpPacketMut<'a>

§

impl<'a> RefUnwindSafe for RtpPacketMut<'a>

§

impl<'a> Send for RtpPacketMut<'a>

§

impl<'a> Sync for RtpPacketMut<'a>

§

impl<'a> Unpin for RtpPacketMut<'a>

§

impl<'a> !UnwindSafe for RtpPacketMut<'a>

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.