pub enum AudioCodec {
AacLc,
AacHe,
AacHeV2,
Mp3,
Flac,
Vorbis,
Opus,
Alac,
Pcm,
Adpcm,
}Expand description
Audio codec type.
Variants§
AacLc
AAC Low Complexity (mp4a.40.2)
AacHe
AAC High Efficiency (mp4a.40.5)
AacHeV2
AAC HE v2 (mp4a.40.29)
Mp3
MP3 (mp4a.40.34 or audio/mpeg)
Flac
FLAC
Vorbis
Vorbis
Opus
Opus
Alac
ALAC (Apple Lossless)
Pcm
PCM
Adpcm
ADPCM
Implementations§
Source§impl AudioCodec
impl AudioCodec
Sourcepub fn encoder_priming_frames(codec: Self) -> u64
pub fn encoder_priming_frames(codec: Self) -> u64
Encoder-side priming silence in PCM frames added by mainstream
encoders for codec when no container or encoder tag declares
an explicit count. Used as a fallback by the gapless pipeline
when probing yields no metadata.
Does not include any decoder-side algorithmic delay — that
is per-backend (LAME-convention mpa decoders add 529 for MP3,
Apple’s AudioConverter internally compensates and adds 0) and
lives on the FrameCodec trait in kithara-decode.
Free-standing (AudioCodec::encoder_priming_frames(codec))
rather than codec.encoder_priming_frames() so that the
match codec { ... } body does not pretend to be a
From<AudioCodec> conversion — u64 here means “priming
frames”, not the codec rewritten as an integer.
Sourcepub fn parse_hls_codec(codec: &str) -> Option<Self>
pub fn parse_hls_codec(codec: &str) -> Option<Self>
Parse from HLS CODECS attribute value.
Examples:
mp4a.40.2->AacLcmp4a.40.5->AacHemp4a.40.29->AacHeV2mp4a.40.34->Mp3mp4a.69ormp4a.6B->Mp3
Sourcepub fn parse_mime(mime: &str) -> Option<Self>
pub fn parse_mime(mime: &str) -> Option<Self>
Parse codec from HTTP Content-Type header value.
Examples:
audio/mpeg->Mp3audio/aac->AacLcaudio/flac->Flac
Trait Implementations§
Source§impl Clone for AudioCodec
impl Clone for AudioCodec
Source§fn clone(&self) -> AudioCodec
fn clone(&self) -> AudioCodec
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 AudioCodec
impl Debug for AudioCodec
Source§impl From<AudioCodec> for MediaInfo
Build MediaInfo from a codec alone, filling the container when it is
implied by the codec for standalone (non-HLS) sources. AAC and Adpcm
have ambiguous containers and leave container = None.
impl From<AudioCodec> for MediaInfo
Build MediaInfo from a codec alone, filling the container when it is
implied by the codec for standalone (non-HLS) sources. AAC and Adpcm
have ambiguous containers and leave container = None.
Source§fn from(codec: AudioCodec) -> Self
fn from(codec: AudioCodec) -> Self
Source§impl PartialEq for AudioCodec
impl PartialEq for AudioCodec
Source§fn eq(&self, other: &AudioCodec) -> bool
fn eq(&self, other: &AudioCodec) -> bool
self and other values to be equal, and is used by ==.Source§impl TryFrom<&[u8]> for AudioCodec
impl TryFrom<&[u8]> for AudioCodec
Source§impl TryFrom<AudioCodec> for ContainerFormat
The codec uniquely picks a container for standalone sources.
Mp3→MpegAudio, Pcm→Wav, Flac→Flac, Vorbis/Opus→Ogg, Alac→Caf.
AAC (ADTS vs Mp4) and Adpcm are ambiguous and fail.
impl TryFrom<AudioCodec> for ContainerFormat
The codec uniquely picks a container for standalone sources. Mp3→MpegAudio, Pcm→Wav, Flac→Flac, Vorbis/Opus→Ogg, Alac→Caf. AAC (ADTS vs Mp4) and Adpcm are ambiguous and fail.