From 32c8a9eff486020bf2b8a65837764f16c9093338 Mon Sep 17 00:00:00 2001 From: l1npengtul Date: Thu, 28 Mar 2024 14:28:31 +0900 Subject: [PATCH] new frame rate type - update deps --- Cargo.lock | 586 +++++++++++++++++++++++++++--- nokhwa-core/Cargo.toml | 8 +- nokhwa-core/src/format_request.rs | 108 +++++- nokhwa-core/src/frame_format.rs | 29 +- nokhwa-core/src/types.rs | 45 ++- 5 files changed, 679 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48fcdd2..5711e09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,11 +302,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -507,12 +508,43 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" +dependencies = [ + "com_macros", +] + [[package]] name = "com-rs" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" +[[package]] +name = "com_macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" +dependencies = [ + "com_macros_support", + "proc-macro2", + "syn 1.0.103", +] + +[[package]] +name = "com_macros_support" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.103", +] + [[package]] name = "core-foundation" version = "0.6.4" @@ -790,6 +822,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "d3d12" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" +dependencies = [ + "bitflags 2.3.3", + "libloading 0.8.0", + "winapi", +] + [[package]] name = "darling" version = "0.13.4" @@ -843,6 +886,17 @@ dependencies = [ "nokhwa-core", ] +[[package]] +name = "derive_destructure2" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64b697ac90ff296f0fc031ee5a61c7ac31fb9fff50e3fb32873b09223613fc0c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.55", +] + [[package]] name = "directories" version = "4.0.1" @@ -923,6 +977,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.2.8" @@ -1265,6 +1325,17 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + [[package]] name = "glam" version = "0.21.3" @@ -1304,6 +1375,27 @@ dependencies = [ "web-sys", ] +[[package]] +name = "glow" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +dependencies = [ + "gl_generator", +] + [[package]] name = "glyph_brush" version = "0.7.5" @@ -1394,6 +1486,19 @@ dependencies = [ "windows 0.44.0", ] +[[package]] +name = "gpu-allocator" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" +dependencies = [ + "log", + "presser", + "thiserror", + "winapi", + "windows 0.52.0", +] + [[package]] name = "gpu-descriptor" version = "0.2.3" @@ -1402,7 +1507,7 @@ checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ "bitflags 1.3.2", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1432,6 +1537,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "hassle-rs" version = "0.10.0" @@ -1447,6 +1558,21 @@ dependencies = [ "winapi", ] +[[package]] +name = "hassle-rs" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" +dependencies = [ + "bitflags 2.3.3", + "com", + "libc", + "libloading 0.8.0", + "thiserror", + "widestring", + "winapi", +] + [[package]] name = "heck" version = "0.4.0" @@ -1522,6 +1648,17 @@ dependencies = [ "tiff", ] +[[package]] +name = "image" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9b4f005360d32e9325029b38ba47ebd7a56f3316df09249368939562d518645" +dependencies = [ + "bytemuck", + "byteorder", + "num-traits", +] + [[package]] name = "indenter" version = "0.3.3" @@ -1535,7 +1672,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", ] [[package]] @@ -1603,6 +1750,20 @@ dependencies = [ "libc", ] +[[package]] +name = "jobslot" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0303fc691930667d6fd0b2cd194f9d6b37be3d890e0b89cf4a34e27231f35c4f" +dependencies = [ + "cfg-if 1.0.0", + "derive_destructure2", + "getrandom", + "libc", + "scopeguard", + "windows-sys 0.52.0", +] + [[package]] name = "jpeg-decoder" version = "0.3.0" @@ -1614,9 +1775,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1632,6 +1793,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading 0.8.0", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1879,6 +2057,21 @@ dependencies = [ "paste", ] +[[package]] +name = "metal" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +dependencies = [ + "bitflags 2.3.3", + "block", + "core-graphics-types", + "foreign-types 0.5.0", + "log", + "objc", + "paste", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1955,11 +2148,11 @@ dependencies = [ "bitflags 1.3.2", "codespan-reporting", "hexf-parse", - "indexmap", + "indexmap 1.9.2", "log", "num-traits", "rustc-hash", - "spirv", + "spirv 0.2.0+1.5.4", "termcolor", "thiserror", "unicode-xid", @@ -1975,11 +2168,31 @@ dependencies = [ "bitflags 2.3.3", "codespan-reporting", "hexf-parse", - "indexmap", + "indexmap 1.9.2", "log", "num-traits", "rustc-hash", - "spirv", + "spirv 0.2.0+1.5.4", + "termcolor", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "naga" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e3524642f53d9af419ab5e8dd29d3ba155708267667c2f3f06c88c9e130843" +dependencies = [ + "bit-set", + "bitflags 2.3.3", + "codespan-reporting", + "hexf-parse", + "indexmap 2.2.6", + "log", + "num-traits", + "rustc-hash", + "spirv 0.3.0+sdk-1.3.268.0", "termcolor", "thiserror", "unicode-xid", @@ -2008,7 +2221,7 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags 1.3.2", "jni-sys", - "ndk-sys", + "ndk-sys 0.4.1+23.1.7779620", "num_enum", "raw-window-handle 0.5.0", "thiserror", @@ -2031,7 +2244,7 @@ dependencies = [ "ndk", "ndk-context", "ndk-macro", - "ndk-sys", + "ndk-sys 0.4.1+23.1.7779620", "once_cell", "parking_lot", ] @@ -2058,6 +2271,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + [[package]] name = "nix" version = "0.24.2" @@ -2097,7 +2319,7 @@ dependencies = [ "nokhwa-bindings-macos", "nokhwa-bindings-windows", "nokhwa-core", - "opencv", + "opencv 0.84.3", "paste", "regex", "rgb", @@ -2149,13 +2371,13 @@ version = "0.2.0" dependencies = [ "async-trait", "bytes", - "image 0.24.5", + "image 0.25.0", "mozjpeg", - "opencv", + "opencv 0.89.0", "paste", "serde", "thiserror", - "wgpu 0.17.1", + "wgpu 0.19.3", ] [[package]] @@ -2305,15 +2527,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opencv" -version = "0.84.5" +version = "0.84.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a097f79e4a6ec571f5765c5020f7dbe77d22b9b8dde01c647098fcd2be3895c" +checksum = "a481f80995863875793f475d8fc1cabbf648e312bf359d05d415f3ffd38bfe6e" dependencies = [ "cc", "dunce", @@ -2321,19 +2543,52 @@ dependencies = [ "libc", "num-traits", "once_cell", - "opencv-binding-generator", + "opencv-binding-generator 0.71.0", "pkg-config", "rgb", "semver", - "shlex 1.1.0", + "shlex 1.3.0", "vcpkg", ] +[[package]] +name = "opencv" +version = "0.89.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38147846b39e60b686bf8f5bd289b0a667c5bb629e37c88569339a07dab97970" +dependencies = [ + "cc", + "dunce", + "jobslot", + "libc", + "num-traits", + "once_cell", + "opencv-binding-generator 0.85.0", + "pkg-config", + "semver", + "shlex 1.3.0", + "vcpkg", +] + +[[package]] +name = "opencv-binding-generator" +version = "0.71.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aaaa0844329835a9f2fa2851754f0881a64d2a44142d7a6d27362c2f8a449ea" +dependencies = [ + "clang", + "clang-sys", + "dunce", + "once_cell", + "percent-encoding", + "regex", +] + [[package]] name = "opencv-binding-generator" -version = "0.72.0" +version = "0.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e674c5d4d124421a4980fa8533bafd15e07dec30acca5c1b38c055ba234a2cf" +checksum = "f742feaf7cbc1279aea73d7bf0834896ca5f226cc9230d212e5092440776b81c" dependencies = [ "clang", "clang-sys", @@ -2476,6 +2731,12 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -2513,9 +2774,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -2539,9 +2800,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2600,6 +2861,12 @@ dependencies = [ "cty", ] +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + [[package]] name = "rayon" version = "1.6.0" @@ -2856,9 +3123,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "shlex" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "skeptic" @@ -2948,6 +3215,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "spirv" +version = "0.3.0+sdk-1.3.268.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" +dependencies = [ + "bitflags 2.3.3", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -2979,9 +3255,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -3004,9 +3280,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -3022,22 +3298,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.103", + "syn 2.0.55", ] [[package]] @@ -3290,9 +3566,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3300,24 +3576,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.55", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3327,9 +3603,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3337,22 +3613,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-rs-async-executor" @@ -3438,9 +3714,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -3498,6 +3774,31 @@ dependencies = [ "wgpu-types 0.17.0", ] +[[package]] +name = "wgpu" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1213b52478a7631d6e387543ed8f642bc02c578ef4e3b49aca2a29a7df0cb" +dependencies = [ + "arrayvec 0.7.2", + "cfg-if 1.0.0", + "cfg_aliases", + "js-sys", + "log", + "naga 0.19.2", + "parking_lot", + "profiling", + "raw-window-handle 0.6.0", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 0.19.3", + "wgpu-hal 0.19.3", + "wgpu-types 0.19.2", +] + [[package]] name = "wgpu-core" version = "0.14.0" @@ -3545,6 +3846,32 @@ dependencies = [ "wgpu-types 0.17.0", ] +[[package]] +name = "wgpu-core" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f6b033c2f00ae0bc8ea872c5989777c60bc241aac4e58b24774faa8b391f78" +dependencies = [ + "arrayvec 0.7.2", + "bit-vec", + "bitflags 2.3.3", + "cfg_aliases", + "codespan-reporting", + "indexmap 2.2.6", + "log", + "naga 0.19.2", + "once_cell", + "parking_lot", + "profiling", + "raw-window-handle 0.6.0", + "rustc-hash", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal 0.19.3", + "wgpu-types 0.19.2", +] + [[package]] name = "wgpu-hal" version = "0.14.1" @@ -3565,7 +3892,7 @@ dependencies = [ "gpu-alloc 0.5.3", "gpu-descriptor", "js-sys", - "khronos-egl", + "khronos-egl 4.1.0", "libloading 0.7.4", "log", "metal 0.24.0", @@ -3600,11 +3927,11 @@ dependencies = [ "d3d12 0.7.0", "glow 0.12.3", "gpu-alloc 0.6.0", - "gpu-allocator", + "gpu-allocator 0.22.0", "gpu-descriptor", - "hassle-rs", + "hassle-rs 0.10.0", "js-sys", - "khronos-egl", + "khronos-egl 4.1.0", "libc", "libloading 0.8.0", "log", @@ -3625,6 +3952,51 @@ dependencies = [ "winapi", ] +[[package]] +name = "wgpu-hal" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f972c280505ab52ffe17e94a7413d9d54b58af0114ab226b9fc4999a47082e" +dependencies = [ + "android_system_properties", + "arrayvec 0.7.2", + "ash", + "bit-set", + "bitflags 2.3.3", + "block", + "cfg_aliases", + "core-graphics-types", + "d3d12 0.19.0", + "glow 0.13.1", + "glutin_wgl_sys", + "gpu-alloc 0.6.0", + "gpu-allocator 0.25.0", + "gpu-descriptor", + "hassle-rs 0.11.0", + "js-sys", + "khronos-egl 6.0.0", + "libc", + "libloading 0.8.0", + "log", + "metal 0.27.0", + "naga 0.19.2", + "ndk-sys 0.5.0+25.2.9519653", + "objc", + "once_cell", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle 0.6.0", + "renderdoc-sys 1.0.0", + "rustc-hash", + "smallvec", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types 0.19.2", + "winapi", +] + [[package]] name = "wgpu-types" version = "0.14.1" @@ -3645,6 +4017,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu-types" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b671ff9fb03f78b46ff176494ee1ebe7d603393f42664be55b64dc8d53969805" +dependencies = [ + "bitflags 2.3.3", + "js-sys", + "web-sys", +] + [[package]] name = "which" version = "3.1.1" @@ -3715,6 +4098,25 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.36.1" @@ -3752,6 +4154,15 @@ dependencies = [ "windows-targets 0.48.1", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -3782,6 +4193,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -3794,6 +4220,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" @@ -3812,6 +4244,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + [[package]] name = "windows_i686_gnu" version = "0.36.1" @@ -3830,6 +4268,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + [[package]] name = "windows_i686_msvc" version = "0.36.1" @@ -3848,6 +4292,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" @@ -3866,6 +4316,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -3878,6 +4334,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -3896,6 +4358,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + [[package]] name = "winit" version = "0.27.5" diff --git a/nokhwa-core/Cargo.toml b/nokhwa-core/Cargo.toml index 92e18d7..1875673 100644 --- a/nokhwa-core/Cargo.toml +++ b/nokhwa-core/Cargo.toml @@ -26,7 +26,7 @@ bytes = "1.3" paste = "1.0" [dependencies.image] -version = "0.24" +version = "0.25" default-features = false [dependencies.serde] @@ -35,16 +35,16 @@ features = ["derive"] optional = true [dependencies.wgpu] -version = "0.17" +version = "0.19" optional = true [dependencies.opencv] -version = "0.84" +version = "0.89.0" default-features = false optional = true [dependencies.mozjpeg] -version = "0.9" +version = "0.10" optional = true [dependencies.async-trait] diff --git a/nokhwa-core/src/format_request.rs b/nokhwa-core/src/format_request.rs index 838be1b..a4e219b 100644 --- a/nokhwa-core/src/format_request.rs +++ b/nokhwa-core/src/format_request.rs @@ -1,11 +1,10 @@ -use crate::frame_format::SourceFrameFormat; -use crate::types::Range; +use std::collections::{BTreeMap, BTreeSet}; +use crate::types::{FrameRate, Range}; use crate::{ frame_format::FrameFormat, - types::{ApiBackend, CameraFormat, Resolution}, + types::{ CameraFormat, Resolution}, }; use paste::paste; -use std::collections::{BTreeMap, BTreeSet}; macro_rules! range_set_fields { ($(($range_type:ty, $name:ident),)*) => { @@ -136,7 +135,7 @@ macro_rules! range_set_fields { #[derive(Copy, Clone, Debug, Hash, Ord, PartialOrd, Eq, PartialEq)] pub enum CustomFormatRequestType { - HighestFPS, + HighestFrameRate, HighestResolution, Closest, } @@ -144,7 +143,7 @@ pub enum CustomFormatRequestType { #[derive(Clone, Debug, Default, PartialOrd, PartialEq)] pub struct FormatRequest { resolution: Option>, - frame_rate: Option>, + frame_rate: Option>, frame_format: Option>, req_type: Option, } @@ -205,14 +204,95 @@ impl FormatRequest { self.req_type = None; self } -} -range_set_fields!((Resolution, resolution), (u32, frame_rate),); + pub fn satisfied_by_format(&self, format: &CameraFormat) -> bool { + // check resolution + let resolution_satisfied = match self.resolution { + Some(res_range) => res_range.in_range(format.resolution()), + None => true, + }; + + let frame_rate_satisfied = match self.frame_rate { + Some(fps_range) => fps_range.in_range(format.frame_rate()), + None => true, + }; + + let frame_format_satisfied = match &self.frame_format { + Some(frame_formats) => frame_formats.contains(&format.format()), + None => true, + }; + + // we ignore custom bc that only makes sense in multiple formats + + resolution_satisfied && frame_rate_satisfied && frame_format_satisfied + } + + pub fn resolve(&self, list_of_formats: &[CameraFormat]) -> CameraFormat { + let mut remaining_formats = list_of_formats.iter().filter(|x| self.satisfied_by_format(*x)).collect::>(); + match self.req_type { + Some(request) => { + match request { + CustomFormatRequestType::HighestFrameRate => { + remaining_formats.sort_by(|a, b| { + a.frame_rate().cmp(&b.frame_rate()) + }); + remaining_formats[0] + } + CustomFormatRequestType::HighestResolution => { + remaining_formats.sort_by(|a, b| { + a.resolution().cmp(&b.resolution()) + }); + remaining_formats[0] + } + CustomFormatRequestType::Closest => { + enum ClosestType { + Resolution, + FrameRate, + Both, + None, + } + let mut closest_type = ClosestType::Resolution; + + if let None = self.resolution { + closest_type = ClosestType::FrameRate + } + + if let None = self.frame_rate { + if closest_type == ClosestType::FrameRate { + closest_type = ClosestType::None; + } + closest_type = ClosestType::Resolution + } else { + if ClosestType::Resolution { + closest_type = ClosestType::Both + } + } + -// tomorrow wont come for those without FRAME FORMATS -pub fn resolve_format_request( - request: FormatRequest, - availible_formats: Vec, -) -> CameraFormat { - // filter out by parts first + match closest_type { + ClosestType::Resolution => { + let resolution_point = self.resolution.unwrap().preferred(); + } + ClosestType::FrameRate => { + let frame_rate_point = self.frame_rate.unwrap().preferred(); + } + ClosestType::Both => { + let resolution_point = self.resolution.unwrap().preferred(); + let frame_rate_point = self.frame_rate.unwrap().preferred(); + + } + ClosestType::None => { + remaining_formats[0] + } + } + } + } + } + None => { + remaining_formats[0] + } + } + } } + +range_set_fields!((Resolution, resolution), (FrameRate, frame_rate),); diff --git a/nokhwa-core/src/frame_format.rs b/nokhwa-core/src/frame_format.rs index b81fc08..5ce25c4 100644 --- a/nokhwa-core/src/frame_format.rs +++ b/nokhwa-core/src/frame_format.rs @@ -52,6 +52,7 @@ pub enum FrameFormat { // Grayscale Formats Luma8, + Luma16, // RGB Formats Rgb8, @@ -81,6 +82,7 @@ impl FrameFormat { FrameFormat::Nv21, FrameFormat::Yv12, FrameFormat::Luma8, + FrameFormat::Luma16, FrameFormat::Rgb8, FrameFormat::RgbA8, ]; @@ -107,9 +109,34 @@ impl FrameFormat { FrameFormat::Yv12, ]; - pub const LUMA: &'static [FrameFormat] = &[FrameFormat::Luma8]; + pub const LUMA: &'static [FrameFormat] = &[FrameFormat::Luma8, FrameFormat::Luma16]; pub const RGB: &'static [FrameFormat] = &[FrameFormat::Rgb8, FrameFormat::RgbA8]; + + pub const COLOR_FORMATS: &'static [FrameFormat] = &[ + FrameFormat::H265, + FrameFormat::H264, + FrameFormat::H263, + FrameFormat::Avc1, + FrameFormat::Mpeg1, + FrameFormat::Mpeg2, + FrameFormat::Mpeg4, + FrameFormat::MJpeg, + FrameFormat::XVid, + FrameFormat::VP8, + FrameFormat::VP9, + FrameFormat::Yuv422, + FrameFormat::Uyv422, + FrameFormat::Nv12, + FrameFormat::Nv21, + FrameFormat::Yv12, + FrameFormat::Rgb8, + FrameFormat::RgbA8, + ]; + + pub const GRAYSCALE: &'static [FrameFormat] = { + FrameFormat::Luma8 + } } impl Display for FrameFormat { diff --git a/nokhwa-core/src/types.rs b/nokhwa-core/src/types.rs index 9e465b6..929b0a9 100644 --- a/nokhwa-core/src/types.rs +++ b/nokhwa-core/src/types.rs @@ -20,25 +20,25 @@ where lower_inclusive: bool, maximum: Option, upper_inclusive: bool, - preferred: T, + preferred: Option, } impl Range where T: Copy + Clone + Debug + PartialOrd + PartialEq, { - pub fn new(preferred: T, min: Option, max: Option) -> Self { + pub fn new(preferred: Option, min: Option, max: Option) -> Self { Self { minimum: min, lower_inclusive: true, maximum: max, - upper_inclusive: false, + upper_inclusive: true, preferred, } } pub fn with_inclusive( - preferred: T, + preferred: Option, min: Option, lower_inclusive: bool, max: Option, @@ -58,14 +58,16 @@ where minimum: None, lower_inclusive: true, maximum: None, - upper_inclusive: false, - preferred, + upper_inclusive: true, + preferred: Some(preferred), } } - pub fn does_fit(&self, item: T) -> bool { - if item == self.preferred { - true + pub fn in_range(&self, item: T) -> bool { + if let Some(pref) = self.preferred { + if pref == item { + return true + } } if let Some(min) = self.minimum { @@ -107,9 +109,12 @@ where self.upper_inclusive = upper_inclusive; } pub fn set_preferred(&mut self, preferred: T) { - self.preferred = preferred; + self.preferred = Some(preferred); } + pub fn reset_preferred(&mut self) { + self.preferred = None + } pub fn minimum(&self) -> Option { self.minimum } @@ -122,7 +127,7 @@ where pub fn upper_inclusive(&self) -> bool { self.upper_inclusive } - pub fn preferred(&self) -> T { + pub fn preferred(&self) -> Option { self.preferred } } @@ -136,12 +141,14 @@ where minimum: None, lower_inclusive: true, maximum: None, - upper_inclusive: false, - preferred: T::default(), + upper_inclusive: true, + preferred: None, } } } + + /// Describes the index of the camera. /// - Index: A numbered index /// - String: A string, used for `IPCameras`. @@ -337,16 +344,16 @@ impl FrameRate { pub fn as_float(&self) -> f32 { match self { - FrameRate::Integer(fps) => fps as f32, + FrameRate::Integer(fps) => *fps as f32, FrameRate::Float(fps) => fps, - FrameRate::Fraction { numerator, denominator } => (numerator as f32) / (denominator as f32) + FrameRate::Fraction { numerator, denominator } => (*numerator as f32) / (*denominator as f32) } } pub fn as_u32(&self) -> u32 { match self { FrameRate::Integer(fps) => *fps, - FrameRate::Float(fps) => fps as u32, + FrameRate::Float(fps) => *fps as u32, FrameRate::Fraction { numerator, denominator } => numerator / denominator, } } @@ -536,7 +543,7 @@ impl CameraInfo { human_name: human_name.to_string(), description: description.to_string(), misc: misc.to_string(), - index, + index: index.clone(), } } @@ -919,8 +926,8 @@ impl ControlValueDescription { Some(v) => *v.0 >= max.0 && *v.1 >= max.1 && *v.2 >= max.2, None => false, }, - ControlValueDescription::StringList { value, availible } => { - availible.contains(setter.as_str()) + ControlValueDescription::StringList { availible, .. } => { + availible.contains(&(setter.as_str().unwrap_or("").to_string())) // what the fuck?? } }