pub struct Camera {
pub name: String,
pub unique_id: String,
pub serial_number: Option<String>,
pub vendor_id: u16,
pub product_id: u16,
pub max_resolution: Option<(u32, u32)>,
pub max_fps: Option<u32>,
}Expand description
A connected USB Video Class camera.
Fields§
§name: StringHuman-readable name, e.g. "Logitech StreamCam".
unique_id: StringOS capture-layer identifier (AVFoundation uniqueID, DirectShow device
path). Used to open preview/controls; may embed a USB location and so
change when the camera is moved to another port.
serial_number: Option<String>USB iSerialNumber when the device reports one. Port-stable; preferred
for persisted config keys via Self::config_key.
vendor_id: u16USB vendor id (0x046d for Logitech).
product_id: u16USB product id (e.g. 0x0893 for the StreamCam).
max_resolution: Option<(u32, u32)>Largest supported frame size (width, height), when the OS reports the
device’s formats. Read from metadata only — no capture, no permission.
max_fps: Option<u32>Highest supported frame rate (fps) across all formats, when known.
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn config_key(&self) -> String
pub fn config_key(&self) -> String
Persistence key that is stable across USB ports.
Prefers the USB serial when the device reports one. When it doesn’t,
falls back to a model-scoped key (camera:vid:pid) so settings survive
a port change. Two serial-less units of the same model share this key
(no stronger USB identity); the GUI keeps them as separate live cards
via the OS capture id, not via this settings key.