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§
Sourcefn probe(&self, input: &Path) -> Result<MediaInfo, EngineError>
fn probe(&self, input: &Path) -> Result<MediaInfo, EngineError>
Read metadata (side effect: run a probe, e.g. ffprobe).
Sourcefn plan(
&self,
info: &MediaInfo,
opts: &ShrinkOpts,
) -> Result<EncodePlan, EngineError>
fn plan( &self, info: &MediaInfo, opts: &ShrinkOpts, ) -> Result<EncodePlan, EngineError>
Build the encode plan. Pure function — tested without encoding.
Sourcefn run(&self, plan: &EncodePlan) -> Result<Outcome, EngineError>
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".