From 08d244af5cf692cc9702f9394c7086db425d75ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Kita?= Date: Fri, 20 Mar 2026 15:56:29 +0100 Subject: [PATCH 1/2] WIP - update deps, add transcoder module, move EncodedFrame to common lib.rs --- Cargo.lock | 669 ++++++++++++++++++++++++------- native/vkvideo/Cargo.toml | 2 + native/vkvideo/src/encoder.rs | 10 +- native/vkvideo/src/lib.rs | 40 +- native/vkvideo/src/transcoder.rs | 0 5 files changed, 576 insertions(+), 145 deletions(-) create mode 100644 native/vkvideo/src/transcoder.rs diff --git a/Cargo.lock b/Cargo.lock index d91bb2d..5063af5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -55,9 +61,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" dependencies = [ "serde_core", ] @@ -76,15 +82,15 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bytemuck" -version = "1.24.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" dependencies = [ "bytemuck_derive", ] @@ -97,20 +103,20 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.49" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ "find-msvc-tools", "shlex", @@ -149,6 +155,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -162,7 +178,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.11.0", + "core-foundation 0.10.1", "libc", ] @@ -200,9 +227,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "foldhash" @@ -210,6 +237,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "foreign-types" version = "0.5.0" @@ -228,7 +261,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -243,6 +276,30 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "795cbfc56d419a7ce47ccbb7504dd9a5b7c484c083c356e797de08bd988d9629" +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + [[package]] name = "gl_generator" version = "0.14.0" @@ -281,7 +338,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "gpu-alloc-types", ] @@ -291,7 +348,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] @@ -303,7 +360,21 @@ dependencies = [ "log", "presser", "thiserror 1.0.69", - "windows", + "windows 0.58.0", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.18", + "windows 0.58.0", ] [[package]] @@ -312,7 +383,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "gpu-descriptor-types", "hashbrown 0.15.5", ] @@ -323,7 +394,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] @@ -357,7 +428,7 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "foldhash", + "foldhash 0.1.5", ] [[package]] @@ -365,6 +436,11 @@ name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "heck" @@ -386,9 +462,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -396,9 +472,9 @@ dependencies = [ [[package]] name = "inventory" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227" dependencies = [ "rustversion", ] @@ -411,9 +487,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -438,9 +514,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" [[package]] name = "libc" -version = "0.2.178" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libloading" @@ -464,9 +540,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "litrs" @@ -500,9 +576,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "metal" @@ -510,9 +586,24 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "block", - "core-graphics-types", + "core-graphics-types 0.1.3", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "metal" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" +dependencies = [ + "bitflags 2.11.0", + "block", + "core-graphics-types 0.2.0", "foreign-types", "log", "objc", @@ -542,7 +633,7 @@ checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.10.0", + "bitflags 2.11.0", "cfg_aliases", "codespan-reporting", "half", @@ -555,7 +646,33 @@ dependencies = [ "rustc-hash 1.1.0", "spirv", "strum", - "thiserror 2.0.17", + "thiserror 2.0.18", + "unicode-ident", +] + +[[package]] +name = "naga" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.11.0", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.18", "unicode-ident", ] @@ -568,6 +685,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -589,9 +715,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "ordered-float" @@ -633,9 +759,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" @@ -645,9 +771,18 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "portable-atomic-util" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091397be61a01d4be58e7841595bd4bfedb15f1cd54977d79b8271e94ed799a3" +dependencies = [ + "portable-atomic", +] [[package]] name = "presser" @@ -657,9 +792,9 @@ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -672,18 +807,18 @@ checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" [[package]] name = "quote" -version = "1.0.42" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "range-alloc" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" [[package]] name = "raw-window-handle" @@ -697,14 +832,14 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] name = "regex-lite" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d942b98df5e658f56f20d592c7f868833fe38115e65c33003d8cd224b0155da" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" [[package]] name = "renderdoc-sys" @@ -736,9 +871,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustler" -version = "0.37.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5c708d8b686a8d426681908369f835af90349f7ebb92ab87ddf14a851efd556" +checksum = "c779e2cbfa2987990205d0d8fc142163739e45a4c6592dc637896c77fec01280" dependencies = [ "inventory", "libloading 0.9.0", @@ -748,15 +883,15 @@ dependencies = [ [[package]] name = "rustler_codegen" -version = "0.37.2" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3f478ec72581782a7dd62a5adb406aa076af7cedd7de63fa3676c927eb216a" +checksum = "e6e120f8936c779b6c2e09992a2dfa9a4e8bcd0794c02bb654fde03e03ce8c31" dependencies = [ "heck", "inventory", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -798,7 +933,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -807,6 +942,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + [[package]] name = "slotmap" version = "1.1.1" @@ -828,7 +969,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", ] [[package]] @@ -856,7 +997,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -872,9 +1013,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.111" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -901,11 +1042,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -916,25 +1057,25 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -949,23 +1090,23 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-width" @@ -986,16 +1127,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cb12b79bcec57a3334d0284f1364c1846f378bb47df9779c6dbfcfc245c9404" dependencies = [ "ash", - "bitflags 2.10.0", + "bitflags 2.11.0", "cc", ] [[package]] name = "vk-video" -version = "0.1.0" -source = "git+https://github.com/software-mansion/smelter.git#4d2302c8af0dbefe63438911e290acf9a3323fb3" +version = "0.2.1" +source = "git+https://github.com/software-mansion/smelter.git#737028a47d4f69ef7a25c0968fe9790d8721157e" dependencies = [ "ash", + "bytemuck", "bytes", "cfg_aliases", "derivative", @@ -1005,23 +1147,25 @@ dependencies = [ "thiserror 1.0.69", "tracing", "vk-mem", - "wgpu", + "wgpu 28.0.0", ] [[package]] name = "vkvideo" version = "0.1.0" dependencies = [ + "naga 28.0.0", "rustler", + "termcolor", "vk-video", - "wgpu", + "wgpu 25.0.2", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -1032,11 +1176,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.56" +version = "0.4.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -1045,9 +1190,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1055,31 +1200,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.83" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" dependencies = [ "js-sys", "wasm-bindgen", @@ -1092,13 +1237,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8fb398f119472be4d80bc3647339f56eb63b2a331f6a3d16e25d8144197dd9" dependencies = [ "arrayvec", - "bitflags 2.10.0", + "bitflags 2.11.0", "cfg_aliases", "document-features", "hashbrown 0.15.5", "js-sys", "log", - "naga", + "naga 25.0.1", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 25.0.2", + "wgpu-hal 25.0.2", + "wgpu-types 25.0.0", +] + +[[package]] +name = "wgpu" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f" +dependencies = [ + "arrayvec", + "bitflags 2.11.0", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "js-sys", + "log", + "naga 28.0.0", "parking_lot", "portable-atomic", "profiling", @@ -1108,9 +1283,9 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", + "wgpu-core 28.0.1", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", ] [[package]] @@ -1122,13 +1297,13 @@ dependencies = [ "arrayvec", "bit-set", "bit-vec", - "bitflags 2.10.0", + "bitflags 2.11.0", "cfg_aliases", "document-features", "hashbrown 0.15.5", "indexmap", "log", - "naga", + "naga 25.0.1", "once_cell", "parking_lot", "portable-atomic", @@ -1136,12 +1311,44 @@ dependencies = [ "raw-window-handle", "rustc-hash 1.1.0", "smallvec", - "thiserror 2.0.17", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-types", + "thiserror 2.0.18", + "wgpu-core-deps-apple 25.0.0", + "wgpu-core-deps-emscripten 25.0.0", + "wgpu-core-deps-windows-linux-android 25.0.0", + "wgpu-hal 25.0.2", + "wgpu-types 25.0.0", +] + +[[package]] +name = "wgpu-core" +version = "28.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.11.0", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga 28.0.0", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.18", + "wgpu-core-deps-apple 28.0.0", + "wgpu-core-deps-emscripten 28.0.0", + "wgpu-core-deps-windows-linux-android 28.0.0", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", ] [[package]] @@ -1150,7 +1357,16 @@ version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfd488b3239b6b7b185c3b045c39ca6bf8af34467a4c5de4e0b1a564135d093d" dependencies = [ - "wgpu-hal", + "wgpu-hal 25.0.2", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da" +dependencies = [ + "wgpu-hal 28.0.1", ] [[package]] @@ -1159,7 +1375,16 @@ version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09ad7aceb3818e52539acc679f049d3475775586f3f4e311c30165cf2c00445" dependencies = [ - "wgpu-hal", + "wgpu-hal 25.0.2", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79" +dependencies = [ + "wgpu-hal 28.0.1", ] [[package]] @@ -1168,7 +1393,16 @@ version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cba5fb5f7f9c98baa7c889d444f63ace25574833df56f5b817985f641af58e46" dependencies = [ - "wgpu-hal", + "wgpu-hal 25.0.2", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae" +dependencies = [ + "wgpu-hal 28.0.1", ] [[package]] @@ -1181,16 +1415,16 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.10.0", + "bitflags 2.11.0", "block", "bytemuck", "cfg-if", "cfg_aliases", - "core-graphics-types", + "core-graphics-types 0.1.3", "glow", "glutin_wgl_sys", "gpu-alloc", - "gpu-allocator", + "gpu-allocator 0.27.0", "gpu-descriptor", "hashbrown 0.15.5", "js-sys", @@ -1198,9 +1432,9 @@ dependencies = [ "libc", "libloading 0.8.9", "log", - "metal", - "naga", - "ndk-sys", + "metal 0.31.0", + "naga 25.0.1", + "ndk-sys 0.5.0+25.2.9519653", "objc", "ordered-float", "parking_lot", @@ -1210,12 +1444,60 @@ dependencies = [ "raw-window-handle", "renderdoc-sys", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "wasm-bindgen", "web-sys", - "wgpu-types", - "windows", - "windows-core", + "wgpu-types 25.0.0", + "windows 0.58.0", + "windows-core 0.58.0", +] + +[[package]] +name = "wgpu-hal" +version = "28.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d6cb474beb218824dcc9e1ce679d973f719262789bfb27407da560cac20eeb" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.11.0", + "block", + "bytemuck", + "cfg-if", + "cfg_aliases", + "core-graphics-types 0.2.0", + "glow", + "glutin_wgl_sys", + "gpu-allocator 0.28.0", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", + "libc", + "libloading 0.8.9", + "log", + "metal 0.33.0", + "naga 28.0.0", + "ndk-sys 0.6.0+11769913", + "objc", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.18", + "wasm-bindgen", + "web-sys", + "wgpu-types 28.0.0", + "windows 0.62.2", + "windows-core 0.62.2", ] [[package]] @@ -1224,11 +1506,24 @@ version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2aa49460c2a8ee8edba3fca54325540d904dd85b2e086ada762767e17d06e8bc" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", + "bytemuck", + "js-sys", + "log", + "thiserror 2.0.18", + "web-sys", +] + +[[package]] +name = "wgpu-types" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c" +dependencies = [ + "bitflags 2.11.0", "bytemuck", "js-sys", "log", - "thiserror 2.0.17", "web-sys", ] @@ -1247,23 +1542,68 @@ version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "windows-core", + "windows-core 0.58.0", "windows-targets", ] +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core 0.62.2", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + [[package]] name = "windows-core" version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", - "windows-strings", + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", "windows-targets", ] +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link", + "windows-threading", +] + [[package]] name = "windows-implement" version = "0.58.0" @@ -1272,7 +1612,18 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] @@ -1283,7 +1634,18 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] @@ -1292,6 +1654,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link", +] + [[package]] name = "windows-result" version = "0.2.0" @@ -1301,16 +1673,34 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-strings" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result", + "windows-result 0.2.0", "windows-targets", ] +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -1336,6 +1726,15 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -1392,20 +1791,20 @@ checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" [[package]] name = "zerocopy" -version = "0.8.31" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.31" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] diff --git a/native/vkvideo/Cargo.toml b/native/vkvideo/Cargo.toml index 7372c72..a45ca02 100644 --- a/native/vkvideo/Cargo.toml +++ b/native/vkvideo/Cargo.toml @@ -9,5 +9,7 @@ crate-type = ["cdylib"] [dependencies] rustler = "0.37.0" +termcolor = "1.4.1" vk-video = { git = "https://github.com/software-mansion/smelter.git", features=["expose_parsers"] } wgpu = "25.0.2" +naga = { version = "28", features = ["termcolor"] } diff --git a/native/vkvideo/src/encoder.rs b/native/vkvideo/src/encoder.rs index 2d11bf7..7f097d6 100644 --- a/native/vkvideo/src/encoder.rs +++ b/native/vkvideo/src/encoder.rs @@ -1,5 +1,4 @@ -use crate::ok; -use crate::Resource; +use crate::{ok, EncodedFrame, Resource}; use rustler::{Atom, Error, NifTaggedEnum, ResourceArc}; use rustler::{Binary, Env, NifStruct, NifUnitEnum, OwnedBinary}; use std::sync::Mutex; @@ -12,13 +11,6 @@ pub struct EncoderResource { pub height: u32, } -#[derive(NifStruct)] -#[module = "Membrane.VKVideo.EncodedFrame"] -pub struct EncodedFrame<'a> { - pub payload: Binary<'a>, - pub pts_ns: Option, -} - #[derive(NifUnitEnum)] pub enum EncoderTune { LowLatency, diff --git a/native/vkvideo/src/lib.rs b/native/vkvideo/src/lib.rs index d0e1e19..9717b55 100644 --- a/native/vkvideo/src/lib.rs +++ b/native/vkvideo/src/lib.rs @@ -1,5 +1,5 @@ use decoder::{DecoderResource, RawFrame}; -use encoder::{EncodedFrame, EncoderRateControl, EncoderResource, EncoderTune}; +use encoder::{EncoderRateControl, EncoderResource, EncoderTune}; use rustler::{Atom, Binary, Env, Error, ResourceArc, Term}; use std::sync::Arc; use vk_video::VulkanDevice; @@ -46,6 +46,13 @@ impl Resource { } } +#[derive(NifStruct)] +#[module = "Membrane.VKVideo.EncodedFrame"] +pub struct EncodedFrame<'a> { + pub payload: Binary<'a>, + pub pts_ns: Option, +} + #[allow(non_local_definitions)] fn load(env: Env, _: Term) -> bool { rustler::resource!(Resource, env) @@ -128,4 +135,35 @@ fn destroy<'a>(env: Env<'a>, resource: ResourceArc) -> Result, +// width: u32, +// height: u32, +// frame_rate: (u32, u32), +// tune: EncoderTune, +// rate_control: EncoderRateControl, +// ) -> Result<(Atom, ResourceArc), Error> { +// encoder::new(env, resource, width, height, frame_rate, tune, rate_control) +// } + +// #[rustler::nif(schedule = "DirtyIo")] +// fn transcode<'a>( +// env: Env<'a>, +// resource: ResourceArc, +// bytes: Binary, +// pts_ns: Option, +// ) -> Result<(Atom, EncodedFrame<'a>), Error> { +// encoder::encode(env, resource, bytes, pts_ns) +// } + +// #[rustler::nif(schedule = "DirtyIo")] +// pub fn flush_transcoder( +// env: Env, +// resource: ResourceArc, +// ) -> Result<(Atom, Vec), Error> { +// transcoder::flush(env, resource) +// } + rustler::init!("Elixir.Membrane.VKVideo.Native", load = load); diff --git a/native/vkvideo/src/transcoder.rs b/native/vkvideo/src/transcoder.rs new file mode 100644 index 0000000..e69de29 From 004767ae2185a0ed7aa8816124049c8099bb931e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Mar 2026 16:38:33 +0100 Subject: [PATCH 2/2] Adjust to new vk-video Committer: varsill --- Cargo.lock | 351 ++---------------- native/vkvideo/Cargo.toml | 2 +- native/vkvideo/src/lib.rs | 23 +- test/decoder_test.exs | 3 + test/encoder_native_test.exs | 3 + test/encoder_test.exs | 5 + .../ref-10-high_quality-constant_bitrate.h264 | Bin 7865 -> 7881 bytes .../ref-10-high_quality-disabled.h264 | Bin 144106 -> 144122 bytes .../ref-10-high_quality-encoder_default.h264 | Bin 7943 -> 7959 bytes .../ref-10-high_quality-variable_bitrate.h264 | Bin 8025 -> 8041 bytes .../ref-10-low_latency-constant_bitrate.h264 | Bin 7885 -> 7901 bytes .../fixtures/ref-10-low_latency-disabled.h264 | Bin 145421 -> 145437 bytes .../ref-10-low_latency-encoder_default.h264 | Bin 7990 -> 8006 bytes .../ref-10-low_latency-variable_bitrate.h264 | Bin 8232 -> 8248 bytes 14 files changed, 67 insertions(+), 320 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5063af5..19ebe06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,20 +53,11 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" -dependencies = [ - "serde_core", -] [[package]] name = "bitstream-io" @@ -145,16 +136,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation" version = "0.10.1" @@ -171,25 +152,14 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - [[package]] name = "core-graphics-types" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.11.0", - "core-foundation 0.10.1", + "bitflags", + "core-foundation", "libc", ] @@ -332,37 +302,6 @@ dependencies = [ "gl_generator", ] -[[package]] -name = "gpu-alloc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" -dependencies = [ - "bitflags 2.11.0", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" -dependencies = [ - "bitflags 2.11.0", -] - -[[package]] -name = "gpu-allocator" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" -dependencies = [ - "log", - "presser", - "thiserror 1.0.69", - "windows 0.58.0", -] - [[package]] name = "gpu-allocator" version = "0.28.0" @@ -383,7 +322,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags 2.11.0", + "bitflags", "gpu-descriptor-types", "hashbrown 0.15.5", ] @@ -394,7 +333,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.11.0", + "bitflags", ] [[package]] @@ -580,30 +519,15 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "metal" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" -dependencies = [ - "bitflags 2.11.0", - "block", - "core-graphics-types 0.1.3", - "foreign-types", - "log", - "objc", - "paste", -] - [[package]] name = "metal" version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" dependencies = [ - "bitflags 2.11.0", + "bitflags", "block", - "core-graphics-types 0.2.0", + "core-graphics-types", "foreign-types", "log", "objc", @@ -625,31 +549,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96a1fe2275b68991faded2c80aa4a33dba398b77d276038b8f50701a22e55918" -[[package]] -name = "naga" -version = "25.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632" -dependencies = [ - "arrayvec", - "bit-set", - "bitflags 2.11.0", - "cfg_aliases", - "codespan-reporting", - "half", - "hashbrown 0.15.5", - "hexf-parse", - "indexmap", - "log", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", - "strum", - "thiserror 2.0.18", - "unicode-ident", -] - [[package]] name = "naga" version = "28.0.0" @@ -658,7 +557,7 @@ checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.11.0", + "bitflags", "cfg-if", "cfg_aliases", "codespan-reporting", @@ -676,15 +575,6 @@ dependencies = [ "unicode-ident", ] -[[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 = "ndk-sys" version = "0.6.0+11769913" @@ -832,7 +722,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.11.0", + "bitflags", ] [[package]] @@ -969,7 +859,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.11.0", + "bitflags", ] [[package]] @@ -978,28 +868,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.117", -] - [[package]] name = "syn" version = "1.0.109" @@ -1127,7 +995,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cb12b79bcec57a3334d0284f1364c1846f378bb47df9779c6dbfcfc245c9404" dependencies = [ "ash", - "bitflags 2.11.0", + "bitflags", "cc", ] @@ -1147,18 +1015,18 @@ dependencies = [ "thiserror 1.0.69", "tracing", "vk-mem", - "wgpu 28.0.0", + "wgpu", ] [[package]] name = "vkvideo" version = "0.1.0" dependencies = [ - "naga 28.0.0", + "naga", "rustler", "termcolor", "vk-video", - "wgpu 25.0.2", + "wgpu", ] [[package]] @@ -1230,34 +1098,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "wgpu" -version = "25.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8fb398f119472be4d80bc3647339f56eb63b2a331f6a3d16e25d8144197dd9" -dependencies = [ - "arrayvec", - "bitflags 2.11.0", - "cfg_aliases", - "document-features", - "hashbrown 0.15.5", - "js-sys", - "log", - "naga 25.0.1", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core 25.0.2", - "wgpu-hal 25.0.2", - "wgpu-types 25.0.0", -] - [[package]] name = "wgpu" version = "28.0.0" @@ -1265,7 +1105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f" dependencies = [ "arrayvec", - "bitflags 2.11.0", + "bitflags", "bytemuck", "cfg-if", "cfg_aliases", @@ -1273,7 +1113,7 @@ dependencies = [ "hashbrown 0.16.1", "js-sys", "log", - "naga 28.0.0", + "naga", "parking_lot", "portable-atomic", "profiling", @@ -1283,40 +1123,9 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core 28.0.1", - "wgpu-hal 28.0.1", - "wgpu-types 28.0.0", -] - -[[package]] -name = "wgpu-core" -version = "25.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b882196f8368511d613c6aeec80655160db6646aebddf8328879a88d54e500" -dependencies = [ - "arrayvec", - "bit-set", - "bit-vec", - "bitflags 2.11.0", - "cfg_aliases", - "document-features", - "hashbrown 0.15.5", - "indexmap", - "log", - "naga 25.0.1", - "once_cell", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.18", - "wgpu-core-deps-apple 25.0.0", - "wgpu-core-deps-emscripten 25.0.0", - "wgpu-core-deps-windows-linux-android 25.0.0", - "wgpu-hal 25.0.2", - "wgpu-types 25.0.0", + "wgpu-core", + "wgpu-hal", + "wgpu-types", ] [[package]] @@ -1328,14 +1137,14 @@ dependencies = [ "arrayvec", "bit-set", "bit-vec", - "bitflags 2.11.0", + "bitflags", "bytemuck", "cfg_aliases", "document-features", "hashbrown 0.16.1", "indexmap", "log", - "naga 28.0.0", + "naga", "once_cell", "parking_lot", "portable-atomic", @@ -1344,20 +1153,11 @@ dependencies = [ "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.18", - "wgpu-core-deps-apple 28.0.0", - "wgpu-core-deps-emscripten 28.0.0", - "wgpu-core-deps-windows-linux-android 28.0.0", - "wgpu-hal 28.0.1", - "wgpu-types 28.0.0", -] - -[[package]] -name = "wgpu-core-deps-apple" -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd488b3239b6b7b185c3b045c39ca6bf8af34467a4c5de4e0b1a564135d093d" -dependencies = [ - "wgpu-hal 25.0.2", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-types", ] [[package]] @@ -1366,16 +1166,7 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da" dependencies = [ - "wgpu-hal 28.0.1", -] - -[[package]] -name = "wgpu-core-deps-emscripten" -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09ad7aceb3818e52539acc679f049d3475775586f3f4e311c30165cf2c00445" -dependencies = [ - "wgpu-hal 25.0.2", + "wgpu-hal", ] [[package]] @@ -1384,16 +1175,7 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79" dependencies = [ - "wgpu-hal 28.0.1", -] - -[[package]] -name = "wgpu-core-deps-windows-linux-android" -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cba5fb5f7f9c98baa7c889d444f63ace25574833df56f5b817985f641af58e46" -dependencies = [ - "wgpu-hal 25.0.2", + "wgpu-hal", ] [[package]] @@ -1402,54 +1184,7 @@ version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae" dependencies = [ - "wgpu-hal 28.0.1", -] - -[[package]] -name = "wgpu-hal" -version = "25.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f968767fe4d3d33747bbd1473ccd55bf0f6451f55d733b5597e67b5deab4ad17" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.11.0", - "block", - "bytemuck", - "cfg-if", - "cfg_aliases", - "core-graphics-types 0.1.3", - "glow", - "glutin_wgl_sys", - "gpu-alloc", - "gpu-allocator 0.27.0", - "gpu-descriptor", - "hashbrown 0.15.5", - "js-sys", - "khronos-egl", - "libc", - "libloading 0.8.9", - "log", - "metal 0.31.0", - "naga 25.0.1", - "ndk-sys 0.5.0+25.2.9519653", - "objc", - "ordered-float", - "parking_lot", - "portable-atomic", - "profiling", - "range-alloc", - "raw-window-handle", - "renderdoc-sys", - "smallvec", - "thiserror 2.0.18", - "wasm-bindgen", - "web-sys", - "wgpu-types 25.0.0", - "windows 0.58.0", - "windows-core 0.58.0", + "wgpu-hal", ] [[package]] @@ -1462,15 +1197,15 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.11.0", + "bitflags", "block", "bytemuck", "cfg-if", "cfg_aliases", - "core-graphics-types 0.2.0", + "core-graphics-types", "glow", "glutin_wgl_sys", - "gpu-allocator 0.28.0", + "gpu-allocator", "gpu-descriptor", "hashbrown 0.16.1", "js-sys", @@ -1478,9 +1213,9 @@ dependencies = [ "libc", "libloading 0.8.9", "log", - "metal 0.33.0", - "naga 28.0.0", - "ndk-sys 0.6.0+11769913", + "metal", + "naga", + "ndk-sys", "objc", "once_cell", "ordered-float", @@ -1495,32 +1230,18 @@ dependencies = [ "thiserror 2.0.18", "wasm-bindgen", "web-sys", - "wgpu-types 28.0.0", + "wgpu-types", "windows 0.62.2", "windows-core 0.62.2", ] -[[package]] -name = "wgpu-types" -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aa49460c2a8ee8edba3fca54325540d904dd85b2e086ada762767e17d06e8bc" -dependencies = [ - "bitflags 2.11.0", - "bytemuck", - "js-sys", - "log", - "thiserror 2.0.18", - "web-sys", -] - [[package]] name = "wgpu-types" version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c" dependencies = [ - "bitflags 2.11.0", + "bitflags", "bytemuck", "js-sys", "log", diff --git a/native/vkvideo/Cargo.toml b/native/vkvideo/Cargo.toml index a45ca02..c1e080c 100644 --- a/native/vkvideo/Cargo.toml +++ b/native/vkvideo/Cargo.toml @@ -11,5 +11,5 @@ crate-type = ["cdylib"] rustler = "0.37.0" termcolor = "1.4.1" vk-video = { git = "https://github.com/software-mansion/smelter.git", features=["expose_parsers"] } -wgpu = "25.0.2" +wgpu = "28.0.0" naga = { version = "28", features = ["termcolor"] } diff --git a/native/vkvideo/src/lib.rs b/native/vkvideo/src/lib.rs index 9717b55..5d5bf2c 100644 --- a/native/vkvideo/src/lib.rs +++ b/native/vkvideo/src/lib.rs @@ -2,7 +2,10 @@ use decoder::{DecoderResource, RawFrame}; use encoder::{EncoderRateControl, EncoderResource, EncoderTune}; use rustler::{Atom, Binary, Env, Error, ResourceArc, Term}; use std::sync::Arc; -use vk_video::VulkanDevice; +use vk_video::{ + parameters::{VulkanAdapterDescriptor, VulkanDeviceDescriptor}, + VulkanDevice, +}; rustler::atoms! { ok, @@ -46,7 +49,7 @@ impl Resource { } } -#[derive(NifStruct)] +#[derive(rustler::NifStruct)] #[module = "Membrane.VKVideo.EncodedFrame"] pub struct EncodedFrame<'a> { pub payload: Binary<'a>, @@ -62,11 +65,23 @@ fn load(env: Env, _: Term) -> bool { fn create_device() -> Result<(Atom, ResourceArc), Error> { let instance = vk_video::VulkanInstance::new() .map_err(|err| Error::RaiseTerm(Box::new(err.to_string())))?; + + let adapter_descriptor = VulkanAdapterDescriptor { + supports_decoding: true, + supports_encoding: true, + compatible_surface: None, + }; let adapter = instance - .create_adapter(None) + .create_adapter(&adapter_descriptor) .map_err(|err| Error::RaiseTerm(Box::new(err.to_string())))?; + + let device_descriptor = VulkanDeviceDescriptor { + wgpu_features: wgpu::Features::empty(), + wgpu_limits: wgpu::Limits::default(), + wgpu_experimental_features: wgpu::ExperimentalFeatures::disabled(), + }; let device = adapter - .create_device(wgpu::Features::empty(), wgpu::Limits::default()) + .create_device(&device_descriptor) .map_err(|err| Error::RaiseTerm(Box::new(err.to_string())))?; let device_resource = ResourceArc::new(Resource::Device(DeviceResource { device })); diff --git a/test/decoder_test.exs b/test/decoder_test.exs index 7ab20e0..0517c17 100644 --- a/test/decoder_test.exs +++ b/test/decoder_test.exs @@ -4,6 +4,8 @@ defmodule Decoder.Test do import Membrane.Testing.Assertions alias Membrane.Testing.{Pipeline, Sink} + @take_refs_snapshot System.get_env("TAKE_TEST_REFERENCES_SNAPSHOT", "") != "" + @framerate_numerator 25 @frame_duration_ms div(1000, @framerate_numerator) @@ -61,6 +63,7 @@ defmodule Decoder.Test do assert_end_of_stream(pid, :sink, :input) Pipeline.terminate(pid) + if @take_refs_snapshot, do: File.write!(ref_path, File.read!(out_path)) assert File.read!(out_path) == File.read!(ref_path) end end diff --git a/test/encoder_native_test.exs b/test/encoder_native_test.exs index 51adeb6..02b8033 100644 --- a/test/encoder_native_test.exs +++ b/test/encoder_native_test.exs @@ -2,6 +2,8 @@ defmodule Encoder.NativeTest do use ExUnit.Case, async: false alias Membrane.VKVideo.{DeviceServer, Native} + @take_refs_snapshot System.get_env("TAKE_TEST_REFERENCES_SNAPSHOT", "") != "" + @width 1280 @height 720 # number of bytes per sample is 1.5 since we use 420 chroma subsampling @@ -61,6 +63,7 @@ defmodule Encoder.NativeTest do encoded_frame.payload end) + if @take_refs_snapshot, do: File.write!(ref_path, Enum.join(encoded_frames)) assert File.read!(ref_path) == Enum.join(encoded_frames) Native.destroy(encoder_ref) diff --git a/test/encoder_test.exs b/test/encoder_test.exs index 5eeabec..5023d3c 100644 --- a/test/encoder_test.exs +++ b/test/encoder_test.exs @@ -4,6 +4,8 @@ defmodule Encoder.Test do import Membrane.Testing.Assertions alias Membrane.Testing.{Pipeline, Sink} + @take_refs_snapshot System.get_env("TAKE_TEST_REFERENCES_SNAPSHOT", "") != "" + @width 1280 @height 720 # number of bytes per sample is 1.5 since we use 420 chroma subsampling @@ -122,6 +124,8 @@ defmodule Encoder.Test do assert_end_of_stream(pid, :sink, :input) Pipeline.terminate(pid) + + if @take_refs_snapshot, do: File.write!(ref_path, File.read!(out_path)) assert File.read!(out_path) == File.read!(ref_path) end @@ -152,6 +156,7 @@ defmodule Encoder.Test do Pipeline.terminate(pid) + if @take_refs_snapshot, do: File.write!(ref_path, File.read!(out_path)) assert File.read!(out_path) == File.read!(ref_path) end end diff --git a/test/fixtures/ref-10-high_quality-constant_bitrate.h264 b/test/fixtures/ref-10-high_quality-constant_bitrate.h264 index 67e0a7af88e4b5ef03b19a6fd8c94fe0c7716cc4..37f0a8692a1a6ac418fa6759b7d2bf0a73db398d 100644 GIT binary patch delta 40 ucmdmKd(u{(fq{WBJ%vScjmipEhUkA;EG#Sy3=GT+KthszX~0JQRdN8+gbD!w delta 24 gcmX?UyVI7Rfq{WBJ%vScjmipEhUmW=d)Ahpfq{WBJ%vScjmipEhUmW=<@d<}09tVet^fc4 diff --git a/test/fixtures/ref-10-low_latency-disabled.h264 b/test/fixtures/ref-10-low_latency-disabled.h264 index 5c0573abd89f629471fc38819b95e48f952736de..50f8544cc3aed83af4b057aa6c8494f81c0a72ac 100644 GIT binary patch delta 48 zcmeDEz%lm&hdcuV17ms$i{=`Y6|4-=|FT$ESQ;1@m>GbCB>U2UM*dcQ#;yEJ|I7hL CjSRN{ delta 32 ocmbRHfur{W2R{P?17ms$i{=`Y6|4-=e;egn