pub struct SdpCodec { /* private fields */ }Expand description
A codec derived from an SDP m= section.
Fields are private and read-only from outside the crate: a codec is what the
offer said. Build one with new plus the with_* methods.
Implementations§
Source§impl SdpCodec
impl SdpCodec
Sourcepub fn new(
media: SdpMediaType,
payload_type: u8,
name: impl Into<String>,
clock_rate: u32,
) -> Self
pub fn new( media: SdpMediaType, payload_type: u8, name: impl Into<String>, clock_rate: u32, ) -> Self
Create a codec from the fields an m= line and its rtpmap always supply.
The direction defaults to SdpDirection::SendRecv, which is what a
section carrying no direction attribute means, and has_rtpmap to
false — set it with with_rtpmap when the name
and clock rate came off an a=rtpmap line rather than the RFC 3551
static table.
Sourcepub fn with_channels(self, channels: u32) -> Self
pub fn with_channels(self, channels: u32) -> Self
Set the channel count from a=rtpmap.
Sourcepub fn with_ptime(self, ptime: u32) -> Self
pub fn with_ptime(self, ptime: u32) -> Self
Set the packetization time in milliseconds.
Sourcepub fn with_maxptime(self, maxptime: u32) -> Self
pub fn with_maxptime(self, maxptime: u32) -> Self
Set the maximum packetization time in milliseconds.
Sourcepub fn with_bitrate(self, bitrate: u32) -> Self
pub fn with_bitrate(self, bitrate: u32) -> Self
Set the bitrate in bits per second.
Sourcepub fn with_direction(self, direction: SdpDirection) -> Self
pub fn with_direction(self, direction: SdpDirection) -> Self
Set the media direction of the section this codec came from.
Sourcepub fn with_rtpmap(self) -> Self
pub fn with_rtpmap(self) -> Self
Record that the encoding name and clock rate came from an a=rtpmap line.
Sourcepub fn media(&self) -> &SdpMediaType
pub fn media(&self) -> &SdpMediaType
The SDP media type this codec belongs to.
Sourcepub fn payload_type(&self) -> u8
pub fn payload_type(&self) -> u8
The session-local RTP payload type.
This value is assigned by the offerer for the duration of this session only. It is never emitted into a FreeSWITCH codec string — codec strings identify codecs by name, not by payload type number.
Sourcepub fn clock_rate(&self) -> u32
pub fn clock_rate(&self) -> u32
The RTP clock rate in Hz.
Sourcepub fn channels(&self) -> Option<u32>
pub fn channels(&self) -> Option<u32>
The channel count, or None when not applicable (video) or stream-defined.
Sourcepub fn ptime(&self) -> Option<u32>
pub fn ptime(&self) -> Option<u32>
The packetization time in milliseconds, or None if not specified.
Sourcepub fn maxptime(&self) -> Option<u32>
pub fn maxptime(&self) -> Option<u32>
The offered a=maxptime in milliseconds, or None if not specified.
Retained for offer fidelity: nothing in this crate reads it, and the switch derives no codec-string qualifier from it.
Sourcepub fn direction(&self) -> SdpDirection
pub fn direction(&self) -> SdpDirection
The media direction for this codec’s stream.
Sourcepub fn has_rtpmap(&self) -> bool
pub fn has_rtpmap(&self) -> bool
Whether the encoding name and clock rate came from an a=rtpmap line.
false means they were filled in from the RFC 3551 static table.