Skip to main content

Engine

Trait Engine 

Source
pub trait Engine {
    // Required methods
    fn supports(&self, input: &Path) -> bool;
    fn probe(&self, input: &Path) -> Result<MediaInfo, EngineError>;
    fn plan(
        &self,
        info: &MediaInfo,
        opts: &ShrinkOpts,
    ) -> Result<EncodePlan, EngineError>;
    fn run(&self, plan: &EncodePlan) -> Result<Outcome, EngineError>;
}
Expand description

The compression engine contract. The one v0.1 implementation is media::MediaEngine.

Required Methods§

Source

fn supports(&self, input: &Path) -> bool

Whether this engine handles the given file.

Source

fn probe(&self, input: &Path) -> Result<MediaInfo, EngineError>

Read metadata (side effect: run a probe, e.g. ffprobe).

Source

fn plan( &self, info: &MediaInfo, opts: &ShrinkOpts, ) -> Result<EncodePlan, EngineError>

Build the encode plan. Pure function — tested without encoding.

Source

fn run(&self, plan: &EncodePlan) -> Result<Outcome, EngineError>

Execute the plan (side effect: run the encoder binary).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§