xmpp-parsers: Convert Jingle RTP to xso
This commit is contained in:
parent
4e2af36186
commit
57c2eeadfc
1 changed files with 74 additions and 64 deletions
|
|
@ -17,38 +17,42 @@ use crate::ns;
|
||||||
#[xml(namespace = ns::JINGLE_RTP, name = "rtcp-mux")]
|
#[xml(namespace = ns::JINGLE_RTP, name = "rtcp-mux")]
|
||||||
pub struct RtcpMux;
|
pub struct RtcpMux;
|
||||||
|
|
||||||
generate_element!(
|
/// Wrapper element describing an RTP session.
|
||||||
/// Wrapper element describing an RTP session.
|
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||||
Description, "description", JINGLE_RTP,
|
#[xml(namespace = ns::JINGLE_RTP, name = "description")]
|
||||||
attributes: [
|
pub struct Description {
|
||||||
/// Namespace of the encryption scheme used.
|
/// Namespace of the encryption scheme used.
|
||||||
media: Required<String> = "media",
|
#[xml(attribute)]
|
||||||
|
pub media: String,
|
||||||
|
|
||||||
/// User-friendly name for the encryption scheme, should be `None` for OTR,
|
/// User-friendly name for the encryption scheme, should be `None` for OTR,
|
||||||
/// legacy OpenPGP and OX.
|
/// legacy OpenPGP and OX.
|
||||||
// XXX: is this a String or an u32?! Refer to RFC 3550.
|
// XXX: is this a String or an u32?! Refer to RFC 3550.
|
||||||
ssrc: Option<String> = "ssrc",
|
#[xml(attribute(default))]
|
||||||
],
|
pub ssrc: Option<String>,
|
||||||
children: [
|
|
||||||
/// List of encodings that can be used for this RTP stream.
|
|
||||||
payload_types: Vec<PayloadType> = ("payload-type", JINGLE_RTP) => PayloadType,
|
|
||||||
|
|
||||||
/// Specifies the ability to multiplex RTP Data and Control Packets on a single port as
|
/// List of encodings that can be used for this RTP stream.
|
||||||
/// described in RFC 5761.
|
#[xml(child(n = ..))]
|
||||||
rtcp_mux: Option<RtcpMux> = ("rtcp-mux", JINGLE_RTP) => RtcpMux,
|
pub payload_types: Vec<PayloadType>,
|
||||||
|
|
||||||
/// List of ssrc-group.
|
/// Specifies the ability to multiplex RTP Data and Control Packets on a single port as
|
||||||
ssrc_groups: Vec<Group> = ("ssrc-group", JINGLE_SSMA) => Group,
|
/// described in RFC 5761.
|
||||||
|
#[xml(child(default))]
|
||||||
|
pub rtcp_mux: Option<RtcpMux>,
|
||||||
|
|
||||||
/// List of ssrc.
|
/// List of ssrc-group.
|
||||||
ssrcs: Vec<Source> = ("source", JINGLE_SSMA) => Source,
|
#[xml(child(n = ..))]
|
||||||
|
pub ssrc_groups: Vec<Group>,
|
||||||
|
|
||||||
/// List of header extensions.
|
/// List of ssrc.
|
||||||
hdrexts: Vec<RtpHdrext> = ("rtp-hdrext", JINGLE_RTP_HDREXT) => RtpHdrext
|
#[xml(child(n = ..))]
|
||||||
|
pub ssrcs: Vec<Source>,
|
||||||
|
|
||||||
// TODO: Add support for <encryption/> and <bandwidth/>.
|
/// List of header extensions.
|
||||||
]
|
#[xml(child(n = ..))]
|
||||||
);
|
pub hdrexts: Vec<RtpHdrext>,
|
||||||
|
// TODO: Add support for <encryption/> and <bandwidth/>.
|
||||||
|
}
|
||||||
|
|
||||||
impl Description {
|
impl Description {
|
||||||
/// Create a new RTP description.
|
/// Create a new RTP description.
|
||||||
|
|
@ -73,38 +77,44 @@ generate_attribute!(
|
||||||
Default = 1
|
Default = 1
|
||||||
);
|
);
|
||||||
|
|
||||||
generate_element!(
|
/// An encoding that can be used for an RTP stream.
|
||||||
/// An encoding that can be used for an RTP stream.
|
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||||
PayloadType, "payload-type", JINGLE_RTP,
|
#[xml(namespace = ns::JINGLE_RTP, name = "payload-type")]
|
||||||
attributes: [
|
pub struct PayloadType {
|
||||||
/// The number of channels.
|
/// The number of channels.
|
||||||
channels: Default<Channels> = "channels",
|
#[xml(attribute(default))]
|
||||||
|
pub channels: Channels,
|
||||||
|
|
||||||
/// The sampling frequency in Hertz.
|
/// The sampling frequency in Hertz.
|
||||||
clockrate: Option<u32> = "clockrate",
|
#[xml(attribute(default))]
|
||||||
|
pub clockrate: Option<u32>,
|
||||||
|
|
||||||
/// The payload identifier.
|
/// The payload identifier.
|
||||||
id: Required<u8> = "id",
|
#[xml(attribute)]
|
||||||
|
pub id: u8,
|
||||||
|
|
||||||
/// Maximum packet time as specified in RFC 4566.
|
/// Maximum packet time as specified in RFC 4566.
|
||||||
maxptime: Option<u32> = "maxptime",
|
#[xml(attribute(default))]
|
||||||
|
pub maxptime: Option<u32>,
|
||||||
|
|
||||||
/// The appropriate subtype of the MIME type.
|
/// The appropriate subtype of the MIME type.
|
||||||
name: Option<String> = "name",
|
#[xml(attribute(default))]
|
||||||
|
pub name: Option<String>,
|
||||||
|
|
||||||
/// Packet time as specified in RFC 4566.
|
/// Packet time as specified in RFC 4566.
|
||||||
ptime: Option<u32> = "ptime",
|
#[xml(attribute(default))]
|
||||||
],
|
pub ptime: Option<u32>,
|
||||||
children: [
|
|
||||||
/// List of parameters specifying this payload-type.
|
|
||||||
///
|
|
||||||
/// Their order MUST be ignored.
|
|
||||||
parameters: Vec<Parameter> = ("parameter", JINGLE_RTP) => Parameter,
|
|
||||||
|
|
||||||
/// List of rtcp-fb parameters from XEP-0293.
|
/// List of parameters specifying this payload-type.
|
||||||
rtcp_fbs: Vec<RtcpFb> = ("rtcp-fb", JINGLE_RTCP_FB) => RtcpFb
|
///
|
||||||
]
|
/// Their order MUST be ignored.
|
||||||
);
|
#[xml(child(n = ..))]
|
||||||
|
pub parameters: Vec<Parameter>,
|
||||||
|
|
||||||
|
/// List of rtcp-fb parameters from XEP-0293.
|
||||||
|
#[xml(child(n = ..))]
|
||||||
|
pub rtcp_fbs: Vec<RtcpFb>,
|
||||||
|
}
|
||||||
|
|
||||||
impl PayloadType {
|
impl PayloadType {
|
||||||
/// Create a new RTP payload-type.
|
/// Create a new RTP payload-type.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue