camera: desktop support

This commit is contained in:
ardocrat 2024-05-03 22:10:19 +03:00
parent f14a357c9b
commit 7267bf6441
3 changed files with 620 additions and 15 deletions

503
Cargo.lock generated
View file

@ -108,6 +108,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "adler32"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
[[package]] [[package]]
name = "aead" name = "aead"
version = "0.4.3" version = "0.4.3"
@ -145,7 +151,7 @@ dependencies = [
"i18n-embed", "i18n-embed",
"i18n-embed-fl", "i18n-embed-fl",
"lazy_static", "lazy_static",
"nom", "nom 7.1.3",
"pin-project", "pin-project",
"rand 0.7.3", "rand 0.7.3",
"rand 0.8.5", "rand 0.8.5",
@ -167,7 +173,7 @@ dependencies = [
"chacha20poly1305", "chacha20poly1305",
"cookie-factory", "cookie-factory",
"hkdf 0.11.0", "hkdf 0.11.0",
"nom", "nom 7.1.3",
"rand 0.8.5", "rand 0.8.5",
"secrecy 0.8.0", "secrecy 0.8.0",
"sha2 0.9.9", "sha2 0.9.9",
@ -333,6 +339,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
]
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.13" version = "0.6.13"
@ -476,7 +491,7 @@ dependencies = [
"arti-client", "arti-client",
"backtrace", "backtrace",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"clap", "clap 4.5.4",
"derive_builder_fork_arti", "derive_builder_fork_arti",
"educe", "educe",
"fs-mistrust", "fs-mistrust",
@ -922,7 +937,7 @@ dependencies = [
"anyhow", "anyhow",
"arrayvec 0.7.4", "arrayvec 0.7.4",
"log", "log",
"nom", "nom 7.1.3",
"num-rational 0.4.1", "num-rational 0.4.1",
"v_frame", "v_frame",
] ]
@ -1009,6 +1024,75 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b"
[[package]]
name = "bindgen"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
dependencies = [
"bitflags 1.3.2",
"cexpr 0.4.0",
"clang-sys",
"clap 2.34.0",
"env_logger 0.8.4",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2 1.0.81",
"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.81",
"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.81",
"quote 1.0.36",
"regex",
"rustc-hash",
"shlex 1.3.0",
"syn 2.0.60",
"which 4.4.2",
]
[[package]] [[package]]
name = "bit-set" name = "bit-set"
version = "0.5.3" version = "0.5.3"
@ -1338,6 +1422,24 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
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]] [[package]]
name = "cfg-expr" name = "cfg-expr"
version = "0.15.8" version = "0.15.8"
@ -1435,6 +1537,47 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "clang-sys"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1"
dependencies = [
"glob",
"libc",
"libloading 0.8.3",
]
[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term",
"atty",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap 0.11.0",
"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 0.2.4",
"indexmap 1.9.3",
"strsim 0.10.0",
"termcolor",
"textwrap 0.16.1",
]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.4" version = "4.5.4"
@ -1452,11 +1595,20 @@ checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
"clap_lex", "clap_lex 0.7.0",
"strsim 0.11.1", "strsim 0.11.1",
"terminal_size", "terminal_size",
] ]
[[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]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.7.0" version = "0.7.0"
@ -1481,6 +1633,15 @@ dependencies = [
"bitflags 1.3.2", "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]] [[package]]
name = "coarsetime" name = "coarsetime"
version = "0.1.34" version = "0.1.34"
@ -1601,7 +1762,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be" checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"nom", "nom 7.1.3",
"pathdiff", "pathdiff",
"serde", "serde",
"toml 0.8.12", "toml 0.8.12",
@ -2280,6 +2441,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dunce"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
[[package]] [[package]]
name = "dyn-clone" name = "dyn-clone"
version = "1.0.17" version = "1.0.17"
@ -2661,6 +2828,32 @@ dependencies = [
"termcolor", "termcolor",
] ]
[[package]]
name = "env_logger"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
dependencies = [
"atty",
"humantime 2.1.0",
"log",
"regex",
"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]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.10.2" version = "0.10.2"
@ -2788,6 +2981,31 @@ dependencies = [
"zune-inflate", "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",
"jpeg-decoder 0.2.6",
]
[[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]] [[package]]
name = "fake-simd" name = "fake-simd"
version = "0.1.2" version = "0.1.2"
@ -2840,6 +3058,25 @@ dependencies = [
"subtle", "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.18",
]
[[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.18",
]
[[package]] [[package]]
name = "fiat-crypto" name = "fiat-crypto"
version = "0.2.8" version = "0.2.8"
@ -3515,6 +3752,7 @@ dependencies = [
"egui", "egui",
"egui_extras", "egui_extras",
"env_logger 0.10.2", "env_logger 0.10.2",
"eye",
"fs-mistrust", "fs-mistrust",
"futures 0.3.30", "futures 0.3.30",
"grin_api", "grin_api",
@ -4809,6 +5047,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "jpeg-decoder"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b"
dependencies = [
"rayon",
]
[[package]] [[package]]
name = "jpeg-decoder" name = "jpeg-decoder"
version = "0.3.1" version = "0.3.1"
@ -4912,6 +5159,12 @@ dependencies = [
"spin 0.5.2", "spin 0.5.2",
] ]
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "lebe" name = "lebe"
version = "0.5.2" version = "0.5.2"
@ -4924,6 +5177,26 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[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]] [[package]]
name = "libfuzzer-sys" name = "libfuzzer-sys"
version = "0.4.7" version = "0.4.7"
@ -5015,6 +5288,20 @@ dependencies = [
"vcpkg", "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]] [[package]]
name = "libz-sys" name = "libz-sys"
version = "1.1.16" version = "1.1.16"
@ -5387,6 +5674,17 @@ dependencies = [
"winapi 0.3.9", "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]] [[package]]
name = "naga" name = "naga"
version = "0.19.2" version = "0.19.2"
@ -5545,6 +5843,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
version = "5.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b"
dependencies = [
"memchr",
"version_check",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.3" version = "7.1.3"
@ -5900,6 +6208,27 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" 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 = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "210344540125153a623f5b0c8a3880a2aef08bb7c70e92a159574047d7319507"
dependencies = [
"bindgen 0.60.1",
"cc",
"cmake",
]
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.64" version = "0.10.64"
@ -5997,6 +6326,12 @@ dependencies = [
"pin-project-lite 0.2.14", "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]] [[package]]
name = "overload" name = "overload"
version = "0.1.1" version = "0.1.1"
@ -6148,6 +6483,12 @@ dependencies = [
"digest 0.10.7", "digest 0.10.7",
] ]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "pem" name = "pem"
version = "0.8.3" version = "0.8.3"
@ -6392,6 +6733,16 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]]
name = "prettyplease"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550"
dependencies = [
"proc-macro2 1.0.81",
"syn 2.0.60",
]
[[package]] [[package]]
name = "prettytable-rs" name = "prettytable-rs"
version = "0.10.0" version = "0.10.0"
@ -7070,6 +7421,12 @@ dependencies = [
"opaque-debug 0.3.1", "opaque-debug 0.3.1",
] ]
[[package]]
name = "rle-decode-fast"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
[[package]] [[package]]
name = "rlimit" name = "rlimit"
version = "0.10.1" version = "0.10.1"
@ -7755,6 +8112,18 @@ dependencies = [
"dirs 5.0.1", "dirs 5.0.1",
] ]
[[package]]
name = "shlex"
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]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.4.2" version = "1.4.2"
@ -8000,6 +8369,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -8162,6 +8537,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "tar"
version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]] [[package]]
name = "target-lexicon" name = "target-lexicon"
version = "0.12.14" version = "0.12.14"
@ -8231,6 +8617,21 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.59" version = "1.0.59"
@ -8279,7 +8680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [ dependencies = [
"flate2", "flate2",
"jpeg-decoder", "jpeg-decoder 0.3.1",
"weezl", "weezl",
] ]
@ -9879,6 +10280,56 @@ dependencies = [
"serde", "serde",
] ]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8fbfea44a46799d62c55323f3c55d06df722fbe577851d848d328a1041c3403"
dependencies = [
"bitflags 1.3.2",
"libc",
"v4l2-sys-mit",
]
[[package]]
name = "v4l2-sys-mit"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b"
dependencies = [
"bindgen 0.65.1",
]
[[package]] [[package]]
name = "v_frame" name = "v_frame"
version = "0.3.8" version = "0.3.8"
@ -9902,6 +10353,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.2.0" version = "0.2.0"
@ -10339,6 +10796,27 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "which"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
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]] [[package]]
name = "widestring" name = "widestring"
version = "1.1.0" version = "1.1.0"
@ -10806,6 +11284,17 @@ dependencies = [
"zeroize", "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.13",
"rustix 0.38.34",
]
[[package]] [[package]]
name = "xcursor" name = "xcursor"
version = "0.3.5" version = "0.3.5"

