Skip to main content

SdpCodec

Struct SdpCodec 

Source
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

Source

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.

Source

pub fn with_channels(self, channels: u32) -> Self

Set the channel count from a=rtpmap.

Source

pub fn with_fmtp(self, fmtp: impl Into<String>) -> Self

Set the format parameters from a=fmtp.

Source

pub fn with_ptime(self, ptime: u32) -> Self

Set the packetization time in milliseconds.

Source

pub fn with_maxptime(self, maxptime: u32) -> Self

Set the maximum packetization time in milliseconds.

Source

pub fn with_bitrate(self, bitrate: u32) -> Self

Set the bitrate in bits per second.

Source

pub fn with_direction(self, direction: SdpDirection) -> Self

Set the media direction of the section this codec came from.

Source

pub fn with_rtpmap(self) -> Self

Record that the encoding name and clock rate came from an a=rtpmap line.

Source

pub fn media(&self) -> &SdpMediaType

The SDP media type this codec belongs to.

Source

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.

Source

pub fn name(&self) -> &str

The codec encoding name (e.g. "opus", "PCMU", "AMR-WB").

Source

pub fn clock_rate(&self) -> u32

The RTP clock rate in Hz.

Source

pub fn channels(&self) -> Option<u32>

The channel count, or None when not applicable (video) or stream-defined.

Source

pub fn fmtp(&self) -> Option<&str>

The format parameters from a=fmtp, if any.

Source

pub fn ptime(&self) -> Option<u32>

The packetization time in milliseconds, or None if not specified.

Source

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.

Source

pub fn bitrate(&self) -> Option<u32>

The bitrate in bits per second, or None if not known.

Source

pub fn direction(&self) -> SdpDirection

The media direction for this codec’s stream.

Source

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.

Trait Implementations§

Source§

impl Clone for SdpCodec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SdpCodec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.