RtpPacketBuilder

Struct RtpPacketBuilder 

Source
pub struct RtpPacketBuilder<P: PayloadLength, E: PayloadLength> { /* private fields */ }
Expand description

Struct for building a new RTP packet.

Implementations§

Source§

impl<P: PayloadLength, E: PayloadLength> RtpPacketBuilder<P, E>

Source

pub fn new() -> RtpPacketBuilder<P, E>

Construct a new packet builder.

Source

pub fn padding(self, padding: u8) -> Self

Set the number of padding bytes to use for this packet.

Source

pub fn maybe_padding(self, padding: Option<u8>) -> Self

Set 1. whether padding is used and 2. the number of padding bytes to use for this packet.

Source

pub fn add_csrc(self, csrc: u32) -> Self

Add a Contribution Source for this packet.

Source

pub fn clear_csrcs(self) -> Self

Clear any CSRCs configured for this packet.

Source

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

👎Deprecated: Use marker_bit() instead

Set the marker bit for this packet.

Source

pub fn marker_bit(self, marker_bit: bool) -> Self

Set the marker bit for this packet.

Source

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

Set the payload type for this packet.

Source

pub fn sequence_number(self, sequence: u16) -> Self

Set the sequence number for this packet.

Source

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

Set the RTP timestamp for this packet.

Source

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

Set the Sequence source for this packet.

Source

pub fn extension(self, extension_id: u16, extension_data: E) -> Self

Set the extension header for this packet.

Source

pub fn clear_extension(self) -> Self

Clear any extension data configured for this packet.

Source

pub fn payload(self, payload: P) -> Self

Add a chunk of payload data for this packet.

Can be called multiple times, in which case the payload data chunks will be concatenated when the final packet is created.

Source

pub fn clear_payloads(self) -> Self

Clear any payloads currently configured.

Source

pub fn calculate_size(&self) -> Result<usize, RtpWriteError>

Calculate the size required for writing the packet.

Source

pub fn write_unchecked<O>( &self, writer: &mut impl RtpPacketWriter<Payload = P, Extension = E, Output = O>, ) -> O

Write this packet using writer without any validity checks.

Source

pub fn write<O>( &self, writer: &mut impl RtpPacketWriter<Payload = P, Extension = E, Output = O>, ) -> Result<O, RtpWriteError>

Write the packet using writer.

Source§

impl<'a, 'b> RtpPacketBuilder<&'a [u8], &'b [u8]>

Source

pub fn write_into_unchecked(&self, buf: &mut [u8]) -> usize

Write this packet into buf without any validity checks. Returns the number of bytes written.

Source

pub fn write_into(&self, buf: &mut [u8]) -> Result<usize, RtpWriteError>

Write this packet into buf. On success returns the number of bytes written or an RtpWriteError on failure.

Source

pub fn write_into_vec_unchecked(&self, buf: &mut Vec<u8>)

Write this packet into buf without any validity checks. The data will be appended to the end of the provide Vec.

Source

pub fn write_into_vec(&self, buf: &mut Vec<u8>) -> Result<(), RtpWriteError>

Write this packet into buf. The data will be appended to the end of the provide Vec.

Source

pub fn write_vec_unchecked(&self) -> Vec<u8>

Write this packet into a newly generated Vec<u8> without any validity checks.

Source

pub fn write_vec(&self) -> Result<Vec<u8>, RtpWriteError>

Write this packet into a newly generated Vec<u8>.

Trait Implementations§

Source§

impl<P: Debug + PayloadLength, E: Debug + PayloadLength> Debug for RtpPacketBuilder<P, E>

Source§

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

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

impl<P: PayloadLength, E: PayloadLength> Default for RtpPacketBuilder<P, E>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<P, E> Freeze for RtpPacketBuilder<P, E>
where E: Freeze, P: Freeze,

§

impl<P, E> RefUnwindSafe for RtpPacketBuilder<P, E>

§

impl<P, E> Send for RtpPacketBuilder<P, E>
where P: Send, E: Send,

§

impl<P, E> Sync for RtpPacketBuilder<P, E>
where E: Sync, P: Sync,

§

impl<P, E> Unpin for RtpPacketBuilder<P, E>
where E: Unpin, P: Unpin,

§

impl<P, E> UnwindSafe for RtpPacketBuilder<P, E>

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