diff --git a/Cargo.toml b/Cargo.toml index 8687e57..69eb48c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ output-wgpu = ["wgpu", "nokhwa-core/wgpu-types"] output-threaded = [] small-wasm = [] docs-only = ["input-native", "input-opencv", "input-jscam","output-wgpu", "output-threaded", "serialize"] -docs-nolink = ["opencv/docs-only", "nokhwa-core/docs-features"] +docs-nolink = ["nokhwa-core/docs-features"] docs-features = [] test-fail-warning = [] @@ -68,11 +68,11 @@ version = "0.2" optional = true [dependencies.wgpu] -version = "0.14" +version = "0.15" optional = true [dependencies.opencv] -version = "0.74" +version = "0.76" default-features = false features = ["videoio"] optional = true @@ -82,17 +82,17 @@ version = "0.8" optional = true [dependencies.nokhwa-bindings-windows] -version = "0.4.0" +version = "0.4" path = "nokhwa-bindings-windows" optional = true [dependencies.nokhwa-bindings-macos] -version = "0.2.0" +version = "0.2" path = "nokhwa-bindings-macos" optional = true [dependencies.nokhwa-bindings-linux] -version = "0.1.0" +version = "0.1" path = "nokhwa-bindings-linux" optional = true diff --git a/nokhwa-core/src/format_filter.rs b/nokhwa-core/src/format_filter.rs new file mode 100644 index 0000000..4a83aab --- /dev/null +++ b/nokhwa-core/src/format_filter.rs @@ -0,0 +1,25 @@ +use crate::frame_format::FrameFormat; +use crate::types::{CameraFormat, Resolution}; +use std::collections::HashMap; + + +/// Tells the init function what camera format to pick. +/// - `AbsoluteHighestResolution`: Pick the highest [`Resolution`], then pick the highest frame rate of those provided. +/// - `AbsoluteHighestFrameRate`: Pick the highest frame rate, then the highest [`Resolution`]. +/// - `HighestResolution(Resolution)`: Pick the highest [`Resolution`] for the given framerate (the `Option`). +/// - `HighestFrameRate(u32)`: Pick the highest frame rate for the given [`Resolution`] (the `Option`). +/// - `None`: Pick a random [`CameraFormat`] +#[derive(Copy, Clone, Debug, Hash, Ord, PartialOrd, Eq, PartialEq)] +#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] +pub enum RequestedFormatType { + AbsoluteHighestResolution, + AbsoluteHighestFrameRate, + HighestResolution(Resolution), + HighestFrameRate(u32), + None, +} + + +pub struct FormatFilter { + filter_pref: +} diff --git a/nokhwa-core/src/lib.rs b/nokhwa-core/src/lib.rs index f4c5a06..37df3c9 100644 --- a/nokhwa-core/src/lib.rs +++ b/nokhwa-core/src/lib.rs @@ -21,6 +21,7 @@ //! Core type definitions for `nokhwa` pub mod buffer; pub mod error; +pub mod format_filter; pub mod frame_format; pub mod pixel_format; pub mod traits; diff --git a/nokhwa-core/src/pixel_format.rs b/nokhwa-core/src/pixel_format.rs index 2b46a59..b4373e4 100644 --- a/nokhwa-core/src/pixel_format.rs +++ b/nokhwa-core/src/pixel_format.rs @@ -14,14 +14,8 @@ * limitations under the License. */ use crate::buffer::Buffer; -use crate::error::NokhwaError; use crate::frame_format::FrameFormat; -use crate::types::{ - buf_mjpeg_to_rgb, buf_nv12_to_rgb, buf_yuyv422_to_rgb, mjpeg_to_rgb, nv12_to_rgb, - yuyv422_to_rgb, Resolution, -}; -use image::{ImageBuffer, Luma, LumaA, Pixel, Primitive, Rgb, Rgba}; -use std::fmt::Debug; +use image::{ImageBuffer, Luma, LumaA, Primitive, Rgb, Rgba}; use std::ops::Deref; pub trait FormatDecoders: Send + Sync { diff --git a/nokhwa-core/src/types.rs b/nokhwa-core/src/types.rs index 9c07707..f8a804d 100644 --- a/nokhwa-core/src/types.rs +++ b/nokhwa-core/src/types.rs @@ -9,26 +9,6 @@ use std::{ str::FromStr, }; -/// Tells the init function what camera format to pick. -/// - `AbsoluteHighestResolution`: Pick the highest [`Resolution`], then pick the highest frame rate of those provided. -/// - `AbsoluteHighestFrameRate`: Pick the highest frame rate, then the highest [`Resolution`]. -/// - `HighestResolution(Resolution)`: Pick the highest [`Resolution`] for the given framerate (the `Option`). -/// - `HighestFrameRate(u32)`: Pick the highest frame rate for the given [`Resolution`] (the `Option`). -/// - `Exact`: Pick the exact [`CameraFormat`] provided. -/// - `Closest`: Pick the closest [`CameraFormat`] provided in order of [`FrameFormat`], [`Resolution`], and FPS. -/// - `None`: Pick a random [`CameraFormat`] -#[derive(Copy, Clone, Debug, Hash, Ord, PartialOrd, Eq, PartialEq)] -#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] -pub enum RequestedFormatType { - AbsoluteHighestResolution, - AbsoluteHighestFrameRate, - HighestResolution(Resolution), - HighestFrameRate(u32), - Exact(CameraFormat), - Closest(CameraFormat), - None, -} - impl Default for RequestedFormatType { fn default() -> Self { RequestedFormatType::None