consider update selection API

This commit is contained in:
l1npengtul
2023-02-09 23:02:24 +09:00
parent 4be48f09e0
commit 533b7e4742
5 changed files with 33 additions and 33 deletions
+6 -6
View File
@@ -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
+25
View File
@@ -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<u32>`).
/// - `HighestFrameRate(u32)`: Pick the highest frame rate for the given [`Resolution`] (the `Option<Resolution>`).
/// - `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:
}
+1
View File
@@ -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;
+1 -7
View File
@@ -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 {
-20
View File
@@ -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<u32>`).
/// - `HighestFrameRate(u32)`: Pick the highest frame rate for the given [`Resolution`] (the `Option<Resolution>`).
/// - `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