Crate rtp_rs[][src]

Expand description

Parser and builder for packets formatted per RFC 3550, A Transport Protocol for Real-Time Applications.

Parse a packet

use rtp_rs::*;
// let data = ...acquire UDP packet from the network etc...
if let Ok(rtp) = RtpReader::new(data) {
    println!("Sequence number {:?}", rtp.sequence_number());
    println!("Payload length {:?}", rtp.payload().len());
}

Build a packet

use rtp_rs::*;

let payload = vec![0u8, 2, 5, 4, 6];
let result = RtpPacketBuilder::new()
    .payload_type(111)
    .ssrc(1337)
    .sequence(Seq::from(1234))
    .timestamp(666657)
    .padded(Pad::round_to(4))
    .marked(true)
    .payload(&payload)
    .build();
if let Ok(packet) = result {
    println!("Packet: {:?}", packet);
}

Structs

Pad

Controls if and how an RTP packet should have padding appended after the payload

RtpPacketBuilder

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

RtpReader

Wrapper around a byte-slice of RTP data, providing accessor methods for the RTP header fields.

Seq

16 bit RTP sequence number value, as obtained from the sequence_number() method of RtpReader.

SeqIter

An Iterator which can produce values from the given start value to the given end value, inclusive.

Enums

RtpPacketBuildError

Reasons why RtpPacketBuilder::build_info fails

RtpReaderError

Reasons for RtpHeader::new() to fail

Traits

IntoSeqIterator

Trait for types that can produce a SeqIter, with an implementation provided for Range<Seq>.