pub struct TimelapseManager { /* private fields */ }Expand description
Owns up to two concurrent captures of the same print — a smooth one
(per-layer, synced to the printer’s park) and a plain one (sampled on a
wall-time interval, head in shot). Each is started/stopped independently.
Lives in AppState.
Implementations§
Source§impl TimelapseManager
impl TimelapseManager
Sourcepub fn start_smooth(
&self,
cameras: Vec<(String, FrameGrab)>,
every: u64,
burst_offsets: Vec<u64>,
rx: Receiver<PrinterStatus>,
out_dir: PathBuf,
) -> Result<(), String>
pub fn start_smooth( &self, cameras: Vec<(String, FrameGrab)>, every: u64, burst_offsets: Vec<u64>, rx: Receiver<PrinterStatus>, out_dir: PathBuf, ) -> Result<(), String>
Start the smooth (per-layer) capture: one frame per every-th layer from
each camera, written to out_dir/<camera-id>/.
Sourcepub fn start_smooth_with_select(
&self,
cameras: Vec<(String, FrameGrab)>,
every: u64,
burst_offsets: Vec<u64>,
rx: Receiver<PrinterStatus>,
out_dir: PathBuf,
selects: Vec<Option<SelectTuning>>,
) -> Result<(), String>
pub fn start_smooth_with_select( &self, cameras: Vec<(String, FrameGrab)>, every: u64, burst_offsets: Vec<u64>, rx: Receiver<PrinterStatus>, out_dir: PathBuf, selects: Vec<Option<SelectTuning>>, ) -> Result<(), String>
Like start_smooth, plus per-camera burst-SELECTION tuning
(index-aligned with cameras; None/missing = no live selection). When a camera has
select tuning, after each layer’s burst settles the run picks the parked frame and
publishes it as park_*.jpg/parks.jsonl in that camera’s dir — so the live park
preview shows the clean timelapse DURING a smooth capture, and the finished run reads
back as a clean park recording.
Sourcepub fn start_plain(
&self,
cameras: Vec<PlainCapture>,
interval_ms: u64,
rx: Receiver<PrinterStatus>,
out_dir: PathBuf,
) -> Result<(), String>
pub fn start_plain( &self, cameras: Vec<PlainCapture>, interval_ms: u64, rx: Receiver<PrinterStatus>, out_dir: PathBuf, ) -> Result<(), String>
Start the plain (time-sampled) capture: one frame from each camera every
interval_ms, while the print is active.
Sourcepub fn start_park(
&self,
cameras: Vec<ParkCapture>,
rx: Receiver<PrinterStatus>,
out_dir: PathBuf,
spawn_worker: ParkSpawn,
) -> Result<(), String>
pub fn start_park( &self, cameras: Vec<ParkCapture>, rx: Receiver<PrinterStatus>, out_dir: PathBuf, spawn_worker: ParkSpawn, ) -> Result<(), String>
Start the live park-preview capture: for each tuned stream camera, lazily spawn
one ffmpeg supervisor (via spawn_worker) once the print is active; each emits
latest_park.jpg per layer under out_dir/<camera-id>/. spawn_worker is
injected so the lifecycle is testable without ffmpeg (real_park_spawn runs the
real one). Rejected if a park run is already active or cameras is empty.
Sourcepub fn start_segment(
&self,
cameras: Vec<SegmentCapture>,
rx: Receiver<PrinterStatus>,
out_dir: PathBuf,
spawn_worker: SegmentSpawn,
) -> Result<(), String>
pub fn start_segment( &self, cameras: Vec<SegmentCapture>, rx: Receiver<PrinterStatus>, out_dir: PathBuf, spawn_worker: SegmentSpawn, ) -> Result<(), String>
Start the dense-stream segmented capture: for each capable stream camera, lazily
spawn one ffmpeg supervisor (via spawn_worker) once the print is active. The
lifecycle maintains the live print layer (from MQTT layer_num) and feeds it to the
workers, which segment the stream per layer and publish the picked frame as
latest_park.jpg/park_NNNNNN.jpg (read by /api/camera/{id}/park, exactly like
park). spawn_worker is injected for testing; real_segment_spawn runs ffmpeg.
Rejected if a segment run is already active or cameras is empty.
Sourcepub fn stop_smooth(&self) -> bool
pub fn stop_smooth(&self) -> bool
Stop the smooth capture (idempotent). Returns whether one was running.
Sourcepub fn stop_plain(&self) -> bool
pub fn stop_plain(&self) -> bool
Stop the plain capture (idempotent). Returns whether one was running.
Sourcepub fn stop_park(&self) -> bool
pub fn stop_park(&self) -> bool
Stop the live park-preview capture (idempotent). Returns whether one was running.
Sourcepub fn stop_segment(&self) -> bool
pub fn stop_segment(&self) -> bool
Stop the dense-stream segmented capture (idempotent). Returns whether one was running.