Struct rtp_rs::RtpPacketBuilder[][src]

pub struct RtpPacketBuilder<'a> { /* fields omitted */ }
Expand description

A new packet build which collects the data which should be written as RTP packet

Implementations

impl<'a> RtpPacketBuilder<'a>[src]

pub fn new() -> Self[src]

Create a new RTP packet builder

pub fn payload_type(self, payload_type: u8) -> Self[src]

Set the payload type. The type must be in range of [0; 127], else RtpPacketBuilder::build_info will fail.

pub fn padded(self, pad: Pad) -> Self[src]

Control if and how bytes are appended to the packet if the headers and payload together do not have an appropriate length (for instance if the length of the resulting RTP data must be a multiple of 4 bytes).

The default is Pad::none() - no padding bytes will be added and the padding flag will not be set in the RTP header.

pub fn marked(self, flag: bool) -> Self[src]

Set the marker bit in the RTP header

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

Add a contributing source (csrc). If added more than 15 contributing sources the rest will be discarded.

pub fn set_csrc(self, csrcs: &[u32]) -> Self[src]

Set the contributing sources (csrc). If added more than 15 contributing sources the rest will be discarded.

pub fn sequence(self, seq: Seq) -> Self[src]

Set the sequence number

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

Set the source for this packet

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

Set the timestamp

pub fn extension(self, id: u16, payload: &'a [u8]) -> Self[src]

Add a custom extension payload. The bytes should be aligned to a a four byte boundary, else RtpPacketBuilder::build_info will fail.

pub fn payload(self, payload: &'a [u8]) -> Self[src]

Set the payload of the packet

pub fn target_length(&self) -> usize[src]

Calculate the target length of the packet. This can be used to allocate a buffer for the build_into method.

pub fn build_into_unchecked(&self, target: &mut [u8]) -> usize[src]

Build the packet into the target buffer but ignore all validity checks.

pub fn build_into(
    &self,
    target: &mut [u8]
) -> Result<usize, RtpPacketBuildError>
[src]

Build the RTP packet on the target buffer. The length of the final packet will be returned on success.

pub fn build(&self) -> Result<Vec<u8>, RtpPacketBuildError>[src]

Build the RTP packet. On success it returns a buffer containing the target packet.

Trait Implementations

impl<'a> Clone for RtpPacketBuilder<'a>[src]

fn clone(&self) -> RtpPacketBuilder<'a>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<'a> RefUnwindSafe for RtpPacketBuilder<'a>

impl<'a> Send for RtpPacketBuilder<'a>

impl<'a> Sync for RtpPacketBuilder<'a>

impl<'a> Unpin for RtpPacketBuilder<'a>

impl<'a> UnwindSafe for RtpPacketBuilder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.