From 7aaca8f81bdd9edd486304b3f3aa3822642db5db Mon Sep 17 00:00:00 2001 From: Christian M Date: Sat, 21 Oct 2023 09:42:17 +0200 Subject: [PATCH] :pushpin: use nokhwa git version --- Cargo.lock | 102 ++++++++++++++++++++++++-------------------------- Cargo.toml | 6 +-- src/server.rs | 8 +++- 3 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61d5b35..d892448 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,24 +260,24 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.56.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ "bitflags 1.3.2", "cexpr", "clang-sys", - "clap 2.34.0", - "env_logger 0.8.4", "lazy_static", "lazycell", "log", "peeking_take_while", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", + "syn 2.0.38", "which", ] @@ -581,11 +581,11 @@ dependencies = [ [[package]] name = "cexpr" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom 5.1.3", + "nom", ] [[package]] @@ -1188,19 +1188,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "env_logger" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.10.0" @@ -1645,6 +1632,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "http" version = "0.2.9" @@ -2524,8 +2520,7 @@ dependencies = [ [[package]] name = "nokhwa" version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4ae290027ab0d22e1405d304603e41edfaee597a81ce09cf751785b44c32a9" +source = "git+https://github.com/l1npengtul/nokhwa?branch=0.10#8ac5ce9d91b45a5c6b493cff6a656d8f8416050a" dependencies = [ "flume", "image 0.24.7", @@ -2533,6 +2528,7 @@ dependencies = [ "nokhwa-bindings-macos", "nokhwa-bindings-windows", "nokhwa-core", + "parking_lot 0.12.1", "paste", "thiserror", ] @@ -2540,8 +2536,7 @@ dependencies = [ [[package]] name = "nokhwa-bindings-linux" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "448db09af68e12168b6311423409f679d2da6e75fb158b2d75de2f5d6dc460ca" +source = "git+https://github.com/l1npengtul/nokhwa?branch=0.10#8ac5ce9d91b45a5c6b493cff6a656d8f8416050a" dependencies = [ "nokhwa-core", "v4l", @@ -2551,11 +2546,11 @@ dependencies = [ [[package]] name = "nokhwa-bindings-macos" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739d58859fd2b958f01c25de9a0fbb686be7271e5ef3624150e2be85a627b38a" +source = "git+https://github.com/l1npengtul/nokhwa?branch=0.10#8ac5ce9d91b45a5c6b493cff6a656d8f8416050a" dependencies = [ "block", "cocoa-foundation", + "core-foundation 0.9.3", "core-media-sys", "core-video-sys", "flume", @@ -2567,8 +2562,7 @@ dependencies = [ [[package]] name = "nokhwa-bindings-windows" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b9bae36d0ce413568cefb94c43748e80f9ae97aa0a9e2d8e18f0275a909746" +source = "git+https://github.com/l1npengtul/nokhwa?branch=0.10#8ac5ce9d91b45a5c6b493cff6a656d8f8416050a" dependencies = [ "nokhwa-core", "once_cell", @@ -2578,8 +2572,7 @@ dependencies = [ [[package]] name = "nokhwa-core" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9b0e58413cb1b6d041d802be0e921368f3c72525b7ea720089c8aa140d6d49" +source = "git+https://github.com/l1npengtul/nokhwa?branch=0.10#8ac5ce9d91b45a5c6b493cff6a656d8f8416050a" dependencies = [ "bytes 1.5.0", "image 0.24.7", @@ -2587,16 +2580,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "nom" -version = "5.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" -dependencies = [ - "memchr", - "version_check", -] - [[package]] name = "nom" version = "7.1.3" @@ -3129,10 +3112,20 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" dependencies = [ - "env_logger 0.10.0", + "env_logger", "log", ] +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.38", +] + [[package]] name = "primal-check" version = "0.3.3" @@ -3720,9 +3713,9 @@ dependencies = [ [[package]] name = "shlex" -version = "0.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "show-image" @@ -4352,7 +4345,7 @@ dependencies = [ "lazy_static", "maplit", "ndarray", - "nom 7.1.3", + "nom", "num-integer", "num-traits", "scan_fmt", @@ -4404,7 +4397,7 @@ dependencies = [ "byteorder", "flate2", "log", - "nom 7.1.3", + "nom", "tar", "tract-core", "walkdir", @@ -4539,9 +4532,9 @@ dependencies = [ [[package]] name = "v4l" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9946a2fda19c7a729dc72e28b9fd9c653e9b7de954ffe3aecaf51977f88762" +checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403" dependencies = [ "bitflags 1.3.2", "libc", @@ -4550,9 +4543,9 @@ dependencies = [ [[package]] name = "v4l2-sys-mit" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c932c06df4af1dfb229f604214f2a87993784596ff33ffdadcba1b5519254e" +checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b" dependencies = [ "bindgen", ] @@ -4843,11 +4836,14 @@ dependencies = [ [[package]] name = "which" -version = "3.1.1" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "libc", + "either", + "home", + "once_cell", + "rustix", ] [[package]] @@ -5098,7 +5094,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" dependencies = [ - "nom 7.1.3", + "nom", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b542350..f97d627 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/chriamue/ornithology-pi" build = "build.rs" [features] -default = ["server", "camera", "yolo"] +default = ["server", "camera", "yolo", "bt-server"] full = ["bt-server", "camera", "detect", "hotspot", "server"] pi = ["bt-server", "camera", "detect", "server"] bluetooth = ["base64"] @@ -18,7 +18,7 @@ bt-server = ["bluetooth", "bluer"] webcam = ["camera"] camera = ["nokhwa/input-native"] hotspot = ["wifi-rs"] -server = ["axum", "base64", "tower", "tower-http"] +server = ["axum", "base64", "tower", "tower-http", "webcam"] window = ["show-image/image"] detect = [ "camera", @@ -51,7 +51,7 @@ lenna_birds_plugin = { git = "https://github.com/lenna-project/birds-plugin", br lenna_yolo_plugin = { git = "https://github.com/lenna-project/yolo-plugin", branch = "main", default-features = false, optional = true } log = "0.4" mime = "0.3.17" -nokhwa = { version = "0.10.4", features = ["output-threaded"], optional = true} +nokhwa = { git = "https://github.com/l1npengtul/nokhwa", branch = "0.10", features = ["output-threaded"], optional = true} rand = "0.8" serde = { version = "1.0", features = ["derive"] } diff --git a/src/server.rs b/src/server.rs index aa400db..6f53e91 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,7 +1,9 @@ #[cfg(feature = "detect")] use crate::BirdDetector; use crate::{sighting::save_to_file, Config}; -use crate::{Capture, MJpeg, Sighting, WebCam}; +use crate::{Capture, Sighting}; +#[cfg(feature = "webcam")] +use crate::{MJpeg, WebCam}; use axum::{ body::StreamBody, extract, @@ -89,6 +91,7 @@ async fn get_sightings( Ok(Json(json!(sightings))) } +#[cfg(feature = "webcam")] async fn webcam( Extension(capture): Extension>>, ) -> Result, AppError> { @@ -104,6 +107,7 @@ async fn webcam( .map_err(|_| AppError::ResponseBuildError) } +#[cfg(feature = "webcam")] async fn frame( Extension(capture): Extension>>, ) -> Result, AppError> { @@ -189,9 +193,9 @@ pub async fn server(config: &Config, sightings: SightingsContainer, capture: Arc let app = Router::new() .nest_service("/", serve_dir.clone()) .route("/generate_204", get(generate_204)) - .route("/sightings", get(get_sightings)) .route("/webcam", get(webcam)) .route("/frame", get(frame)) + .route("/sightings", get(get_sightings)) .route("/sightings/:id", get(sighting)) .route("/sightings/:id", delete(delete_sighting)) .layer(Extension(sightings.clone()))