pub struct Analyzer<P: AsRef<Path>> { /* private fields */ }Expand description
Analyzes one or more videos and converts them into FrameHashes.
If threaded_decoding is set to true, video files will be distributed across multiple threads
based on the number of CPUs available. If force is set, any existing frame hash data on disk
will be ignored.
At a high-level, the analyzer does the following for a given video:
- Extracts the most suitable audio stream
- Decodes the audio frame-by-frame and resamples it for fingerprinting
- Builds a fingerprint (or hash) based on the provided
hash_duration - Returns a FrameHashes instance that contains the raw data and (optionally) writes it to disk alongside the video
§Example
use std::path::PathBuf;
use needle::audio::Analyzer;
let video_paths: Vec<PathBuf> = get_sample_paths();
let analyzer = Analyzer::from_files(video_paths, false, false);
let frame_hashes = analyzer.run(1.0, 3.0, false).unwrap();Implementations§
Source§impl<P: AsRef<Path>> Analyzer<P>
impl<P: AsRef<Path>> Analyzer<P>
Sourcepub fn from_files(
videos: impl Into<Vec<P>>,
threaded_decoding: bool,
force: bool,
) -> Self
pub fn from_files( videos: impl Into<Vec<P>>, threaded_decoding: bool, force: bool, ) -> Self
Constructs a new Analyzer from a list of video paths.
Sourcepub fn with_force(self, force: bool) -> Self
pub fn with_force(self, force: bool) -> Self
Returns a new Analyzer with force set to the provided value.
Sourcepub fn with_threaded_decoding(self, threaded_decoding: bool) -> Self
pub fn with_threaded_decoding(self, threaded_decoding: bool) -> Self
Returns a new Analyzer with thread_decoding set to the provided value.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Analyzer<P>
impl<P> RefUnwindSafe for Analyzer<P>where
P: RefUnwindSafe,
impl<P> Send for Analyzer<P>where
P: Send,
impl<P> Sync for Analyzer<P>where
P: Sync,
impl<P> Unpin for Analyzer<P>where
P: Unpin,
impl<P> UnwindSafe for Analyzer<P>where
P: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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