add a bunch of files

This commit is contained in:
l1npengtul
2021-05-19 23:31:21 +09:00
parent 8567293b08
commit 1f430064b6
11 changed files with 48 additions and 16 deletions
+2
View File
@@ -24,6 +24,8 @@
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/rayon-core-bfc51648641673b7/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/syn-a14c600f8083dc5a/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/v4l2-sys-mit-1401199a612bbed5/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/mozjpeg-sys-c35f54bf209e057e/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/nokhwa-fca4e2084c34cbf5/out" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
+4 -4
View File
@@ -15,7 +15,7 @@ input_uvc = ["uvc"]
input_opencv = ["opencv", "opencv/clang-runtime"]
input_msmf = ["windows"]
input_v4l = ["v4l"]
input_ffmpeg = ["rusty_ffmpeg"]
input_ffmpeg = ["ffav"]
input_gstreamer = ["gstreamer"]
[dependencies]
@@ -28,15 +28,15 @@ version = "0.53.0"
optional = true
[dependencies.v4l]
version = "0.12.0"
version = "0.12.1"
optional = true
[dependencies.uvc]
version = "0.2.0"
optional = true
[dependencies.rusty_ffmpeg]
version = "0.7.0"
[dependencies.ffav]
version = "4.3.12"
optional = true
[dependencies.gstreamer]
+2
View File
@@ -0,0 +1,2 @@
#[cfg(feature = "input_v4l")]
pub mod v4l_capture;
+10
View File
@@ -0,0 +1,10 @@
use crate::utils::CameraFormat;
pub struct V4LCaptureDevice<'a> {
camera_format: CameraFormat,
}
impl V4LCaptureDevice {
}
+1
View File
@@ -0,0 +1 @@
pub mod capture;
+3
View File
@@ -0,0 +1,3 @@
pub struct CaptureCamera {
}
View File
+6 -2
View File
@@ -1,6 +1,10 @@
#![deny(clippy::pedantic)]
#![warn(clippy::all)]
#![allow(clippy::upper_case_acronyms)]
mod traits;
mod camera_traits;
pub mod backends;
mod utils;
mod utils;
mod camera;
mod error;
mod query;
View File
+20 -10
View File
@@ -1,10 +1,10 @@
use std::fmt::Display;
use std::cmp::Ordering;
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Hash)]
pub enum FrameFormat {
MJPEG = 0,
YUYV = 1,
MJPEG,
YUYV,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
@@ -40,7 +40,7 @@ impl Resolution {
impl Display for Resolution {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}x{}", self.x, self.y)
write!(f, "{}x{}", self.x(), self.y())
}
}
@@ -54,15 +54,15 @@ impl Ord for Resolution {
// Flip around the order to make it seem the way the user would expect.
// The user would expect a descending list of resolutions (aka highest -> lowest)
fn cmp(&self, other: &Self) -> Ordering {
match self.x.cmp(&other.x) {
match self.x().cmp(&other.x()) {
Ordering::Less => Ordering::Less,
Ordering::Equal => self.y.cmp(&other.y),
Ordering::Equal => self.y().cmp(&other.y()),
Ordering::Greater => Ordering::Greater,
}
}
}
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
pub struct CameraFormat {
resolution: Resolution,
format: FrameFormat,
@@ -93,11 +93,11 @@ impl CameraFormat {
self.resolution
}
pub fn width(&self) -> Resolution {
pub fn width(&self) -> u32 {
self.resolution.width()
}
pub fn height(&self) -> Resolution {
pub fn height(&self) -> u32 {
self.resolution.height()
}
@@ -108,4 +108,14 @@ impl CameraFormat {
pub fn framerate(&self) -> u32 {
self.framerate
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CaptureAPIBackend {
AUTO,
V4L2,
UVC,
MSMF,
OPENCV,
FFMPEG,
}