Skip to content

Decode Worker Control Interface

app.application.interfaces.video.decode_worker_control_interface

View source code

Interface contract for controlling the video decode worker (activate/deactivate).

See Also

Layer: Application. Context: Defines protocol boundaries consumed by application orchestration.

VideoDecodeWorkerControlInterface

Bases: Protocol

Abstraction boundary for the video decode worker's activation controls.

Allows callers (e.g. VideoDecodeWorkerManager) to activate, deactivate, and stop the worker, and to read cached frames — without depending on the concrete VideoDecodeWorker class.

Layer: Application. Context: Coordinates use-case behavior through domain services and application contracts.

get_cached_frame_at_index(idx: int) -> RGBFrame | None

Return the cached frame at idx, or None if not in the buffer.

PARAMETER DESCRIPTION
idx

Zero-based frame index to look up.

TYPE: int

RETURNS DESCRIPTION
RGBFrame | None

Cached RGB frame, or None when the index is not buffered.

set_active(active: bool, resume_idx: int = 0) -> None

Toggle the worker on (True) or off (False).

When activated, the worker seeks to resume_idx and begins buffering frames from that position. When deactivated, the ring buffer is cleared to release memory immediately.

stop() -> None

Shut down the worker thread cleanly.