#[non_exhaustive]pub struct MediaInfo {
pub channels: Option<u16>,
pub codec: Option<AudioCodec>,
pub container: Option<ContainerFormat>,
pub sample_rate: Option<u32>,
pub variant_index: Option<u32>,
}Expand description
Media format information.
This information can be derived from:
- HLS playlist
CODECSattribute (e.g.,mp4a.40.2) - File extension
- HTTP Content-Type header
- Container metadata
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.channels: Option<u16>Number of audio channels
codec: Option<AudioCodec>Audio codec
container: Option<ContainerFormat>Container format (fMP4, MPEG-TS, etc.)
sample_rate: Option<u32>Sample rate in Hz
variant_index: Option<u32>Variant index (for ABR streams). Different variants have different init segments (ftyp/moov), so decoder must be recreated when variant changes.
Implementations§
Source§impl MediaInfo
impl MediaInfo
Sourcepub fn new(
codec: Option<AudioCodec>,
container: Option<ContainerFormat>,
) -> Self
pub fn new( codec: Option<AudioCodec>, container: Option<ContainerFormat>, ) -> Self
Create MediaInfo with optional codec and container.
Sourcepub fn parse_mime(mime: &str) -> Option<Self>
pub fn parse_mime(mime: &str) -> Option<Self>
Parse codec and container from an HTTP Content-Type value.
Distinct from AudioCodec::parse_mime, which returns the codec
only. Standalone HTTP file sources can lose container information
if the caller drops it on the floor; downstream Apple/Android
dispatch needs both codec and container to pick a backend.
Trait Implementations§
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.