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
impl CodecImplementation
Sourcepub fn new(name: impl Into<String>) -> Self
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.
Sourcepub fn with_media_type(self, media_type: SdpMediaType) -> Self
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).
Sourcepub fn with_modname(self, modname: impl Into<String>) -> Self
pub fn with_modname(self, modname: impl Into<String>) -> Self
Set the module name (switch_codec_implementation_t::modname).
Sourcepub fn with_rate(self, rate: u32) -> Self
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).
Sourcepub fn with_ptime(self, ptime: u32) -> Self
pub fn with_ptime(self, ptime: u32) -> Self
Set the packetization interval in milliseconds (microseconds_per_packet / 1000).
Sourcepub fn with_bitrate(self, bitrate: u32) -> Self
pub fn with_bitrate(self, bitrate: u32) -> Self
Set the bitrate in bits/s (bits_per_second).
Sourcepub fn with_channels(self, channels: u32) -> Self
pub fn with_channels(self, channels: u32) -> Self
Set the channel count (number_of_channels).
Sourcepub fn media_type(&self) -> Option<&SdpMediaType>
pub fn media_type(&self) -> Option<&SdpMediaType>
The media type, if known.
Trait Implementations§
Source§impl Clone for CodecImplementation
impl Clone for CodecImplementation
Source§fn clone(&self) -> CodecImplementation
fn clone(&self) -> CodecImplementation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodecImplementation
impl Debug for CodecImplementation
impl Eq for CodecImplementation
Source§impl PartialEq for CodecImplementation
impl PartialEq for CodecImplementation
impl StructuralPartialEq for CodecImplementation
Auto Trait Implementations§
impl Freeze for CodecImplementation
impl RefUnwindSafe for CodecImplementation
impl Send for CodecImplementation
impl Sync for CodecImplementation
impl Unpin for CodecImplementation
impl UnsafeUnpin for CodecImplementation
impl UnwindSafe for CodecImplementation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.