diff --git a/Cargo.lock b/Cargo.lock index fa993b4..e591bf4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,7 +166,7 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "lazy_static", - "nom 7.1.3", + "nom", "pin-project", "rand 0.7.3", "rand 0.8.5", @@ -188,7 +188,7 @@ dependencies = [ "chacha20poly1305", "cookie-factory", "hkdf 0.11.0", - "nom 7.1.3", + "nom", "rand 0.8.5", "secrecy 0.8.0", "sha2 0.9.9", @@ -331,15 +331,6 @@ dependencies = [ "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]] name = "anstream" version = "0.6.15" @@ -408,7 +399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" dependencies = [ "clipboard-win", - "core-graphics", + "core-graphics 0.23.2", "image", "log", "objc2", @@ -559,7 +550,7 @@ dependencies = [ "asn1-rs-derive", "asn1-rs-impl", "displaydoc", - "nom 7.1.3", + "nom", "num-traits 0.2.19", "rusticata-macros", "thiserror 2.0.11", @@ -870,17 +861,6 @@ dependencies = [ "zvariant", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi 0.3.9", -] - [[package]] name = "autocfg" version = "0.1.8" @@ -905,7 +885,7 @@ dependencies = [ "anyhow", "arrayvec 0.7.6", "log", - "nom 7.1.3", + "nom", "num-rational 0.4.2", "v_frame", ] @@ -1016,52 +996,6 @@ dependencies = [ "serde", ] -[[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.93", - "quote 1.0.37", - "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.93", - "quote 1.0.37", - "regex", - "rustc-hash", - "shlex 1.3.0", - "which 4.4.2", -] - [[package]] name = "bindgen" version = "0.65.1" @@ -1069,7 +1003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ "bitflags 1.3.2", - "cexpr 0.6.0", + "cexpr", "clang-sys", "lazy_static", "lazycell", @@ -1080,9 +1014,9 @@ dependencies = [ "quote 1.0.37", "regex", "rustc-hash", - "shlex 1.3.0", + "shlex", "syn 2.0.96", - "which 4.4.2", + "which", ] [[package]] @@ -1395,7 +1329,7 @@ checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", - "shlex 1.3.0", + "shlex", ] [[package]] @@ -1404,22 +1338,13 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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", + "nom", ] [[package]] @@ -1536,45 +1461,6 @@ dependencies = [ "libloading", ] -[[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", - "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.4.0" @@ -1593,15 +1479,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "cmake" -version = "0.1.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" -dependencies = [ - "cc", -] - [[package]] name = "coarsetime" version = "0.1.34" @@ -1613,6 +1490,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" @@ -1766,6 +1672,18 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[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" @@ -1790,6 +1708,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.14" @@ -2138,7 +2081,7 @@ dependencies = [ "asn1-rs", "cookie-factory", "displaydoc", - "nom 7.1.3", + "nom", "num-traits 0.2.19", "rusticata-macros", ] @@ -2483,6 +2426,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.17" @@ -2840,32 +2789,6 @@ dependencies = [ "regex", ] -[[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.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.11.5" @@ -2959,28 +2882,6 @@ dependencies = [ "zune-inflate", ] -[[package]] -name = "eye" -version = "0.5.0" -source = "git+https://github.com/raymanfx/eye-rs?rev=5b7e3f7a1e79966091692896c568aab042e449ef#5b7e3f7a1e79966091692896c568aab042e449ef" -dependencies = [ - "eye-hal", - "ffimage", - "ffimage_yuv", -] - -[[package]] -name = "eye-hal" -version = "0.2.0" -source = "git+https://github.com/raymanfx/eye-rs?rev=5b7e3f7a1e79966091692896c568aab042e449ef#5b7e3f7a1e79966091692896c568aab042e449ef" -dependencies = [ - "bitflags 2.9.0", - "openpnp_capture", - "openpnp_capture_sys", - "uvc", - "v4l", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -3024,25 +2925,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" @@ -3155,6 +3037,9 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ + "futures-core", + "futures-sink", + "nanorand", "spin 0.9.8", ] @@ -3724,8 +3609,7 @@ dependencies = [ "eframe", "egui", "egui_extras", - "env_logger 0.11.5", - "eye", + "env_logger", "fs-mistrust", "futures 0.3.31", "gif", @@ -3750,7 +3634,8 @@ dependencies = [ "lazy_static", "local-ip-address", "log", - "nokhwa", + "nokhwa 0.10.5", + "nokhwa 0.10.7", "openssl-sys", "parking_lot 0.12.3", "pin-project", @@ -4350,15 +4235,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.9" @@ -5460,6 +5336,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.29.0" @@ -5622,6 +5513,31 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "mozjpeg" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "969e1dbc9af2f18ffe6ddba72bbe86506c7214ecb28670d98ecfba51cb9b8c6b" +dependencies = [ + "arrayvec 0.7.6", + "bytemuck", + "libc", + "mozjpeg-sys", + "rgb", +] + +[[package]] +name = "mozjpeg-sys" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f0dc668bf9bf888c88e2fb1ab16a406d2c380f1d082b20d51dd540ab2aa70c1" +dependencies = [ + "cc", + "dunce", + "libc", + "nasm-rs", +] + [[package]] name = "naga" version = "22.1.0" @@ -5643,6 +5559,24 @@ dependencies = [ "unicode-xid 0.2.6", ] +[[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 = "nasm-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12fcfa1bd49e0342ec1d07ed2be83b59963e7acbeb9310e1bb2c07b69dadd959" +dependencies = [ + "jobserver", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -5775,28 +5709,58 @@ dependencies = [ "image", "nokhwa-bindings-linux", "nokhwa-bindings-windows", - "nokhwa-core", + "nokhwa-core 0.1.3", "paste", "thiserror 1.0.64", ] +[[package]] +name = "nokhwa" +version = "0.10.7" +source = "git+https://github.com/l1npengtul/nokhwa?rev=612c861ef153cf0ee575d8dd1413b960e4e19dd6#612c861ef153cf0ee575d8dd1413b960e4e19dd6" +dependencies = [ + "flume", + "image", + "nokhwa-bindings-macos", + "nokhwa-core 0.1.5", + "parking_lot 0.12.3", + "paste", + "thiserror 2.0.11", +] + [[package]] name = "nokhwa-bindings-linux" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f1abe593709a177b1a6b87ebbae0bfe5ecc2f8d80d81e89e0a9b68487490a01" dependencies = [ - "nokhwa-core", + "nokhwa-core 0.1.3", "v4l", ] +[[package]] +name = "nokhwa-bindings-macos" +version = "0.2.2" +source = "git+https://github.com/l1npengtul/nokhwa?rev=612c861ef153cf0ee575d8dd1413b960e4e19dd6#612c861ef153cf0ee575d8dd1413b960e4e19dd6" +dependencies = [ + "block", + "cocoa-foundation", + "core-foundation 0.9.4", + "core-media-sys", + "core-video-sys", + "flume", + "nokhwa-core 0.1.5", + "objc", + "once_cell", +] + [[package]] name = "nokhwa-bindings-windows" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6f82cd46134e24bbfe344280603fc9753b5a589ab6c62959e2b0cf2f906bef1" dependencies = [ - "nokhwa-core", + "nokhwa-core 0.1.3", "once_cell", "windows 0.43.0", ] @@ -5813,13 +5777,14 @@ dependencies = [ ] [[package]] -name = "nom" -version = "5.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b" +name = "nokhwa-core" +version = "0.1.5" +source = "git+https://github.com/l1npengtul/nokhwa?rev=612c861ef153cf0ee575d8dd1413b960e4e19dd6#612c861ef153cf0ee575d8dd1413b960e4e19dd6" dependencies = [ - "memchr", - "version_check", + "bytes 1.7.2", + "image", + "mozjpeg", + "thiserror 2.0.11", ] [[package]] @@ -6069,6 +6034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", + "objc_exception", ] [[package]] @@ -6274,6 +6240,15 @@ dependencies = [ "objc2-foundation", ] +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + [[package]] name = "object" version = "0.36.5" @@ -6310,26 +6285,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 = "git+https://github.com/ardocrat/openpnp-capture-rs?rev=f9b06f627c5e5d42c672d117650af700846ca6cf#f9b06f627c5e5d42c672d117650af700846ca6cf" -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]] name = "openssl" version = "0.10.66" @@ -7737,7 +7692,7 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" dependencies = [ - "nom 7.1.3", + "nom", ] [[package]] @@ -8241,12 +8196,6 @@ dependencies = [ "os_str_bytes", ] -[[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" @@ -8502,12 +8451,6 @@ dependencies = [ "float-cmp", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.10.0" @@ -8718,21 +8661,6 @@ dependencies = [ "winapi-util", ] -[[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]] name = "thiserror" version = "1.0.64" @@ -10557,24 +10485,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" -[[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-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3675c448fbdc98cbdc4f755a541d41154d153eb3112686be533940ae925eb00" -dependencies = [ - "bindgen 0.56.0", -] - [[package]] name = "v4l" version = "0.14.0" @@ -10592,7 +10502,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6779878362b9bacadc7893eac76abe69612e8837ef746573c4a5239daf11990b" dependencies = [ - "bindgen 0.65.1", + "bindgen", ] [[package]] @@ -10618,12 +10528,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version-compare" version = "0.2.0" @@ -11016,7 +10920,7 @@ dependencies = [ "libc", "libloading", "log", - "metal", + "metal 0.29.0", "naga", "ndk-sys 0.5.0+25.2.9519653", "objc", @@ -11046,15 +10950,6 @@ dependencies = [ "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" @@ -11444,7 +11339,7 @@ dependencies = [ "cfg_aliases 0.2.1", "concurrent-queue", "core-foundation 0.9.4", - "core-graphics", + "core-graphics 0.23.2", "cursor-icon", "dpi", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index aebe1e7..d2b6473 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,7 +107,7 @@ nokhwa = { version = "0.10.5", default-features = false, features = ["input-v4l" nokhwa = { version = "0.10.5", default-features = false, features = ["input-msmf"] } [target.'cfg(target_os = "macos")'.dependencies] -eye = { git = "https://github.com/raymanfx/eye-rs", rev = "5b7e3f7a1e79966091692896c568aab042e449ef", default-features = false } +nokhwa-mac = { git = "https://github.com/l1npengtul/nokhwa", rev = "612c861ef153cf0ee575d8dd1413b960e4e19dd6", features = ["input-avfoundation", "output-threaded"], package = "nokhwa" } [target.'cfg(not(target_os = "android"))'.dependencies] env_logger = "0.11.3" @@ -126,7 +126,6 @@ winit = { version = "0.30.5", features = ["android-game-activity"] } eframe = { version = "0.29.1", features = ["wgpu", "android-game-activity"] } [patch.crates-io] -openpnp_capture = { git = "https://github.com/ardocrat/openpnp-capture-rs", rev = "f9b06f627c5e5d42c672d117650af700846ca6cf" } egui_extras = { git = "https://github.com/emilk/egui", rev = "5b846b4554fe47269affb43efef2cad8710a8a47" } egui = { git = "https://github.com/emilk/egui", rev = "5b846b4554fe47269affb43efef2cad8710a8a47" } eframe = { git = "https://github.com/emilk/egui", rev = "5b846b4554fe47269affb43efef2cad8710a8a47" } diff --git a/src/gui/platform/desktop/mod.rs b/src/gui/platform/desktop/mod.rs index ecbafb8..a9bba5a 100644 --- a/src/gui/platform/desktop/mod.rs +++ b/src/gui/platform/desktop/mod.rs @@ -52,7 +52,7 @@ impl Desktop { } } - #[allow(dead_code)] + // #[allow(dead_code)] #[cfg(not(target_os = "macos"))] fn start_camera_capture(cameras_amount: Arc, camera_index: Arc, @@ -109,52 +109,56 @@ impl Desktop { fn start_camera_capture(cameras_amount: Arc, camera_index: Arc, stop_camera: Arc) { - use image::{ExtendedColorType, ImageBuffer, ImageEncoder, Rgb}; - use eye::hal::{traits::{Context, Device, Stream}, PlatformContext}; - use image::codecs::jpeg::JpegEncoder; + use nokhwa_mac::nokhwa_initialize; + use nokhwa_mac::pixel_format::RgbFormat; + use nokhwa_mac::utils::{CameraIndex, RequestedFormat, RequestedFormatType}; + use nokhwa_mac::utils::ApiBackend; + use nokhwa_mac::query; + use nokhwa_mac::CallbackCamera; - let index = camera_index.load(Ordering::Relaxed); - let devices = PlatformContext::default().devices().unwrap_or(vec![]); - cameras_amount.store(devices.len(), Ordering::Relaxed); - if devices.is_empty() || index >= devices.len() { - return; - } + // Ask permission to open camera. + nokhwa_initialize(|_| {}); - // Capture images at separate thread. - let uri = devices[camera_index.load(Ordering::Relaxed)].uri.clone(); thread::spawn(move || { - if let Ok(dev) = PlatformContext::default().open_device(&uri) { - let streams = dev.streams().unwrap_or(vec![]); - if streams.is_empty() { - return; - } - let stream_desc = streams[0].clone(); - let w = stream_desc.width; - let h = stream_desc.height; - if let Ok(mut stream) = dev.start_stream(&stream_desc) { + let cameras = query(ApiBackend::Auto).unwrap(); + cameras_amount.store(cameras.len(), Ordering::Relaxed); + let index = camera_index.load(Ordering::Relaxed); + if cameras.is_empty() || index >= cameras.len() { + return; + } + // Start camera. + let camera_index = CameraIndex::Index(camera_index.load(Ordering::Relaxed) as u32); + let camera_callback = CallbackCamera::new( + camera_index, + RequestedFormat::new::(RequestedFormatType::AbsoluteHighestFrameRate), + |_| {} + ); + if let Ok(mut cb) = camera_callback { + if cb.open_stream().is_ok() { 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. - let frame = stream.next() - .expect("Stream is dead") - .expect("Failed to capture a frame"); - let mut out = vec![]; - if let Some(buf) = ImageBuffer::, &[u8]>::from_raw(w, h, &frame) { - JpegEncoder::new(&mut out) - .write_image(buf.as_raw(), w, h, ExtendedColorType::Rgb8) - .unwrap_or_default(); + // Get image from camera. + if let Ok(frame) = cb.poll_frame() { + let image = frame.decode_image::().unwrap(); + let mut bytes: Vec = Vec::new(); + let format = image::ImageFormat::Jpeg; + // Convert image to Jpeg format. + image.write_to(&mut std::io::Cursor::new(&mut bytes), format).unwrap(); + let mut w_image = LAST_CAMERA_IMAGE.write(); + *w_image = Some((bytes, 0)); } else { - out = frame.to_vec(); + // Clear image. + let mut w_image = LAST_CAMERA_IMAGE.write(); + *w_image = None; + break; } - // Save image. - let mut w_image = LAST_CAMERA_IMAGE.write(); - *w_image = Some((out, 0)); } } }