jingle_rtp: Add constructors.

This commit is contained in:
Emmanuel Gil Peyrot 2019-10-12 17:16:36 +02:00
parent 5338cd6599
commit d654b1bd30

View file

@ -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!( generate_attribute!(
/// The number of channels. /// The number of channels.
Channels, "channels", u8, Default = 1 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!( generate_element!(
/// Parameter related to a payload. /// Parameter related to a payload.
Parameter, "parameter", JINGLE_RTP, Parameter, "parameter", JINGLE_RTP,