Skip to main content

CodecImplementation

Struct CodecImplementation 

Source
pub struct CodecImplementation { /* private fields */ }
Expand description

One loaded codec implementation, mirroring switch_codec_implementation_t.

Every qualifier is Option; None means “unknown, do not constrain” rather than “codec has no such value”. A caller who only knows codec names (not the loaded implementation table) can construct one of these per name with all qualifiers None — this still catches an entry naming a codec that is not loaded at all (the module-lookup failure), it just cannot catch a qualifier mismatch against an implementation that is loaded (the second, ptime/rate-specific failure).

Implementations§

Source§

impl CodecImplementation

Source

pub fn new(name: impl Into<String>) -> Self

Create a new implementation descriptor with only the codec name known.

None media type means “unknown, treat as audio” — the qualifier checks apply. Set it with with_media_type for a video codec, whose implementations bypass every qualifier check in FreeSWITCH.

Source

pub fn with_media_type(self, media_type: SdpMediaType) -> Self

Set the media type (switch_codec_implementation_t::codec_type).

A SdpMediaType::Video implementation matches on name (and modname) alone — switch_loadable_module_get_codecs_sorted wraps every qualifier comparison in if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) (switch_loadable_module.c:2855, 2886).

Source

pub fn with_modname(self, modname: impl Into<String>) -> Self

Set the module name (switch_codec_implementation_t::modname).

Source

pub fn with_rate(self, rate: u32) -> Self

Set the clock rate this implementation matches against (actual_samples_per_second, or samples_per_second for G.722’s RFC 3551 quirk).

Source

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

Set the packetization interval in milliseconds (microseconds_per_packet / 1000).

Source

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

Set the bitrate in bits/s (bits_per_second).

Source

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

Set the channel count (number_of_channels).

Source

pub fn name(&self) -> &str

The codec name (iananame).

Source

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

The module name, if known.

Source

pub fn media_type(&self) -> Option<&SdpMediaType>

The media type, if known.

Source

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

The clock rate, if known.

Source

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

The packetization interval in milliseconds, if known.

Source

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

The bitrate in bits/s, if known.

Source

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

The channel count, if known.

Trait Implementations§

Source§

impl Clone for CodecImplementation

Source§

fn clone(&self) -> CodecImplementation

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 CodecImplementation

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for CodecImplementation

Source§

impl PartialEq for CodecImplementation

Source§

fn eq(&self, other: &CodecImplementation) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CodecImplementation

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.