pub struct CameraDevice {
pub id: String,
pub label: String,
pub is_default: bool,
pub gst_source: Option<String>,
}Expand description
One attached camera device with a stable ID, a human-readable label, and a flag indicating whether the OS treats it as the default.
id is derived from the device name via FNV-1a hashing so the
same camera produces the same ID across reboots even when the
OS’s underlying device-id string is non-stable (macOS
AVFoundation has a history of doing this).
Fields§
§id: StringStable identifier — used by M-CAM.4’s “last-used camera”
persistence and by M-CAM.2’s start_preview(camera_id) IPC.
label: StringHuman-readable label (e.g. "FaceTime HD Camera").
is_default: booltrue for the first device the OS lists. There’s no canonical
“default camera” concept in the gst output, so we fall back to
“first in the list” — which generally matches the macOS /
Windows default-device selection.
gst_source: Option<String>gst-launch source-element tokens that pin capture to this
physical device — extracted from gst-device-monitor-1.0’s
per-device hint line (e.g. "avfvideosrc device-index=0").
None when the parser couldn’t find a hint line; callers
should fall back to autovideosrc in that case. Used by
super::gstreamer_video::GstreamerVideoCapture::from_camera
to actually route to the picked camera (M-CAM.4).
Trait Implementations§
Source§impl Clone for CameraDevice
impl Clone for CameraDevice
Source§fn clone(&self) -> CameraDevice
fn clone(&self) -> CameraDevice
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CameraDevice
impl Debug for CameraDevice
Source§impl<'de> Deserialize<'de> for CameraDevice
impl<'de> Deserialize<'de> for CameraDevice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for CameraDevice
impl Hash for CameraDevice
Source§impl PartialEq for CameraDevice
impl PartialEq for CameraDevice
Source§fn eq(&self, other: &CameraDevice) -> bool
fn eq(&self, other: &CameraDevice) -> bool
self and other values to be equal, and is used by ==.