pub struct FormatInfo {
pub path: String,
pub container: String,
pub video_codec: Option<String>,
pub audio_codec: Option<String>,
pub duration_secs: Option<f64>,
pub width: Option<u32>,
pub height: Option<u32>,
pub sample_rate: Option<u32>,
pub audio_channels: Option<u32>,
pub phash: Option<u64>,
pub audio_fingerprint: Option<Vec<u8>>,
}Expand description
Normalised, format-agnostic content descriptor.
Fields§
§path: StringFile path.
container: StringContainer format label (e.g. “mp4”, “mkv”, “webm”, “flac”).
video_codec: Option<String>Video codec label (e.g. “av1”, “vp9”), if present.
audio_codec: Option<String>Audio codec label (e.g. “opus”, “vorbis”, “flac”), if present.
duration_secs: Option<f64>Duration in seconds.
width: Option<u32>Video width in pixels.
height: Option<u32>Video height in pixels.
sample_rate: Option<u32>Audio sample rate in Hz.
audio_channels: Option<u32>Number of audio channels.
phash: Option<u64>64-bit perceptual hash of a representative frame (if available).
audio_fingerprint: Option<Vec<u8>>Audio fingerprint bytes (if available).
Implementations§
Source§impl FormatInfo
impl FormatInfo
Sourcepub fn new(path: impl Into<String>, container: impl Into<String>) -> Self
pub fn new(path: impl Into<String>, container: impl Into<String>) -> Self
Create a minimal FormatInfo with only path and container.
Sourcepub fn with_duration(self, secs: f64) -> Self
pub fn with_duration(self, secs: f64) -> Self
Builder: set duration.
Sourcepub fn with_resolution(self, w: u32, h: u32) -> Self
pub fn with_resolution(self, w: u32, h: u32) -> Self
Builder: set video dimensions.
Sourcepub fn with_codecs(self, video: Option<String>, audio: Option<String>) -> Self
pub fn with_codecs(self, video: Option<String>, audio: Option<String>) -> Self
Builder: set codecs.
Sourcepub fn with_phash(self, hash: u64) -> Self
pub fn with_phash(self, hash: u64) -> Self
Builder: set perceptual hash.
Sourcepub fn with_audio_fingerprint(self, fp: Vec<u8>) -> Self
pub fn with_audio_fingerprint(self, fp: Vec<u8>) -> Self
Builder: set audio fingerprint.
Sourcepub fn with_audio_info(self, sample_rate: u32, channels: u32) -> Self
pub fn with_audio_info(self, sample_rate: u32, channels: u32) -> Self
Builder: set audio info.
Sourcepub fn is_different_format(&self, other: &Self) -> bool
pub fn is_different_format(&self, other: &Self) -> bool
Returns true if the containers differ from other.
Trait Implementations§
Source§impl Clone for FormatInfo
impl Clone for FormatInfo
Source§fn clone(&self) -> FormatInfo
fn clone(&self) -> FormatInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FormatInfo
impl RefUnwindSafe for FormatInfo
impl Send for FormatInfo
impl Sync for FormatInfo
impl Unpin for FormatInfo
impl UnsafeUnpin for FormatInfo
impl UnwindSafe for FormatInfo
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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