pub struct MediaEngine { /* private fields */ }Expand description
The ffmpeg engine for video and audio.
Implementations§
Source§impl MediaEngine
impl MediaEngine
pub fn new() -> Self
Sourcepub fn with_cancel(cancel: CancelToken) -> Self
pub fn with_cancel(cancel: CancelToken) -> Self
An engine whose run / estimate stop when cancel is set: the running
ffmpeg is killed, the partial output removed, and the call returns an
error for which EngineError::is_cancelled is true.
Sourcepub fn run_with_progress(
&self,
plan: &EncodePlan,
on_progress: &mut dyn FnMut(PassKind, f64),
) -> Result<Outcome, EngineError>
pub fn run_with_progress( &self, plan: &EncodePlan, on_progress: &mut dyn FnMut(PassKind, f64), ) -> Result<Outcome, EngineError>
Like Engine::run but reports progress: on_progress(pass, fraction)
is called with fraction in 0.0..=1.0 as each pass proceeds.
Sourcepub fn estimate(&self, plan: &EncodePlan) -> Result<Option<u64>, EngineError>
pub fn estimate(&self, plan: &EncodePlan) -> Result<Option<u64>, EngineError>
The expected output size of plan, without running it — the honest
preview for a UI. Size targets and audio come straight from the plan
(pure); a quality-mode (CRF) video is predicted from short sample
encodes, like the “never bigger” guard does (~2–3 s for any length).
Compare the result with the source: at or above it, a guarded run keeps
the original (Outcome::already_compact). None if it can’t be told.