#[non_exhaustive]pub enum StreamInfo {
Video {
id: u32,
codec: CodecKind,
time_base: Rational,
geometry: VideoGeometry,
extra_data: Bytes,
},
Audio {
id: u32,
codec: CodecKind,
time_base: Rational,
extra_data: Bytes,
sample_rate: u32,
channels: u16,
},
}Expand description
Description of a media stream/track.
Video and Audio are separate variants — rather than one shape with
optional fields — so a track can never claim video dimensions it doesn’t
have, or omit dimensions it does: the invariant lives in the type, not in
a convention callers must remember. Audio is also used for subtitle
tracks (WebVtt/Tx3g) — there is no separate Subtitle variant yet;
sample_rate/channels are 0 there (not applicable, not “silence”).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Video
A video track — always carries pixel dimensions.
Fields
geometry: VideoGeometryPixel dimensions.
Audio
A non-video track (audio, or subtitle until a dedicated variant exists) — no geometry.
Implementations§
Source§impl StreamInfo
impl StreamInfo
Sourcepub fn with_id(self, id: u32) -> Self
pub fn with_id(self, id: u32) -> Self
Return a copy with a different track id (e.g. renumbering before mux registration).
Sourcepub const fn extra_data(&self) -> &Bytes
pub const fn extra_data(&self) -> &Bytes
Extra header data (e.g. AVCC / extradata).
Sourcepub const fn geometry(&self) -> Option<VideoGeometry>
pub const fn geometry(&self) -> Option<VideoGeometry>
Pixel dimensions, if this is a video track.
Sourcepub const fn sample_rate(&self) -> Option<u32>
pub const fn sample_rate(&self) -> Option<u32>
Sample rate in Hz, if this is a non-video track. Some(0) means
unknown/not applicable, not “silence” — see Self::Audio.
Sourcepub const fn channels(&self) -> Option<u16>
pub const fn channels(&self) -> Option<u16>
Channel count, if this is a non-video track. Some(0) means
unknown/not applicable — see Self::Audio.
Trait Implementations§
Source§impl Clone for StreamInfo
impl Clone for StreamInfo
Source§fn clone(&self) -> StreamInfo
fn clone(&self) -> StreamInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more