pub struct ThumbnailPipeline { /* private fields */ }Expand description
Implementations§
Source§impl ThumbnailPipeline
impl ThumbnailPipeline
Sourcepub fn new(path: &str) -> ThumbnailPipeline
pub fn new(path: &str) -> ThumbnailPipeline
Creates a new pipeline for the given file path.
Sourcepub fn timestamps(self, times: Vec<f64>) -> ThumbnailPipeline
pub fn timestamps(self, times: Vec<f64>) -> ThumbnailPipeline
Sets the timestamps (in seconds) at which to extract frames.
Sourcepub fn output_dir(self, dir: impl AsRef<Path>) -> ThumbnailPipeline
pub fn output_dir(self, dir: impl AsRef<Path>) -> ThumbnailPipeline
Set output directory for run_to_files().
Sourcepub fn width(self, w: u32) -> ThumbnailPipeline
pub fn width(self, w: u32) -> ThumbnailPipeline
Limit thumbnail width; height is scaled proportionally.
Only used by run_to_files().
Sourcepub fn quality(self, q: u32) -> ThumbnailPipeline
pub fn quality(self, q: u32) -> ThumbnailPipeline
JPEG quality 0–100.
Only used by run_to_files().
Sourcepub fn run(self) -> Result<Vec<VideoFrame>, PipelineError>
pub fn run(self) -> Result<Vec<VideoFrame>, PipelineError>
Runs the pipeline and returns one VideoFrame per requested timestamp.
Timestamps are processed in ascending order. If timestamps is empty,
the file is never opened and Ok(vec![]) is returned immediately.
When the parallel feature is enabled, each timestamp is decoded in its
own thread via rayon. Each thread opens an independent VideoDecoder;
no decoder context is shared. The output order matches the ascending
timestamp order regardless of which thread finishes first.
§Errors
Propagates PipelineError::Decode for any decoding or seek failure.
Sourcepub fn run_to_files(self) -> Result<Vec<PathBuf>, PipelineError>
pub fn run_to_files(self) -> Result<Vec<PathBuf>, PipelineError>
Runs the pipeline, writes each frame as a JPEG to output_dir,
and returns the written paths in timestamp order.
File names: thumb_0000.jpg, thumb_0001.jpg, … (zero-padded index).
When .width() is set, height is scaled proportionally.
§Errors
PipelineError::NoOutput—output_dirnot configuredPipelineError::Io— directory creation failedPipelineError::Decode— seek/decode failedPipelineError::Encode— image write failed