mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-24 10:01:01 +00:00
wsserver: support of websocket from gst
This commit is contained in:
parent
f47b0624fd
commit
bd05c63127
8 changed files with 477 additions and 55 deletions
347
Cargo.lock
generated
347
Cargo.lock
generated
|
@ -23,6 +23,21 @@ version = "1.0.44"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"
|
||||
|
||||
[[package]]
|
||||
name = "async-tungstenite"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1e9efbe14612da0a19fb983059a0b621e9cf6225d7018ecab4f9988215540dc"
|
||||
dependencies = [
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"gio",
|
||||
"glib",
|
||||
"log 0.4.14",
|
||||
"pin-project-lite",
|
||||
"tungstenite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic_refcell"
|
||||
version = "0.1.8"
|
||||
|
@ -78,12 +93,27 @@ version = "2.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.18.0"
|
||||
|
@ -143,6 +173,41 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.8"
|
||||
|
@ -197,25 +262,56 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.17"
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
|
||||
dependencies = [
|
||||
"percent-encoding 2.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.17"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"
|
||||
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.17"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"
|
||||
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -224,43 +320,48 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.17"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
|
||||
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.17"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"
|
||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.80",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.17"
|
||||
name = "futures-sink"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"
|
||||
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.17"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
|
||||
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"proc-macro-hack",
|
||||
"proc-macro-nested",
|
||||
"slab",
|
||||
]
|
||||
|
||||
|
@ -349,6 +450,27 @@ dependencies = [
|
|||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.26.1"
|
||||
|
@ -529,6 +651,8 @@ name = "gst_pipeline_studio"
|
|||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-tungstenite",
|
||||
"futures",
|
||||
"futures-channel",
|
||||
"futures-executor",
|
||||
"gst-plugin-gtk4",
|
||||
|
@ -538,6 +662,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"serde",
|
||||
"serde_any",
|
||||
"serde_json",
|
||||
"simplelog",
|
||||
"xml-rs 0.8.4",
|
||||
]
|
||||
|
@ -732,6 +857,23 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.5"
|
||||
|
@ -743,6 +885,16 @@ dependencies = [
|
|||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.11.0"
|
||||
|
@ -766,9 +918,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.137"
|
||||
version = "0.2.148"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
|
||||
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
|
@ -922,6 +1074,12 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.1.3"
|
||||
|
@ -933,9 +1091,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.7"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
@ -949,6 +1107,12 @@ version = "0.3.24"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "pretty-hex"
|
||||
version = "0.3.0"
|
||||
|
@ -989,18 +1153,6 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.66"
|
||||
|
@ -1019,6 +1171,36 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ron"
|
||||
version = "0.3.0"
|
||||
|
@ -1077,9 +1259,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.130"
|
||||
version = "1.0.188"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
|
||||
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1114,20 +1296,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.130"
|
||||
version = "1.0.188"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
|
||||
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.80",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.73"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5"
|
||||
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
|
||||
dependencies = [
|
||||
"itoa 1.0.1",
|
||||
"ryu",
|
||||
|
@ -1143,7 +1325,7 @@ dependencies = [
|
|||
"dtoa",
|
||||
"itoa 0.4.8",
|
||||
"serde",
|
||||
"url",
|
||||
"url 1.7.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1158,6 +1340,17 @@ dependencies = [
|
|||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simplelog"
|
||||
version = "0.11.2"
|
||||
|
@ -1264,7 +1457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -1301,6 +1494,31 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tungstenite"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"data-encoding",
|
||||
"http",
|
||||
"httparse",
|
||||
"log 0.4.14",
|
||||
"rand",
|
||||
"sha1",
|
||||
"thiserror",
|
||||
"url 2.4.1",
|
||||
"utf-8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
version = "0.1.3"
|
||||
|
@ -1309,9 +1527,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.7"
|
||||
version = "0.3.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
|
||||
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
|
@ -1321,9 +1539,9 @@ checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.19"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
|
||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
@ -1346,11 +1564,28 @@ version = "1.7.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
||||
dependencies = [
|
||||
"idna",
|
||||
"idna 0.1.5",
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
"percent-encoding 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna 0.4.0",
|
||||
"percent-encoding 2.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.1.0"
|
||||
|
@ -1369,6 +1604,12 @@ version = "0.10.0+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
|
|
@ -18,6 +18,10 @@ serde = "1.0"
|
|||
serde_any = "0.5"
|
||||
simplelog = "0.11.2"
|
||||
futures-channel = "0.3"
|
||||
futures = "0.3"
|
||||
async-tungstenite = {version="0.23.0", features = ["gio-runtime"]}
|
||||
serde_json = "1.0.107"
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
futures-executor = "0.3"
|
||||
|
|
60
examples/html/websockt.html
Normal file
60
examples/html/websockt.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebSocket JSON Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>WebSocket JSON Example</h1>
|
||||
<button id="refresh-button">Refresh</button>
|
||||
<div id="json-data">
|
||||
<!-- The JSON data will be displayed here -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Create a WebSocket instance by connecting to the WebSocket server
|
||||
const socket = new WebSocket("ws://127.0.0.1:8444");
|
||||
|
||||
// Array to store received JSON data
|
||||
const jsonDataArray = [];
|
||||
|
||||
// Function to display JSON data
|
||||
function displayData() {
|
||||
const jsonDataDiv = document.getElementById("json-data");
|
||||
jsonDataDiv.innerHTML = "";
|
||||
|
||||
// Loop through the JSON data and display it
|
||||
jsonDataArray.forEach(function (data) {
|
||||
const jsonElement = document.createElement("pre");
|
||||
jsonElement.textContent = JSON.stringify(data, null, 2);
|
||||
jsonDataDiv.appendChild(jsonElement);
|
||||
});
|
||||
}
|
||||
|
||||
// Handle the message event when data is received from the WebSocket server
|
||||
socket.addEventListener("message", function (event) {
|
||||
// Parse the received JSON data
|
||||
const jsonData = JSON.parse(event.data);
|
||||
|
||||
// Add the JSON data to the array
|
||||
jsonDataArray.push(jsonData);
|
||||
|
||||
// Display the JSON data
|
||||
displayData();
|
||||
});
|
||||
|
||||
// Attach a click event listener to the "Refresh" button
|
||||
const refreshButton = document.getElementById("refresh-button");
|
||||
refreshButton.addEventListener("click", function () {
|
||||
// Clear the JSON data array
|
||||
jsonDataArray.length = 0;
|
||||
|
||||
// Request new data from the WebSocket server if needed
|
||||
// This could involve sending a specific message to the server
|
||||
// or simply waiting for new data to arrive
|
||||
|
||||
// You can also add logic here to send a message to the server
|
||||
// to request fresh data, if applicable
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
32
src/app.rs
32
src/app.rs
|
@ -262,6 +262,9 @@ impl GPSApp {
|
|||
application.add_action(&gio::SimpleAction::new("open_pipeline", None));
|
||||
application.set_accels_for_action("app.open_pipeline", &["<primary>p"]);
|
||||
|
||||
application.add_action(&gio::SimpleAction::new("listen_pipeline", None));
|
||||
application.set_accels_for_action("app.listen_pipeline", &["<primary>l"]);
|
||||
|
||||
application.add_action(&gio::SimpleAction::new("save_as", None));
|
||||
application.add_action(&gio::SimpleAction::new("save", None));
|
||||
application.set_accels_for_action("app.save", &["<primary>s"]);
|
||||
|
@ -455,13 +458,15 @@ impl GPSApp {
|
|||
|
||||
// Setup the logger to get messages into the TreeView
|
||||
let (ready_tx, ready_rx) = glib::MainContext::channel(glib::Priority::DEFAULT);
|
||||
let app_weak = self.downgrade();
|
||||
|
||||
logger::init_logger(
|
||||
ready_tx,
|
||||
Settings::log_file_path()
|
||||
.to_str()
|
||||
.expect("Unable to convert log file path to a string"),
|
||||
);
|
||||
|
||||
let app_weak = self.downgrade();
|
||||
GPSUI::logger::setup_logger_list(self);
|
||||
let _ = ready_rx.attach(None, move |msg: String| {
|
||||
let app = upgrade_weak!(app_weak, glib::ControlFlow::Break);
|
||||
|
@ -518,6 +523,20 @@ impl GPSApp {
|
|||
);
|
||||
});
|
||||
let app_weak = self.downgrade();
|
||||
self.connect_app_menu_action("listen_pipeline", move |_, _| {
|
||||
let app = upgrade_weak!(app_weak);
|
||||
GPSUI::dialog::create_input_dialog(
|
||||
"Enter pipeline web socket address",
|
||||
"description",
|
||||
&Settings::websocket_description(),
|
||||
&app,
|
||||
move |app, ws_desc| {
|
||||
Settings::set_websocket_description(ws_desc.as_str());
|
||||
app.load_websocket();
|
||||
},
|
||||
);
|
||||
});
|
||||
let app_weak = self.downgrade();
|
||||
self.connect_app_menu_action("save", move |_, _| {
|
||||
let app = upgrade_weak!(app_weak);
|
||||
let gt = graphbook::current_graphtab(&app);
|
||||
|
@ -749,7 +768,7 @@ impl GPSApp {
|
|||
graphtab.graphview().add_link(link);
|
||||
}
|
||||
|
||||
fn clear_graph(&self) {
|
||||
pub fn clear_graph(&self) {
|
||||
graphbook::current_graphtab(self).graphview().clear();
|
||||
}
|
||||
|
||||
|
@ -780,4 +799,13 @@ impl GPSApp {
|
|||
.graphview_from_pipeline_description(&graphtab.graphview(), pipeline_desc);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn load_websocket(&self) {
|
||||
let ctx = glib::MainContext::default();
|
||||
let app_weak = self.downgrade();
|
||||
ctx.spawn_local(async move {
|
||||
let app = upgrade_weak!(app_weak);
|
||||
GPS::wsserver::run(&app).await;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
mod element;
|
||||
mod pad;
|
||||
mod player;
|
||||
pub mod wsserver;
|
||||
|
||||
pub use element::ElementInfo;
|
||||
pub use pad::PadInfo;
|
||||
|
|
70
src/gps/wsserver.rs
Normal file
70
src/gps/wsserver.rs
Normal file
|
@ -0,0 +1,70 @@
|
|||
use crate::app::GPSApp;
|
||||
use crate::logger;
|
||||
use crate::settings::Settings;
|
||||
use crate::GPS_INFO;
|
||||
use async_tungstenite::gio::connect_async;
|
||||
use futures::StreamExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
///https://gitlab.freedesktop.org/thiblahute/gst-plugins-rs/-/blob/tracerserver
|
||||
//https://blog.devgenius.io/getting-started-with-websockets-and-json-data-in-rust-84434ddbfc21
|
||||
///GST_TRACERS=wsserver gst-launch-1.0 videotestsrc ! autovideosink
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
struct WSMessage {
|
||||
#[serde(rename = "type")]
|
||||
msg_type: String,
|
||||
#[serde(rename = "object-id")]
|
||||
#[serde(default)]
|
||||
object_id: u64,
|
||||
#[serde(rename = "src-id")]
|
||||
#[serde(default)]
|
||||
src_id: u64,
|
||||
#[serde(rename = "sink-id")]
|
||||
#[serde(default)]
|
||||
sink_id: u64,
|
||||
#[serde(rename = "pad-id")]
|
||||
#[serde(default)]
|
||||
pad_id: u64,
|
||||
#[serde(rename = "object-name")]
|
||||
#[serde(default)]
|
||||
object_name: Option<String>,
|
||||
#[serde(rename = "object-gtype")]
|
||||
#[serde(default)]
|
||||
object_gtype: Option<String>,
|
||||
#[serde(rename = "element-factory")]
|
||||
#[serde(default)]
|
||||
element_factory: Option<String>,
|
||||
#[serde(rename = "property-name")]
|
||||
#[serde(default)]
|
||||
property_name: Option<String>,
|
||||
#[serde(rename = "property-value")]
|
||||
#[serde(default)]
|
||||
property_value: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn run(app: &GPSApp) {
|
||||
let connect_addr = Settings::websocket_description();
|
||||
|
||||
if let Ok((ws_stream, _)) = connect_async(connect_addr).await {
|
||||
GPS_INFO!("WebSocket handshake has been successfully completed");
|
||||
|
||||
let (_write, mut read) = ws_stream.split();
|
||||
app.clear_graph();
|
||||
while let Some(message) = read.next().await {
|
||||
//GPS_INFO!("{message:?}");
|
||||
|
||||
let ws_msg: WSMessage =
|
||||
serde_json::from_str(message.unwrap().into_text().unwrap().as_str()).unwrap();
|
||||
GPS_INFO!("{ws_msg:?}");
|
||||
if ws_msg.msg_type == "new-object" {
|
||||
GPS_INFO!("{ws_msg:?}");
|
||||
if let Some(factory_name) = ws_msg.element_factory {
|
||||
if factory_name != "pipeline" {
|
||||
app.add_new_element(factory_name.as_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ pub struct Settings {
|
|||
pub app_width: i32,
|
||||
pub app_height: i32,
|
||||
pub recent_pipeline: String,
|
||||
pub ws_desc: String,
|
||||
|
||||
// values must be emitted before tables
|
||||
pub favorites: Vec<String>,
|
||||
|
@ -81,6 +82,17 @@ impl Settings {
|
|||
settings.recent_pipeline
|
||||
}
|
||||
|
||||
pub fn websocket_description() -> String {
|
||||
let settings = Settings::load_settings();
|
||||
settings.ws_desc
|
||||
}
|
||||
|
||||
pub fn set_websocket_description(ws_desc: &str) {
|
||||
let mut settings = Settings::load_settings();
|
||||
settings.ws_desc = ws_desc.to_string();
|
||||
Settings::save_settings(&settings);
|
||||
}
|
||||
|
||||
pub fn add_favorite(favorite: &str) {
|
||||
let mut settings = Settings::load_settings();
|
||||
settings.favorites.sort();
|
||||
|
@ -126,6 +138,7 @@ impl Settings {
|
|||
let mut settings = Settings {
|
||||
app_width: 800,
|
||||
app_height: 600,
|
||||
ws_desc: String::from("ws://127.0.0.1:8444"),
|
||||
..Default::default()
|
||||
};
|
||||
settings
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
<attribute name="label" translatable="yes" comments="Primary menu entry that opens a pipeline">_Open pipeline</attribute>
|
||||
<attribute name="action">app.open_pipeline</attribute>
|
||||
<attribute name="accel"><primary>p</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes" comments="Primary menu entry that list for a pipeline">_Listen</attribute>
|
||||
<attribute name="action">app.listen_pipeline</attribute>
|
||||
<attribute name="accel"><primary>p</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes" comments="Primary menu entry that saves the graph">_Save</attribute>
|
||||
|
|
Loading…
Reference in a new issue