pub struct RtpPacketMut<'a> { /* private fields */ }Expand description
Mutable parsed RTP packet for editing of some fields.
Implementations§
Source§impl<'a> RtpPacketMut<'a>
impl<'a> RtpPacketMut<'a>
Sourcepub const MIN_RTP_PACKET_LEN: usize = 12usize
pub const MIN_RTP_PACKET_LEN: usize = 12usize
The minimum number of bytes a RTP packet must be to be parsed correctly.
Sourcepub fn parse(data: &'a mut [u8]) -> Result<RtpPacketMut<'a>, RtpParseError>
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.
Sourcepub fn set_marker(&mut self, marker: bool)
👎Deprecated: Use set_marker_bit() instead
pub fn set_marker(&mut self, marker: bool)
set_marker_bit() insteadChange the marker bit of this packet.
Sourcepub fn set_marker_bit(&mut self, marker_bit: bool)
pub fn set_marker_bit(&mut self, marker_bit: bool)
Change the marker bit of this packet.
Sourcepub fn set_payload_type(&mut self, pt: u8) -> Result<(), RtpWriteError>
pub fn set_payload_type(&mut self, pt: u8) -> Result<(), RtpWriteError>
Change the payload type of this packet.
Sourcepub fn set_sequence_number(&mut self, sequence: u16)
pub fn set_sequence_number(&mut self, sequence: u16)
Change the sequence number of this packet.
Sourcepub fn set_timestamp(&mut self, timestamp: u32)
pub fn set_timestamp(&mut self, timestamp: u32)
Change the timestamp of this packet.
Sourcepub fn set_extension_id(&mut self, id: u16)
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.
Sourcepub fn extension_mut(&mut self) -> Option<&mut [u8]>
pub fn extension_mut(&mut self) -> Option<&mut [u8]>
Returns a mutable reference to the extension data for this packet, if any.
Sourcepub fn payload_mut(&mut self) -> &mut [u8] ⓘ
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>>§
pub const MIN_RTP_PACKET_LEN: usize = 12usize
pub const MAX_N_CSRCS: usize = 15usize
Sourcepub fn padding_bit(&self) -> bool
pub fn padding_bit(&self) -> bool
Returns whether the padding bit is set for this packet.
Sourcepub fn padding(&self) -> Option<u8>
pub fn padding(&self) -> Option<u8>
Returns the number of bytes of padding used by this packet or None.
Sourcepub fn extension_bit(&self) -> bool
pub fn extension_bit(&self) -> bool
Returns whether the extension bit is set for this packet.
Sourcepub fn n_csrcs(&self) -> u8
pub fn n_csrcs(&self) -> u8
Returns the number of Contribution Sources for this packet. May not be used by this packet.
Sourcepub fn marker(&self) -> bool
👎Deprecated: Use marker_bit() instead
pub fn marker(&self) -> bool
marker_bit() insteadReturns whether the marker bit is set for this packet. The meaning of the marker bit is payload-specific.
Sourcepub fn marker_bit(&self) -> bool
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.
Sourcepub fn payload_type(&self) -> u8
pub fn payload_type(&self) -> u8
Returns the payload type for this packet.
Sourcepub fn sequence_number(&self) -> u16
pub fn sequence_number(&self) -> u16
Returns the sequence number for this packet.
Sourcepub fn csrc(&self) -> impl Iterator<Item = u32> + '_
pub fn csrc(&self) -> impl Iterator<Item = u32> + '_
Returns a (potentially empty) iterator over the Contribution Sources for this packet.
Sourcepub fn extension_len(&self) -> usize
pub fn extension_len(&self) -> usize
Returns the length of the extension data in this packet.
Sourcepub fn extension(&self) -> Option<(u16, &[u8])>
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.
Sourcepub fn payload_offset(&self) -> usize
pub fn payload_offset(&self) -> usize
Returns the offset of the payload in this packet relative to the beginning of the packet.
Sourcepub fn payload_len(&self) -> usize
pub fn payload_len(&self) -> usize
Returns the length of the payload in this packet without padding.
Sourcepub fn as_builder(&'a self) -> RtpPacketBuilder<&'a [u8], &'a [u8]>
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.