Skip to main content

StreamInfo

Enum StreamInfo 

Source
#[non_exhaustive]
pub enum StreamInfo {
#[non_exhaustive]
Video {
Show 18 fields index: i32, time_base: AVRational, start_time: i64, duration: i64, nb_frames: i64, r_frame_rate: AVRational, sample_aspect_ratio: AVRational, metadata: HashMap<String, String>, avg_frame_rate: AVRational, codec_id: AVCodecID, codec_name: String, width: i32, height: i32, bit_rate: i64, pixel_format: i32, video_delay: i32, fps: f64, rotate: i32,
},
#[non_exhaustive]
Audio {
Show 14 fields index: i32, time_base: AVRational, start_time: i64, duration: i64, nb_frames: i64, metadata: HashMap<String, String>, avg_frame_rate: AVRational, codec_id: AVCodecID, codec_name: String, sample_rate: i32, nb_channels: i32, bit_rate: i64, sample_format: i32, frame_size: i32,
},
#[non_exhaustive]
Subtitle { index: i32, time_base: AVRational, start_time: i64, duration: i64, nb_frames: i64, metadata: HashMap<String, String>, codec_id: AVCodecID, codec_name: String, },
#[non_exhaustive]
Data { index: i32, time_base: AVRational, start_time: i64, duration: i64, metadata: HashMap<String, String>, },
#[non_exhaustive]
Attachment { index: i32, metadata: HashMap<String, String>, codec_id: AVCodecID, codec_name: String, },
#[non_exhaustive]
Unknown { index: i32, metadata: HashMap<String, String>, }, }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

#[non_exhaustive]
Video

Video stream information

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the stream within the media file.

§time_base: AVRational

The time base for the stream, representing the unit of time for each frame or packet.

§start_time: i64

The start time of the stream, in time_base units.

§duration: i64

The total duration of the stream, in time_base units.

§nb_frames: i64

The total number of frames in the video stream.

§r_frame_rate: AVRational

The raw frame rate (frames per second) of the video stream, represented as a rational number.

§sample_aspect_ratio: AVRational

The sample aspect ratio of the video frames, which represents the shape of individual pixels.

§metadata: HashMap<String, String>

Metadata associated with the video stream, such as title, language, etc.

§avg_frame_rate: AVRational

The average frame rate of the stream, potentially accounting for variable frame rates.

§codec_id: AVCodecID

The codec identifier (e.g., AV_CODEC_ID_H264) used to decode the video stream.

§codec_name: String

A human-readable name of the codec used for the video stream.

§width: i32

The width of the video frame in pixels.

§height: i32

The height of the video frame in pixels.

§bit_rate: i64

The bitrate of the video stream, measured in bits per second (bps).

§pixel_format: i32

The pixel format of the video stream (e.g., AV_PIX_FMT_YUV420P).

§video_delay: i32

Delay introduced by the video codec, measured in frames.

§fps: f64

The frames per second (FPS) of the video stream, represented as a floating point number. It is calculated from the avg_framerate field (avg_framerate.num / avg_framerate.den).

§rotate: i32

The rotation of the video stream in degrees. This value is retrieved from the metadata. Common values are 0, 90, 180, and 270.

§

#[non_exhaustive]
Audio

Audio stream information

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the audio stream within the media file.

§time_base: AVRational

The time base for the stream, representing the unit of time for each audio packet.

§start_time: i64

The start time of the audio stream, in time_base units.

§duration: i64

The total duration of the audio stream, in time_base units.

§nb_frames: i64

The total number of frames in the audio stream.

§metadata: HashMap<String, String>

Metadata associated with the audio stream, such as language, title, etc.

§avg_frame_rate: AVRational

The average frame rate of the audio stream, which might not always be applicable for audio streams.

§codec_id: AVCodecID

The codec identifier used to decode the audio stream (e.g., AV_CODEC_ID_AAC).

§codec_name: String

A human-readable name of the codec used for the audio stream.

§sample_rate: i32

The audio sample rate, measured in samples per second (Hz).

§nb_channels: i32

Number of channels in this layout.

§bit_rate: i64

The bitrate of the audio stream, measured in bits per second (bps).

§sample_format: i32

The format of the audio samples (e.g., AV_SAMPLE_FMT_FLTP for planar float samples).

§frame_size: i32

The size of each audio frame, typically representing the number of samples per channel in one frame.

§

#[non_exhaustive]
Subtitle

Subtitle stream information

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the subtitle stream within the media file.

§time_base: AVRational

The time base for the stream, representing the unit of time for each subtitle event.

§start_time: i64

The start time of the subtitle stream, in time_base units.

§duration: i64

The total duration of the subtitle stream, in time_base units.

§nb_frames: i64

The total number of subtitle events in the stream.

§metadata: HashMap<String, String>

Metadata associated with the subtitle stream, such as language.

§codec_id: AVCodecID

The codec identifier used to decode the subtitle stream (e.g., AV_CODEC_ID_ASS).

§codec_name: String

A human-readable name of the codec used for the subtitle stream.

§

#[non_exhaustive]
Data

Data stream information

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the data stream within the media file.

§time_base: AVRational

The time base for the data stream, representing the unit of time for each data packet.

§start_time: i64

The start time of the data stream, in time_base units.

§duration: i64

The total duration of the data stream, in time_base units.

§metadata: HashMap<String, String>

Metadata associated with the data stream, such as additional information about the stream content.

§

#[non_exhaustive]
Attachment

Attachment stream information

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the attachment stream within the media file.

§metadata: HashMap<String, String>

Metadata associated with the attachment stream, such as details about the attached file.

§codec_id: AVCodecID

The codec identifier used to decode the attachment stream (e.g., AV_CODEC_ID_PNG for images).

§codec_name: String

A human-readable name of the codec used for the attachment stream.

§

#[non_exhaustive]
Unknown

Unknown or unrecognized stream type.

Returned when the codec type does not match any known media type (video, audio, subtitle, data, attachment) or when codecpar is null.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§index: i32

The index of the unknown stream within the media file.

§metadata: HashMap<String, String>

Metadata associated with the unknown stream.

Implementations§

Source§

impl StreamInfo

Source

pub fn stream_type(&self) -> &'static str

Returns a human-readable label for this stream’s type (e.g. "Video", "Audio", "Unknown").

Source

pub fn is_video(&self) -> bool

Returns true if this is a video stream.

Source

pub fn is_audio(&self) -> bool

Returns true if this is an audio stream.

Source

pub fn index(&self) -> i32

Returns the stream index within the media file.

Trait Implementations§

Source§

impl Clone for StreamInfo

Source§

fn clone(&self) -> StreamInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,