Video Decode Worker Control Adapter
app.infrastructure.adapters.video_decode_worker_control_adapterExplicit adapter wrapping VideoDecodeWorker to VideoDecodeWorkerControlInterface.
See Also
VideoDecodeWorkerControlInterface— defines the lifecycle contractVideoDecodeWorker— concrete worker being adapted
Layer: Infrastructure. Context: Implements concrete processing and I/O behind application-facing contracts.
VideoDecodeWorkerControlAdapter
Bases: VideoDecodeWorkerControlInterface
Explicit adapter that wraps a concrete VideoDecodeWorker instance and
exposes the VideoDecodeWorkerControlInterface contract.
In normal usage the concrete VideoDecodeWorker already satisfies
VideoDecodeWorkerControlInterface via structural subtyping (Protocol),
so this adapter is not required for runtime correctness. It exists to:
- Provide an explicit, named boundary at the infrastructure/application seam.
- Enable test doubles that replace the real worker without subclassing
VideoDecodeWorker.
Only the control-surface methods (set_active, stop,
get_cached_frame_at_index) are delegated; low-level ring-buffer and
signal internals stay on the concrete worker.
| PARAMETER | DESCRIPTION |
|---|---|
worker
|
Concrete video decode worker controlled by this adapter.
TYPE:
|
__init__(worker: VideoDecodeWorker) -> None
get_cached_frame_at_index(idx: int) -> RGBFrame | None
Retrieve a decoded frame from the worker's ring buffer.
| PARAMETER | DESCRIPTION |
|---|---|
idx
|
Zero-based frame index to look up.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RGBFrame | None
|
Cached RGB frame, or |
set_active(active: bool, resume_idx: int = 0) -> None
Activate or deactivate the wrapped decode worker.
| PARAMETER | DESCRIPTION |
|---|---|
active
|
Whether the worker should decode frames.
TYPE:
|
resume_idx
|
Frame index from which decoding should resume when activated.
TYPE:
|
stop() -> None
Stop the wrapped decode worker and release its reader resources.