camera: remove eye-rs to fix build for mac, horizontally flip image

This commit is contained in:
ardocrat 2024-10-08 23:23:04 +03:00
parent 846e30cb38
commit af220b2a09
4 changed files with 185 additions and 406 deletions

491
Cargo.lock generated
View file

@ -108,12 +108,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "adler32"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]]
name = "aead"
version = "0.4.3"
@ -427,7 +421,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89"
dependencies = [
"clipboard-win",
"core-graphics",
"core-graphics 0.23.2",
"image 0.25.1",
"log",
"objc2 0.5.2",
@ -1083,9 +1077,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
dependencies = [
"bitflags 1.3.2",
"cexpr 0.4.0",
"cexpr",
"clang-sys",
"clap 2.34.0",
"clap",
"env_logger 0.8.4",
"lazy_static",
"lazycell",
@ -1095,54 +1089,8 @@ dependencies = [
"quote 1.0.36",
"regex",
"rustc-hash",
"shlex 0.1.1",
"which 3.1.1",
]
[[package]]
name = "bindgen"
version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6"
dependencies = [
"bitflags 1.3.2",
"cexpr 0.6.0",
"clang-sys",
"clap 3.2.25",
"env_logger 0.9.3",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2 1.0.85",
"quote 1.0.36",
"regex",
"rustc-hash",
"shlex 1.3.0",
"which 4.4.2",
]
[[package]]
name = "bindgen"
version = "0.65.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
dependencies = [
"bitflags 1.3.2",
"cexpr 0.6.0",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"prettyplease",
"proc-macro2 1.0.85",
"quote 1.0.36",
"regex",
"rustc-hash",
"shlex 1.3.0",
"syn 2.0.66",
"which 4.4.2",
"shlex",
"which",
]
[[package]]
@ -1504,15 +1452,6 @@ dependencies = [
"nom 5.1.3",
]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom 7.1.3",
]
[[package]]
name = "cfg-expr"
version = "0.15.8"
@ -1631,35 +1570,11 @@ dependencies = [
"atty",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap 0.11.0",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "clap"
version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [
"atty",
"bitflags 1.3.2",
"clap_lex",
"indexmap 1.9.3",
"strsim 0.10.0",
"termcolor",
"textwrap 0.16.1",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "clipboard-win"
version = "5.3.1"
@ -1678,15 +1593,6 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "cmake"
version = "0.1.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
dependencies = [
"cc",
]
[[package]]
name = "coarsetime"
version = "0.1.34"
@ -1698,6 +1604,35 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "cocoa"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c49e86fc36d5704151f5996b7b3795385f50ce09e3be0f47a0cfde869681cf8"
dependencies = [
"bitflags 1.3.2",
"block",
"core-foundation 0.7.0",
"core-graphics 0.19.2",
"foreign-types 0.3.2",
"libc",
"objc",
]
[[package]]
name = "cocoa-foundation"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
dependencies = [
"bitflags 1.3.2",
"block",
"core-foundation 0.9.4",
"core-graphics-types",
"libc",
"objc",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -1829,6 +1764,18 @@ version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "core-graphics"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
dependencies = [
"bitflags 1.3.2",
"core-foundation 0.7.0",
"foreign-types 0.3.2",
"libc",
]
[[package]]
name = "core-graphics"
version = "0.23.2"
@ -1853,6 +1800,31 @@ dependencies = [
"libc",
]
[[package]]
name = "core-media-sys"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "273bf3fc5bf51fd06a7766a84788c1540b6527130a0bce39e00567d6ab9f31f1"
dependencies = [
"cfg-if 0.1.10",
"core-foundation-sys 0.7.0",
"libc",
]
[[package]]
name = "core-video-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828"
dependencies = [
"cfg-if 0.1.10",
"core-foundation-sys 0.7.0",
"core-graphics 0.19.2",
"libc",
"metal 0.18.0",
"objc",
]
[[package]]
name = "cpufeatures"
version = "0.2.12"
@ -2504,12 +2476,6 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dunce"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
[[package]]
name = "dyn-clone"
version = "1.0.17"
@ -2916,19 +2882,6 @@ dependencies = [
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
dependencies = [
"atty",
"humantime 2.1.0",
"log",
"regex",
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.10.2"
@ -3036,7 +2989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4"
dependencies = [
"bit_field",
"flume",
"flume 0.11.0",
"half",
"lebe",
"miniz_oxide",
@ -3045,30 +2998,6 @@ dependencies = [
"zune-inflate",
]
[[package]]
name = "eye"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5a6b664620ec3a6f16cd16ededdae1fba23a533be8d5e735b94e8696d8bb916"
dependencies = [
"eye-hal",
"ffimage",
"ffimage_yuv",
]
[[package]]
name = "eye-hal"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ee94b0bb9d8c8a0b50ca9a2f8ab84ed9fe7b475ed13eb0d8efec9d9339886d0"
dependencies = [
"bitflags 1.3.2",
"openpnp_capture",
"openpnp_capture_sys",
"uvc",
"v4l",
]
[[package]]
name = "fake-simd"
version = "0.1.2"
@ -3121,25 +3050,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "ffimage"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0a72fa07ae1c1c2d50f9caeb30890b23596b73d1c2f6cd229a2ae658a15d36"
dependencies = [
"num-traits 0.2.19",
]
[[package]]
name = "ffimage_yuv"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cf7ab943a8157f1f133a07ae728d5844b30d982e43f24c1098d6dc6cf38efb3"
dependencies = [
"ffimage",
"num-traits 0.2.19",
]
[[package]]
name = "fiat-crypto"
version = "0.2.9"
@ -3246,6 +3156,19 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "749cff877dc1af878a0b31a41dd221a753634401ea0ef2f87b62d3171522485a"
[[package]]
name = "flume"
version = "0.10.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"pin-project",
"spin 0.9.8",
]
[[package]]
name = "flume"
version = "0.11.0"
@ -3819,7 +3742,6 @@ dependencies = [
"egui",
"egui_extras",
"env_logger 0.11.3",
"eye",
"fs-mistrust",
"futures 0.3.30",
"gif",
@ -3845,7 +3767,6 @@ dependencies = [
"local-ip-address",
"log",
"nokhwa",
"openpnp_capture_sys",
"openssl-sys",
"parking_lot 0.12.3",
"qrcode",
@ -5236,26 +5157,6 @@ version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libflate"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18"
dependencies = [
"adler32",
"crc32fast",
"libflate_lz77",
]
[[package]]
name = "libflate_lz77"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf"
dependencies = [
"rle-decode-fast",
]
[[package]]
name = "libfuzzer-sys"
version = "0.4.7"
@ -5335,20 +5236,6 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "libusb1-sys"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be241693102a24766d0b8526c8988771edac2842630d7e730f8e9fbc014f3703"
dependencies = [
"cc",
"libc",
"libflate",
"pkg-config",
"tar",
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@ -5600,6 +5487,21 @@ dependencies = [
"zeroize",
]
[[package]]
name = "metal"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0"
dependencies = [
"bitflags 1.3.2",
"block",
"cocoa",
"core-graphics 0.19.2",
"foreign-types 0.3.2",
"log",
"objc",
]
[[package]]
name = "metal"
version = "0.28.0"
@ -5751,17 +5653,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "mozjpeg-sys"
version = "0.10.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "798a7f921b39b07a6491c8a3c8c0cbabd5cc9826089603abdf31e6ed9121dfcc"
dependencies = [
"cc",
"dunce",
"libc",
]
[[package]]
name = "naga"
version = "0.20.0"
@ -5783,6 +5674,15 @@ dependencies = [
"unicode-xid 0.2.4",
]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom 0.2.15",
]
[[package]]
name = "native-tls"
version = "0.2.12"
@ -5940,12 +5840,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc4ae290027ab0d22e1405d304603e41edfaee597a81ce09cf751785b44c32a9"
dependencies = [
"image 0.24.9",
"nokhwa-bindings-linux",
"nokhwa-bindings-macos",
"nokhwa-bindings-windows",
"nokhwa-core",
"paste",
"thiserror",
]
[[package]]
name = "nokhwa-bindings-linux"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "448db09af68e12168b6311423409f679d2da6e75fb158b2d75de2f5d6dc460ca"
dependencies = [
"nokhwa-core",
"v4l",
"v4l2-sys-mit",
]
[[package]]
name = "nokhwa-bindings-macos"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "739d58859fd2b958f01c25de9a0fbb686be7271e5ef3624150e2be85a627b38a"
dependencies = [
"block",
"cocoa-foundation",
"core-media-sys",
"core-video-sys",
"flume 0.10.14",
"nokhwa-core",
"objc",
"once_cell",
]
[[package]]
name = "nokhwa-bindings-windows"
version = "0.4.0"
@ -6201,6 +6130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
dependencies = [
"malloc_buf",
"objc_exception",
]
[[package]]
@ -6355,6 +6285,15 @@ dependencies = [
"objc2-metal",
]
[[package]]
name = "objc_exception"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
dependencies = [
"cc",
]
[[package]]
name = "objc_id"
version = "0.1.1"
@ -6391,26 +6330,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "openpnp_capture"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a10290d1e3409f3010630697775764a601e6ed929d289975f94932b66848ce90"
dependencies = [
"lazy_static",
"openpnp_capture_sys",
]
[[package]]
name = "openpnp_capture_sys"
version = "0.4.0"
source = "git+https://github.com/ardocrat/openpnp-capture-rs?branch=cross_compilation_support#d03e36b804b2f3f83f4cd977bdcf3c62cdf82e8c"
dependencies = [
"bindgen 0.60.1",
"cc",
"cmake",
]
[[package]]
name = "openssl"
version = "0.10.64"
@ -6527,12 +6446,6 @@ dependencies = [
"pin-project-lite 0.2.14",
]
[[package]]
name = "os_str_bytes"
version = "6.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
[[package]]
name = "overload"
version = "0.1.1"
@ -6928,16 +6841,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]]
name = "prettyplease"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
dependencies = [
"proc-macro2 1.0.85",
"syn 2.0.66",
]
[[package]]
name = "prettytable-rs"
version = "0.10.0"
@ -7713,12 +7616,6 @@ dependencies = [
"uuid 1.8.0",
]
[[package]]
name = "rle-decode-fast"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
[[package]]
name = "roxmltree"
version = "0.19.0"
@ -8401,12 +8298,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook-registry"
version = "1.4.2"
@ -8842,17 +8733,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "tar"
version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]]
name = "target-lexicon"
version = "0.12.14"
@ -8921,12 +8801,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
[[package]]
name = "thiserror"
version = "1.0.61"
@ -10631,41 +10505,11 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
[[package]]
name = "uvc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4126f130b1b469a8342f7c0001c4f4ac828613c977d6887972d60e0ddff1f9"
dependencies = [
"uvc-sys",
]
[[package]]
name = "uvc-src"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8c8fb61b6ad848f5c123c1700a9437dda7cae3bc17dc6f97690e31eaff1d435"
dependencies = [
"cc",
"libusb1-sys",
"mozjpeg-sys",
]
[[package]]
name = "uvc-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3675c448fbdc98cbdc4f755a541d41154d153eb3112686be533940ae925eb00"
dependencies = [
"bindgen 0.56.0",
"uvc-src",
]
[[package]]
name = "v4l"
version = "0.14.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403"
checksum = "fd9946a2fda19c7a729dc72e28b9fd9c653e9b7de954ffe3aecaf51977f88762"
dependencies = [
"bitflags 1.3.2",
"libc",
@ -10674,11 +10518,11 @@ dependencies = [
[[package]]
name = "v4l2-sys-mit"
version = "0.3.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b"
checksum = "e0c932c06df4af1dfb229f604214f2a87993784596ff33ffdadcba1b5519254e"
dependencies = [
"bindgen 0.65.1",
"bindgen",
]
[[package]]
@ -11120,7 +10964,7 @@ dependencies = [
"libc",
"libloading 0.8.3",
"log",
"metal",
"metal 0.28.0",
"naga",
"ndk-sys 0.5.0+25.2.9519653",
"objc",
@ -11159,18 +11003,6 @@ dependencies = [
"libc",
]
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix 0.38.34",
]
[[package]]
name = "widestring"
version = "1.1.0"
@ -11506,7 +11338,7 @@ dependencies = [
"calloop",
"cfg_aliases",
"core-foundation 0.9.4",
"core-graphics",
"core-graphics 0.23.2",
"cursor-icon",
"icrate",
"js-sys",
@ -11662,17 +11494,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "xattr"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f"
dependencies = [
"libc",
"linux-raw-sys 0.4.14",
"rustix 0.38.34",
]
[[package]]
name = "xcursor"
version = "0.3.5"

View file

@ -98,15 +98,15 @@ tls-api-native-tls = "0.9.0"
tokio-old = {version = "0.2", features = ["full"], package = "tokio" }
tokio-util-old = { version = "0.2", features = ["codec"], package = "tokio-util" }
[target.'cfg(all(not(target_os = "windows"), not(target_os = "android")))'.dependencies]
eye = { version = "0.5.0", default-features = false }
[target.'cfg(target_os = "linux")'.dependencies]
nokhwa = { version = "0.10.4", default-features = false, features = ["input-native"] }
[target.'cfg(target_os = "windows")'.dependencies]
nokhwa = { version = "0.10.4", default-features = false, features = ["input-msmf"] }
[target.'cfg(target_os = "macos")'.dependencies]
nokhwa = { version = "0.10.4", default-features = false, features = ["input-native"] }
tls-api-openssl = "0.9.0"
openpnp_capture_sys = "0.4.0"
[target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.11.3"
@ -128,5 +128,3 @@ eframe = { version = "0.28.1", features = ["wgpu", "android-game-activity"] }
[patch.crates-io]
### patch grin store
#grin_store = { path = "../grin-store" }
### fix cross-compilation support for macos
openpnp_capture_sys = { git = "https://github.com/ardocrat/openpnp-capture-rs", branch = "cross_compilation_support" }

View file

@ -180,8 +180,6 @@ impl Desktop {
}
}
#[allow(dead_code)]
#[cfg(target_os = "windows")]
fn start_camera_capture(stop_camera: Arc<AtomicBool>) {
use nokhwa::Camera;
use nokhwa::pixel_format::RgbFormat;
@ -191,70 +189,31 @@ impl Desktop {
RequestedFormatType::AbsoluteHighestFrameRate
);
// Create and open camera.
let mut camera = Camera::new(index, requested).unwrap();
if let Ok(_) = camera.open_stream() {
loop {
// Stop if camera was stopped.
if stop_camera.load(Ordering::Relaxed) {
stop_camera.store(false, Ordering::Relaxed);
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
if let Ok(mut camera) = Camera::new(index, requested) {
if let Ok(_) = camera.open_stream() {
loop {
// Stop if camera was stopped.
if stop_camera.load(Ordering::Relaxed) {
stop_camera.store(false, Ordering::Relaxed);
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
}
// Get a frame.
if let Ok(frame) = camera.frame() {
// Save image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = Some((frame.buffer().to_vec(), 0));
} else {
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
}
}
// Get a frame.
if let Ok(frame) = camera.frame() {
// Save image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = Some((frame.buffer().to_vec(), 0));
} else {
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
}
}
camera.stop_stream().unwrap();
};
}
#[allow(dead_code)]
#[cfg(not(target_os = "windows"))]
fn start_camera_capture(stop_camera: Arc<AtomicBool>) {
use eye::hal::{traits::{Context, Device, Stream}, PlatformContext};
use image::ImageEncoder;
let ctx = PlatformContext::default();
let devices = ctx.devices().unwrap();
if let Ok(dev) = ctx.open_device(&devices[0].uri) {
let streams = dev.streams().unwrap();
let stream_desc = streams[0].clone();
let w = stream_desc.width;
let h = stream_desc.height;
let mut stream = dev.start_stream(&stream_desc).unwrap();
loop {
// Stop if camera was stopped.
if stop_camera.load(Ordering::Relaxed) {
stop_camera.store(false, Ordering::Relaxed);
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
}
// Get a frame.
let frame = stream.next().expect("Stream is dead").expect("Failed to capture a frame");
let mut out = vec![];
if let Some(buf) = image::ImageBuffer::<image::Rgb<u8>, &[u8]>::from_raw(w, h, &frame) {
image::codecs::jpeg::JpegEncoder::new(&mut out)
.write_image(buf.as_raw(), w, h, image::ExtendedColorType::Rgb8).unwrap();
} else {
out = frame.to_vec();
}
// Save image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = Some((out, 0));
}
let _ = camera.stop_stream();
};
}
}
}

View file

@ -67,6 +67,7 @@ impl CameraContent {
270 => img.rotate270(),
_ => img
};
img = img.fliph();
// Convert to ColorImage to add at content.
let color_img = match &img {
DynamicImage::ImageRgb8(image) => {