From d654b1bd309d90d3aece15977e21666ab6235a52 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 12 Oct 2019 17:16:36 +0200 Subject: [PATCH] jingle_rtp: Add constructors. --- src/jingle_rtp.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/jingle_rtp.rs b/src/jingle_rtp.rs index 5e686ca9..7e5557b2 100644 --- a/src/jingle_rtp.rs +++ b/src/jingle_rtp.rs @@ -24,6 +24,17 @@ generate_element!( ] ); +impl Description { + /// Create a new RTP description. + pub fn new(media: String) -> Description { + Description { + media, + ssrc: None, + payload_types: Vec::new(), + } + } +} + generate_attribute!( /// The number of channels. Channels, "channels", u8, Default = 1 @@ -59,6 +70,21 @@ generate_element!( ] ); +impl PayloadType { + /// Create a new RTP payload-type. + pub fn new(id: u8, name: String) -> PayloadType { + PayloadType { + channels: Default::default(), + clockrate: None, + id, + maxptime: None, + name: Some(name), + ptime: None, + parameters: Vec::new(), + } + } +} + generate_element!( /// Parameter related to a payload. Parameter, "parameter", JINGLE_RTP,