diff --git a/examples/capture/src/main.rs b/examples/capture/src/main.rs index ef3fa5b..d8703ac 100644 --- a/examples/capture/src/main.rs +++ b/examples/capture/src/main.rs @@ -5,7 +5,7 @@ fn main() { let mut camera = Camera::new( 0, Some(CameraFormat::new_from(640, 480, FrameFormat::MJPEG, 30)), - CaptureAPIBackend::AUTO, + CaptureAPIBackend::Auto, ) .unwrap(); // open stream diff --git a/src/camera.rs b/src/camera.rs index 83a457f..4f6c57d 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -28,41 +28,41 @@ impl Camera { ) -> Result { let platform = std::env::consts::OS; let use_backend = match backend { - CaptureAPIBackend::AUTO => { - let mut cap = CaptureAPIBackend::AUTO; + CaptureAPIBackend::Auto => { + let mut cap = CaptureAPIBackend::Auto; if cfg!(feature = "input_v4l") && platform == "linux" { - cap = CaptureAPIBackend::V4L2 + cap = CaptureAPIBackend::Video4Linux } else if cfg!(feature = "input_uvc") { - cap = CaptureAPIBackend::UVC; + cap = CaptureAPIBackend::UniversalVideoClass; } - if cap == CaptureAPIBackend::AUTO { + if cap == CaptureAPIBackend::Auto { return Err(NokhwaError::NotImplemented( "Platform requirements not satisfied.".to_string(), )); } cap } - CaptureAPIBackend::V4L2 => { + CaptureAPIBackend::Video4Linux => { if !(cfg!(feature = "input_v4l") && platform == "linux") { return Err(NokhwaError::NotImplemented( "V4L Requirements: Linux and `input_v4l`.".to_string(), )); } - CaptureAPIBackend::V4L2 + CaptureAPIBackend::Video4Linux } - CaptureAPIBackend::UVC => { + CaptureAPIBackend::UniversalVideoClass => { if !(cfg!(feature = "input_uvc")) { return Err(NokhwaError::NotImplemented( "UVC Requirements: `input_uvc`.".to_string(), )); } - CaptureAPIBackend::UVC + CaptureAPIBackend::UniversalVideoClass } _ => return Err(NokhwaError::NotImplemented(backend.to_string())), }; let capture_backend = match use_backend { - CaptureAPIBackend::V4L2 => match init_v4l(index, format) { + CaptureAPIBackend::Video4Linux => match init_v4l(index, format) { Some(capture) => match capture { Ok(cap_back) => cap_back, Err(why) => return Err(why), @@ -73,7 +73,7 @@ impl Camera { )); } }, - CaptureAPIBackend::UVC => match init_uvc(index, format) { + CaptureAPIBackend::UniversalVideoClass => match init_uvc(index, format) { Some(capture) => match capture { Ok(cap_back) => cap_back, Err(why) => return Err(why), diff --git a/src/utils.rs b/src/utils.rs index 23982bd..061bed8 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -272,12 +272,12 @@ impl Display for CameraInfo { /// - FFMPEG - Uses FFMPEG (libavdevice) to capture. Platform agnostic. #[derive(Clone, Copy, Debug, PartialEq)] pub enum CaptureAPIBackend { - AUTO, - V4L2, - UVC, - WINDOWS, - OPENCV, - FFMPEG, + Auto, + Video4Linux, + UniversalVideoClass, + Windows, + OpenCv, + Ffmpeg, } impl Display for CaptureAPIBackend {