[][src]Crate sdp_types

Crate for handling SDP (RFC 4566) session descriptions, including a parser and serializer.

Serializing an SDP

This example is not tested
// Create SDP session description
let sdp = sdp_types::Session {
    ...
};

// And write it to an `Vec<u8>`
let mut output = Vec::new();
sdp.write(&mut output).unwrap();

Parsing an SDP

// Parse SDP session description from a byte slice
let sdp = sdp_types::Session::parse(&data).unwrap();

// Access the 'tool' attribute
match sdp.get_first_attribute_value("tool") {
    Ok(Some(tool)) => println!("tool: {}", tool),
    Ok(None) => println!("tool: empty"),
    Err(_) => println!("no tool attribute"),
}

Limitations

  • SDP session descriptions are by default in UTF-8 but an optional charset attribute can change this for various SDP fields, including various other attributes. This is currently not supported, only UTF-8 is supported.

  • Network addresses, Phone numbers, E-Mail addresses and various other fields are currently parsed as a plain string and not according to the SDP grammar.

Structs

Attribute

Attributes for the session or media.

AttributeNotFoundError

Error returned when an attribute is not found.

Bandwidth

Bandwidth information for the session or media.

Connection

Connection data for the session or media.

Key

Encryption key for the session or media.

Media

Media description.

Origin

Originator of the session.

Repeat

Repeat times for timing information.

Session

SDP session description.

Time

Timing information of the session.

TimeZone

Time zone information for the session.

Enums

ParserError

Parsing errors that can be returned from Session::parse.