1use crate::stream::CameraStream;
2use crate::types::{FormatDescriptor, StreamConfig};
3
4pub trait CameraManager {
6 type Device: CameraDevice;
7 type Error: core::error::Error;
8
9 fn discover_devices(&self) -> Result<impl Iterator<Item = Self::Device>, Self::Error>;
10 fn default_device(&self) -> Result<Option<Self::Device>, Self::Error>;
11}
12
13pub trait CameraDevice {
15 type Stream: CameraStream;
16 type Error: core::error::Error;
17
18 fn id(&self) -> &str;
19 fn name(&self) -> &str;
20 fn supported_formats(&self) -> Result<impl Iterator<Item = FormatDescriptor>, Self::Error>;
21 fn open(self, config: &StreamConfig) -> Result<Self::Stream, Self::Error>;
22}