use crate::resources::RawImageFormat;
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CaptureStreamId {
pub id: u64,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CameraFacing {
Front,
Back,
External,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum StreamState {
Starting,
Running,
Paused,
Stopped,
Error,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CaptureOrientation {
Up,
Down,
Left,
Right,
Mirror,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CaptureErrorCode {
PermissionDenied,
DeviceUnavailable,
DeviceLost,
Unsupported,
Internal,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct CameraConfig {
pub facing: CameraFacing,
pub width: u32,
pub height: u32,
pub fps: u32,
pub output_format: RawImageFormat,
}
impl Default for CameraConfig {
fn default() -> Self {
Self {
facing: CameraFacing::Back,
width: 0,
height: 0,
fps: 0,
output_format: RawImageFormat::BGRA8,
}
}
}
impl CameraConfig {
pub fn new(facing: CameraFacing) -> Self {
Self {
facing,
..Self::default()
}
}
}
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct CaptureStats {
pub measured_fps: f32,
pub frames_delivered: u64,
pub frames_dropped: u64,
}
impl Default for CaptureStats {
fn default() -> Self {
Self {
measured_fps: 0.0,
frames_delivered: 0,
frames_dropped: 0,
}
}
}