Skip to main content

Module camera

Module camera 

Source
Expand description

Camera device enumeration (M-CAM.1 / AUT-255) — CLI-pipe pattern.

Spawns gst-device-monitor-1.0 Video/Source and parses its human-readable text output into a Vec<CameraDevice>. Preserves the project’s CLI-pipe-over-gstreamer-rs convention (CLAUDE.md: “Upgrading to gstreamer-rs Rust bindings is a later chunk”).

The ticket spec offered three enumeration backends: gst CLI
subprocess (chosen), platform-native (`AVCaptureDevice` /
`IMFActivate` / `udev`), or the `gstreamer-rs` `DeviceMonitor`.
Option 1 minimises new surface area — no new Rust deps, no
per-OS code paths. The cost is parsing a loosely-specified text
output, mitigated by the fixture-driven parser tests below.

Structs§

CameraDevice
One attached camera device with a stable ID, a human-readable label, and a flag indicating whether the OS treats it as the default.

Functions§

find_by_id
Locate the CameraDevice whose stable id matches id by re-probing the OS via list_cameras. Used by super::gstreamer_video::GstreamerVideoCapture::from_camera to resolve the picker’s camera id back to its OS-native source element on every recording start (M-CAM.4). Returns None when the camera has been unplugged since enumeration.
list_cameras
Enumerate every camera the OS exposes via gst-device-monitor-1.0.
make_device 🔒
parse_device_monitor_output
Pure-Rust parser for gst-device-monitor-1.0 Video/Source text output. Split out from list_cameras so the parser is testable against captured fixtures without needing gst installed.
stable_id_for
Derive a stable ID for a camera from its human-readable label using FNV-1a. Deterministic, dependency-free.