cue.recorder¶
Streaming recorder — owns one long-lived ocap subprocess for the whole session, no rotation / no chunk eviction.
The ocap subprocess is launched via cue.ocap_launcher, which monkey-
patches the GStreamer pipeline to run our pruner inline. Frames never
leave the subprocess as files; only the pruner's kept keyframe JPEGs
and ocap's MCAP (events only, no MKV) end up on disk. MCAP is small
enough (~1 KB/s compressed) that we let it grow for the session — Cue's
digest thread keeps its reading window bounded, and recorder.stop()
leaves the file behind for the next session to discover or evict manually.
Public API
start(cfg=None) # idempotent, streaming-flag gated by caller stop() # idempotent is_running() -> bool snapshot_context(recent_secs=60, max_events=20) -> dict recent_mcap_paths(recent_secs) # used by digest _iter_tailable_mcap(path, topics) # used by digest too
is_running_snapshot ¶
is_running_snapshot() -> tuple[bool, bool]
Atomic read of (running, pause_requested). Monitor uses this to avoid a TOCTOU between two plain getter calls.
start ¶
start(cfg: dict | None = None) -> None
Spawn a single ocap subprocess that records for the whole session.
stop_for_pause ¶
stop_for_pause(purge_lookback_s: float = 5.0) -> None
Privacy pause: tear down the ocap subprocess and purge anything it
wrote within the last purge_lookback_s seconds — MCAP events, keyframes,
digest rows, digest.md. No-op-safe if ocap was never started.
Caller (PauseController worker thread) is expected to be serialized;
we still guard with _pause_lock so concurrent hotkey + auto-trigger
can't double-teardown.
resume_after_pause ¶
resume_after_pause() -> None
Clear pause flag and spawn a fresh ocap session. Safe to call when ocap was never started (falls through to a normal start). The watchdog will also respawn on its next 5 s tick if we somehow miss here.
snapshot_context ¶
snapshot_context(now: float | None = None, recent_secs: int = 60, max_events: int = 20) -> dict
Return {events, screenshots} for the hotkey path.
eventscomes from tail-reading the live MCAP (current session).screenshots= up to 5 recent keyframe JPGs produced inline by the pruner running in the ocap subprocess.
recent_mcap_paths ¶
recent_mcap_paths(recent_secs: float = 300) -> list[Path]
With a single long-lived session, just return the current MCAP (if any).
recent_secs is accepted for API compatibility but doesn't filter here —
the reader seeks to the window it cares about via log_time.