Allow custom pipelines, autodetect live sources

This commit is contained in:
Vladimir Romashchenko 2024-08-05 17:55:50 -04:00
parent 217fa7730a
commit be21d2a19b
No known key found for this signature in database
GPG key ID: E5B7EA4A9E1D48F4
5 changed files with 93 additions and 79 deletions

105
Cargo.lock generated
View file

@ -50,7 +50,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289"
dependencies = [ dependencies = [
"android-properties", "android-properties",
"bitflags 2.4.2", "bitflags 2.6.0",
"cc", "cc",
"cesu8", "cesu8",
"jni", "jni",
@ -162,9 +162,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.4.2" version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]] [[package]]
name = "block" name = "block"
@ -214,7 +214,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -235,7 +235,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"log", "log",
"polling", "polling",
"rustix", "rustix",
@ -542,7 +542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -557,7 +557,7 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"libloading 0.8.1", "libloading 0.8.1",
"winapi", "winapi",
] ]
@ -589,7 +589,7 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"drm-ffi", "drm-ffi",
"drm-fourcc", "drm-fourcc",
@ -781,7 +781,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -856,7 +856,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -956,7 +956,7 @@ version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab9e86540b5d8402e905ad4ce7d6aa544092131ab564f3102175af176b90a053" checksum = "ab9e86540b5d8402e905ad4ce7d6aa544092131ab564f3102175af176b90a053"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-executor", "futures-executor",
@ -982,7 +982,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -1045,7 +1045,7 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"gpu-alloc-types", "gpu-alloc-types",
] ]
@ -1055,7 +1055,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -1077,7 +1077,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown", "hashbrown",
] ]
@ -1088,7 +1088,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -1219,7 +1219,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"com", "com",
"libc", "libc",
"libloading 0.8.1", "libloading 0.8.1",
@ -1278,7 +1278,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55f9226618af7e8155fc8a233e4d84dc1ec44438705f972e35d5d50e62f937df" checksum = "55f9226618af7e8155fc8a233e4d84dc1ec44438705f972e35d5d50e62f937df"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"glam", "glam",
"log", "log",
"num-traits", "num-traits",
@ -1321,7 +1321,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0660df444c64a13f72999c55a324f6d3ea020167bb1af8ef43fe2bff168d8c27" checksum = "0660df444c64a13f72999c55a324f6d3ea020167bb1af8ef43fe2bff168d8c27"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"cosmic-text", "cosmic-text",
"half", "half",
@ -1424,6 +1424,7 @@ dependencies = [
"glib", "glib",
"gstreamer", "gstreamer",
"gstreamer-app", "gstreamer-app",
"gstreamer-base",
"iced", "iced",
"iced_native", "iced_native",
"iced_wgpu", "iced_wgpu",
@ -1437,7 +1438,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa5d3ce370c7044ddc9535c8f87057f1008434a495be6b9f46b2666c3e9638f7" checksum = "fa5d3ce370c7044ddc9535c8f87057f1008434a495be6b9f46b2666c3e9638f7"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"futures", "futures",
"glam", "glam",
@ -1677,7 +1678,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"libc", "libc",
"redox_syscall 0.4.1", "redox_syscall 0.4.1",
] ]
@ -1730,9 +1731,9 @@ dependencies = [
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.1" version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]] [[package]]
name = "memmap2" name = "memmap2"
@ -1758,7 +1759,7 @@ version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"block", "block",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
@ -1796,7 +1797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899" checksum = "8878eb410fc90853da3908aebfe61d73d26d4437ef850b70050461f939509899"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags 2.4.2", "bitflags 2.6.0",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap", "indexmap",
@ -1815,7 +1816,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"jni-sys", "jni-sys",
"log", "log",
"ndk-sys", "ndk-sys",
@ -1896,7 +1897,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2037,7 +2038,7 @@ checksum = "e05d1c929301fee6830dafa764341118829b2535c216b0571e3821ecac5c885b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2130,7 +2131,7 @@ dependencies = [
"phf_shared", "phf_shared",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2204,9 +2205,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.78" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2357,7 +2358,7 @@ version = "0.38.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.4.13", "linux-raw-sys 0.4.13",
@ -2438,7 +2439,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2492,7 +2493,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"calloop", "calloop",
"calloop-wayland-source", "calloop-wayland-source",
"cursor-icon", "cursor-icon",
@ -2577,7 +2578,7 @@ version = "0.3.0+sdk-1.3.268.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
] ]
[[package]] [[package]]
@ -2622,9 +2623,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.49" version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2685,7 +2686,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2825,7 +2826,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]
@ -2988,7 +2989,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3022,7 +3023,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3068,7 +3069,7 @@ version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"rustix", "rustix",
"wayland-backend", "wayland-backend",
"wayland-scanner", "wayland-scanner",
@ -3080,7 +3081,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"cursor-icon", "cursor-icon",
"wayland-backend", "wayland-backend",
] ]
@ -3102,7 +3103,7 @@ version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-scanner", "wayland-scanner",
@ -3114,7 +3115,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-protocols", "wayland-protocols",
@ -3127,7 +3128,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
"wayland-protocols", "wayland-protocols",
@ -3216,7 +3217,7 @@ checksum = "6b15e451d4060ada0d99a64df44e4d590213496da7c4f245572d51071e8e30ed"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
"bitflags 2.4.2", "bitflags 2.6.0",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
"codespan-reporting", "codespan-reporting",
"indexmap", "indexmap",
@ -3244,7 +3245,7 @@ dependencies = [
"arrayvec", "arrayvec",
"ash", "ash",
"bit-set", "bit-set",
"bitflags 2.4.2", "bitflags 2.6.0",
"block", "block",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
"core-graphics-types", "core-graphics-types",
@ -3284,7 +3285,7 @@ version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2" checksum = "895fcbeb772bfb049eb80b2d6e47f6c9af235284e9703c96fc0218a42ffd5af2"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"js-sys", "js-sys",
"web-sys", "web-sys",
] ]
@ -3566,7 +3567,7 @@ dependencies = [
"ahash", "ahash",
"android-activity", "android-activity",
"atomic-waker", "atomic-waker",
"bitflags 2.4.2", "bitflags 2.6.0",
"bytemuck", "bytemuck",
"calloop", "calloop",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
@ -3667,7 +3668,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
dependencies = [ dependencies = [
"bitflags 2.4.2", "bitflags 2.6.0",
"dlib", "dlib",
"log", "log",
"once_cell", "once_cell",
@ -3721,7 +3722,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.49", "syn 2.0.72",
] ]
[[package]] [[package]]

View file

@ -21,6 +21,7 @@ iced_native = "0.10"
iced_wgpu = "0.12" iced_wgpu = "0.12"
gstreamer = "0.22" gstreamer = "0.22"
gstreamer-app = "0.22" # appsink gstreamer-app = "0.22" # appsink
gstreamer-base = "0.22" # basesrc
glib = "0.19" # gobject traits and error type glib = "0.19" # gobject traits and error type
thiserror = "1" thiserror = "1"
url = "2" # media uri url = "2" # media uri

View file

@ -39,7 +39,6 @@ impl Sandbox for App {
.unwrap(), .unwrap(),
) )
.unwrap(), .unwrap(),
false,
) )
.unwrap(); .unwrap();
App { App {

View file

@ -60,6 +60,8 @@ pub enum Error {
Bool(#[from] glib::BoolError), Bool(#[from] glib::BoolError),
#[error("failed to get the gstreamer bus")] #[error("failed to get the gstreamer bus")]
Bus, Bus,
#[error("failed to get AppSink element with name='{0}' from gstreamer pipeline")]
AppSink(String),
#[error("{0}")] #[error("{0}")]
StateChange(#[from] gst::StateChangeError), StateChange(#[from] gst::StateChangeError),
#[error("failed to cast gstreamer element")] #[error("failed to cast gstreamer element")]

View file

@ -1,7 +1,9 @@
use crate::Error; use crate::Error;
use gst::prelude::*; use gst::prelude::*;
use gst_base::prelude::*;
use gstreamer as gst; use gstreamer as gst;
use gstreamer_app as gst_app; use gstreamer_app as gst_app;
use gstreamer_base as gst_base;
use iced::widget::image as img; use iced::widget::image as img;
use std::cell::RefCell; use std::cell::RefCell;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
@ -44,7 +46,7 @@ pub(crate) struct Internal {
pub(crate) id: u64, pub(crate) id: u64,
pub(crate) bus: gst::Bus, pub(crate) bus: gst::Bus,
pub(crate) source: gst::Bin, pub(crate) source: gst::Pipeline,
pub(crate) width: i32, pub(crate) width: i32,
pub(crate) height: i32, pub(crate) height: i32,
@ -110,35 +112,45 @@ impl Drop for Video {
impl Video { impl Video {
/// Create a new video player from a given video which loads from `uri`. /// Create a new video player from a given video which loads from `uri`.
/// /// Note that live sourced will report the duration to be zero.
/// If `live` is set then no duration is queried (as this will result in an error and is non-sensical for live streams). pub fn new(uri: &url::Url) -> Result<Self, Error> {
/// Set `live` if the streaming source is indefinite (e.g. a live stream). let pipeline = format!("uridecodebin uri=\"{}\" ! videoconvert ! videoscale ! appsink name=iced_video caps=video/x-raw,format=RGBA,pixel-aspect-ratio=1/1", uri.as_str());
/// Note that this will cause the duration to be zero. Self::from_pipeline(pipeline)
pub fn new(uri: &url::Url, live: bool) -> Result<Self, Error> { }
pub fn from_pipeline<S: AsRef<str>>(pipeline: S) -> Result<Self, Error> {
static NEXT_ID: AtomicU64 = AtomicU64::new(0); static NEXT_ID: AtomicU64 = AtomicU64::new(0);
let id = NEXT_ID.fetch_add(1, Ordering::SeqCst); let id = NEXT_ID.fetch_add(1, Ordering::SeqCst);
gst::init()?; gst::init()?;
let source = gst::parse::launch(&format!("playbin uri=\"{}\" video-sink=\"videoconvert ! videoscale ! appsink name=app_sink caps=video/x-raw,format=RGBA,pixel-aspect-ratio=1/1\"", uri.as_str()))?; let pipeline = gst::parse::launch(pipeline.as_ref())?
let source = source.downcast::<gst::Bin>().unwrap(); .downcast::<gst::Pipeline>()
.map_err(|_| Error::Cast)?;
let video_sink: gst::Element = source.property("video-sink"); let mut live = false;
let pad = video_sink.pads().get(0).cloned().unwrap(); pipeline
let pad = pad.dynamic_cast::<gst::GhostPad>().unwrap(); .iterate_sources()
let bin = pad .foreach(|elem| {
.parent_element() if let Ok(src) = elem.downcast::<gst_base::BaseSrc>() {
.unwrap() if src.is_live() {
.downcast::<gst::Bin>() live = true;
}
}
})
.unwrap(); .unwrap();
let app_sink = bin.by_name("app_sink").unwrap(); let app_sink_name = "iced_video";
let app_sink = app_sink.downcast::<gst_app::AppSink>().unwrap(); let app_sink = pipeline
.by_name(app_sink_name)
.and_then(|elem| elem.downcast::<gst_app::AppSink>().ok())
.ok_or(Error::AppSink(app_sink_name.to_string()))?;
source.set_state(gst::State::Playing)?; let pad = app_sink.pads().first().cloned().unwrap();
pipeline.set_state(gst::State::Playing)?;
// wait for up to 5 seconds until the decoder gets the source capabilities // wait for up to 5 seconds until the decoder gets the source capabilities
source.state(gst::ClockTime::from_seconds(5)).0?; pipeline.state(gst::ClockTime::from_seconds(5)).0?;
// extract resolution and framerate // extract resolution and framerate
// TODO(jazzfool): maybe we want to extract some other information too? // TODO(jazzfool): maybe we want to extract some other information too?
@ -152,7 +164,7 @@ impl Video {
let duration = if !live { let duration = if !live {
std::time::Duration::from_nanos( std::time::Duration::from_nanos(
source pipeline
.query_duration::<gst::ClockTime>() .query_duration::<gst::ClockTime>()
.ok_or(Error::Duration)? .ok_or(Error::Duration)?
.nseconds(), .nseconds(),
@ -194,8 +206,8 @@ impl Video {
Ok(Video(RefCell::new(Internal { Ok(Video(RefCell::new(Internal {
id, id,
bus: source.bus().unwrap(), bus: pipeline.bus().unwrap(),
source, source: pipeline,
width, width,
height, height,
@ -231,14 +243,14 @@ impl Video {
/// ///
/// This uses a linear scale, for example `0.5` is perceived as half as loud. /// This uses a linear scale, for example `0.5` is perceived as half as loud.
pub fn set_volume(&mut self, volume: f64) { pub fn set_volume(&mut self, volume: f64) {
self.0.borrow().source.set_property("volume", &volume); self.0.borrow().source.set_property("volume", volume);
} }
/// Set if the audio is muted or not, without changing the volume. /// Set if the audio is muted or not, without changing the volume.
pub fn set_muted(&mut self, muted: bool) { pub fn set_muted(&mut self, muted: bool) {
let mut inner = self.0.borrow_mut(); let mut inner = self.0.borrow_mut();
inner.muted = muted; inner.muted = muted;
inner.source.set_property("mute", &muted); inner.source.set_property("mute", muted);
} }
/// Get if the audio is muted or not. /// Get if the audio is muted or not.
@ -292,7 +304,6 @@ impl Video {
.query_position::<gst::ClockTime>() .query_position::<gst::ClockTime>()
.map_or(0, |pos| pos.nseconds()), .map_or(0, |pos| pos.nseconds()),
) )
.into()
} }
/// Get the media duration. /// Get the media duration.