pub struct StreamInfo {
pub index: u32,
pub stream_type: StreamType,
pub codec_id: String,
pub bitrate_bps: u64,
pub duration_ms_val: u64,
pub rate_num: u32,
pub rate_den: u32,
pub width: u32,
pub height: u32,
pub channels: u32,
}Expand description
Information record for a single elementary stream.
Fields§
§index: u32Zero-based stream index within the container.
stream_type: StreamTypeStream type.
codec_id: StringCodec identifier string (e.g. "h264", "aac").
bitrate_bps: u64Bitrate in bits per second (0 if unknown).
duration_ms_val: u64Duration in milliseconds (0 if unknown).
rate_num: u32Sample rate (audio) or frame rate numerator (video); 0 if unused.
rate_den: u32Frame rate denominator (video only); 0 if unused.
width: u32Width in pixels (video only); 0 if unused.
height: u32Height in pixels (video only); 0 if unused.
channels: u32Channel count (audio only); 0 if unused.
Implementations§
Source§impl StreamInfo
impl StreamInfo
Sourcepub fn new(
index: u32,
stream_type: StreamType,
codec_id: impl Into<String>,
) -> Self
pub fn new( index: u32, stream_type: StreamType, codec_id: impl Into<String>, ) -> Self
Create a minimal stream descriptor.
Sourcepub fn duration_ms(&self) -> u64
pub fn duration_ms(&self) -> u64
Returns the duration in milliseconds.
Sourcepub fn frame_rate(&self) -> f64
pub fn frame_rate(&self) -> f64
Returns the frame rate as a float (for video streams).
Sourcepub fn with_bitrate(self, bps: u64) -> Self
pub fn with_bitrate(self, bps: u64) -> Self
Builder: set bitrate.
Sourcepub fn with_duration_ms(self, ms: u64) -> Self
pub fn with_duration_ms(self, ms: u64) -> Self
Builder: set duration.
Sourcepub fn with_video_dims(self, width: u32, height: u32) -> Self
pub fn with_video_dims(self, width: u32, height: u32) -> Self
Builder: set video dimensions.
Sourcepub fn with_frame_rate(self, num: u32, den: u32) -> Self
pub fn with_frame_rate(self, num: u32, den: u32) -> Self
Builder: set frame rate (numerator / denominator).
Sourcepub fn with_audio(self, sample_rate: u32, channels: u32) -> Self
pub fn with_audio(self, sample_rate: u32, channels: u32) -> Self
Builder: set audio properties.
Trait Implementations§
Source§impl Clone for StreamInfo
impl Clone for StreamInfo
Source§fn clone(&self) -> StreamInfo
fn clone(&self) -> StreamInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StreamInfo
impl RefUnwindSafe for StreamInfo
impl Send for StreamInfo
impl Sync for StreamInfo
impl Unpin for StreamInfo
impl UnsafeUnpin for StreamInfo
impl UnwindSafe for StreamInfo
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more