View file

@ -84,8 +84,10 @@ built = { version = "0.7.0", features = ["git2"]}
[target.'cfg(not(target_os = "android"))'.dependencies] [target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.10.0" env_logger = "0.10.0"
winit = { version = "0.29.15" } winit = { version = "0.29.15" }
eframe = { version = "0.27.2", features = [ "wgpu" ] } eframe = { version = "0.27.2", features = ["wgpu"] }
arboard = "3.2.0" arboard = "3.2.0"
# camera
eye = "0.5.0"
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.13.1" android_logger = "0.13.1"

View file

@ -12,10 +12,31 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use lazy_static::lazy_static;
use std::sync::{Arc, RwLock};
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
use std::thread;
use eye::hal::PlatformContext;
use eye::hal::traits::{Context, Device, Stream};
use crate::gui::platform::PlatformCallbacks; use crate::gui::platform::PlatformCallbacks;
#[derive(Default)] /// Desktop platform related actions.
pub struct Desktop; pub struct Desktop {
/// Camera index.
camera_index: AtomicI32,
/// Flag to check if camera stop is needed.
stop_camera: Arc<AtomicBool>
}
impl Default for Desktop {
fn default() -> Self {
Self {
camera_index: AtomicI32::new(0),
stop_camera: Arc::new(AtomicBool::new(false))
}
}
}
impl PlatformCallbacks for Desktop { impl PlatformCallbacks for Desktop {
fn show_keyboard(&self) {} fn show_keyboard(&self) {}
@ -32,20 +53,113 @@ impl PlatformCallbacks for Desktop {
clipboard.get_text().unwrap_or("".to_string()) clipboard.get_text().unwrap_or("".to_string())
} }
fn camera_image(&self) -> Option<(Vec<u8>, u32)> {
Some((vec![].into(), 0))
}
fn cameras_amount(&self) -> u32 { fn cameras_amount(&self) -> u32 {
let devices = PlatformContext::default().devices();
if devices.is_ok() {
return devices.unwrap().len() as u32;
}
0 0
} }
fn switch_camera(&self) {
let amount = self.cameras_amount();
if amount < 2 {
return;
}
}
fn start_camera(&self) { fn start_camera(&self) {
// Clear image.
{
let mut w_image = LAST_CAMERA_IMAGE.write().unwrap();
*w_image = None;
}
// Query for available devices.
let devices = PlatformContext::default().devices();
if devices.is_err() {
return;
}
let devices = devices.unwrap();
// Setup camera index.
let saved_index = self.camera_index.load(Ordering::Relaxed);
let camera_index = if devices.len() <= self.camera_index.load(Ordering::Relaxed) as usize {
self.camera_index.store(0, Ordering::Relaxed);
0
} else {
saved_index
};
// Setup stop camera flag.
let stop_camera = self.stop_camera.clone();
stop_camera.store(false, Ordering::Relaxed);
let devices = devices.clone();
// Capture images at separate thread.
thread::spawn(move || {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap()
.block_on(async {
// Open camera.
let context = PlatformContext::default();
if let Ok(dev) = context.open_device(&devices[camera_index as usize].uri) {
let streams = dev.streams().unwrap();
let stream_desc = streams[0].clone();
println!("Camera stream: {:?}", stream_desc);
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);
break;
}
// Get frame.
if let Some(frame) = stream.next() {
// Get data from frame.
if let Ok(frame_data) = frame {
// Save image.
let mut w_image = LAST_CAMERA_IMAGE.write().unwrap();
*w_image = Some((frame_data.to_vec(), 0));
} else {
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write().unwrap();
*w_image = None;
break;
}
} else {
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write().unwrap();
*w_image = None;
break;
}
}
};
});
});
} }
fn stop_camera(&self) { fn stop_camera(&self) {
// Stop camera.
self.stop_camera.store(true, Ordering::Relaxed);
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write().unwrap();
*w_image = None;
} }
fn switch_camera(&self) { fn camera_image(&self) -> Option<(Vec<u8>, u32)> {
let r_image = LAST_CAMERA_IMAGE.read().unwrap();
if r_image.is_some() {
return Some(r_image.clone().unwrap());
}
None
} }
} }
/// Last captured image from started camera.
lazy_static! {
static ref LAST_CAMERA_IMAGE: Arc<RwLock<Option<(Vec<u8>, u32)>>> = Arc::new(RwLock::new(None));
}