Expand description
Recording a camera’s MJPEG stream to disk for the “plain” timelapse. For a
camera that exposes a real /stream, this captures the actual continuous video
instead of time-sampling /snapshot. The copy + reconnect logic is pure (the
stream opener and the sink are injected), so it’s unit-tested without a network:
tests feed canned readers and a Vec sink, and drive the cancel signal.
Structs§
- Record
Stats - Aggregate outcome of a full recording run.
Enums§
- CopyEnd
- How a single-connection copy ended.
Functions§
- copy_
until - Copy from
readertosinkuntil EOF, cancellation, the byte cap, or an error.cancelis checked between reads — a read already in flight finishes first, so this is cooperative (paired with a short read timeout on the real stream). Always returns the bytes written (even on error), so the caller’s cap and totals stay correct across reconnects. Never writes pastcap_remaining. - record_
loop - Record
open’s stream intosink: open → copy → on EOF/error reconnect (afterbackoff) untilcancelfires ormax_bytesis reached.backoff(attempt)is the inter-attempt pause (the real one sleeps; tests pass a no-op). The loop only ends on cancel/cap — a persistently-failing source keeps retrying because the recorder is meant to run for as long as the print is active, and the caller flipscancelwhen the print ends.