Skip to main content

ez_ffmpeg/core/scheduler/progress/
state.rs

1//! Job-level lifecycle phase reported by a progress snapshot.
2
3/// Coarse lifecycle phase of a scheduled FFmpeg job at the moment a
4/// [`Progress`](super::Progress) snapshot was taken.
5///
6/// The variants are ordered by the normal lifecycle
7/// (`Running` → `Finishing` → `Ended`, with `Paused` reachable from
8/// `Running`), but a snapshot only reports the current phase — it does not
9/// promise that every phase is observable (a short job can go straight from
10/// `Running` to `Ended` between two snapshots).
11#[non_exhaustive]
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
13pub enum ProgressState {
14    /// Workers are processing and at least one input is still producing.
15    Running,
16    /// The job is paused (see `FfmpegScheduler::pause`). Wall-clock time
17    /// keeps accruing in [`Progress::elapsed`](super::Progress::elapsed)
18    /// while paused.
19    Paused,
20    /// The pipeline is winding down: either every input producer (demuxer /
21    /// frame source) has finished producing and the decoders, filters,
22    /// encoders and muxers are flushing their tails, or a stop/abort signal
23    /// has been published and workers are tearing down. Outputs may still be
24    /// finalizing (trailer writes included).
25    Finishing,
26    /// Every tracked worker has torn down. All snapshot values — including
27    /// [`Progress::elapsed`](super::Progress::elapsed) — are frozen from
28    /// this point on, whether the job succeeded, failed, or was aborted
29    /// (this state does not distinguish those outcomes; `wait()`/`stop()`
30    /// report them).
31    Ended,
32}