├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── build.rs ├── config └── log4rs.yaml ├── docs ├── VideohubInstallation.pdf └── videohub_example.png └── src ├── main.rs ├── ndi ├── mod.rs └── ndisys.rs ├── peer.rs ├── shared.rs └── videohub.rs /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /target 3 | **/*.rs.bk 4 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "adler32" 5 | version = "1.0.4" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | 8 | [[package]] 9 | name = "antidote" 10 | version = "1.0.0" 11 | source = "registry+https://github.com/rust-lang/crates.io-index" 12 | 13 | [[package]] 14 | name = "arc-swap" 15 | version = "0.3.11" 16 | source = "registry+https://github.com/rust-lang/crates.io-index" 17 | 18 | [[package]] 19 | name = "arc-swap" 20 | version = "0.4.4" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | 23 | [[package]] 24 | name = "autocfg" 25 | version = "1.0.0" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | 28 | [[package]] 29 | name = "bitflags" 30 | version = "1.2.1" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | 33 | [[package]] 34 | name = "bytes" 35 | version = "0.5.3" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | 38 | [[package]] 39 | name = "cfg-if" 40 | version = "0.1.10" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | 43 | [[package]] 44 | name = "chrono" 45 | version = "0.4.10" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | dependencies = [ 48 | "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 51 | ] 52 | 53 | [[package]] 54 | name = "crc32fast" 55 | version = "1.2.0" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | dependencies = [ 58 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 59 | ] 60 | 61 | [[package]] 62 | name = "dtoa" 63 | version = "0.4.4" 64 | source = "registry+https://github.com/rust-lang/crates.io-index" 65 | 66 | [[package]] 67 | name = "flate2" 68 | version = "1.0.13" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | dependencies = [ 71 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 72 | "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 73 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 74 | "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 75 | ] 76 | 77 | [[package]] 78 | name = "fnv" 79 | version = "1.0.6" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | 82 | [[package]] 83 | name = "fuchsia-zircon" 84 | version = "0.3.3" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | dependencies = [ 87 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 89 | ] 90 | 91 | [[package]] 92 | name = "fuchsia-zircon-sys" 93 | version = "0.3.3" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | 96 | [[package]] 97 | name = "futures" 98 | version = "0.3.1" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | dependencies = [ 101 | "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 102 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 103 | "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 104 | "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 105 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 106 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 107 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 108 | ] 109 | 110 | [[package]] 111 | name = "futures-channel" 112 | version = "0.3.1" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | dependencies = [ 115 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 116 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 117 | ] 118 | 119 | [[package]] 120 | name = "futures-core" 121 | version = "0.3.1" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | 124 | [[package]] 125 | name = "futures-executor" 126 | version = "0.3.1" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | dependencies = [ 129 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 130 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 131 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 132 | ] 133 | 134 | [[package]] 135 | name = "futures-io" 136 | version = "0.3.1" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | 139 | [[package]] 140 | name = "futures-macro" 141 | version = "0.3.1" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | dependencies = [ 144 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", 145 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 146 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 147 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", 148 | ] 149 | 150 | [[package]] 151 | name = "futures-sink" 152 | version = "0.3.1" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | 155 | [[package]] 156 | name = "futures-task" 157 | version = "0.3.1" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | 160 | [[package]] 161 | name = "futures-util" 162 | version = "0.3.1" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | dependencies = [ 165 | "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 166 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 167 | "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 168 | "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 169 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 170 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 171 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 172 | "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", 173 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", 174 | "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 175 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 176 | ] 177 | 178 | [[package]] 179 | name = "hermit-abi" 180 | version = "0.1.5" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | dependencies = [ 183 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 184 | ] 185 | 186 | [[package]] 187 | name = "humantime" 188 | version = "1.3.0" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | dependencies = [ 191 | "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 192 | ] 193 | 194 | [[package]] 195 | name = "iovec" 196 | version = "0.1.4" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | dependencies = [ 199 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 200 | ] 201 | 202 | [[package]] 203 | name = "itoa" 204 | version = "0.4.4" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | 207 | [[package]] 208 | name = "kernel32-sys" 209 | version = "0.2.2" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | dependencies = [ 212 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 213 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 214 | ] 215 | 216 | [[package]] 217 | name = "lazy_static" 218 | version = "1.4.0" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | 221 | [[package]] 222 | name = "libc" 223 | version = "0.2.66" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | 226 | [[package]] 227 | name = "linked-hash-map" 228 | version = "0.5.2" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | 231 | [[package]] 232 | name = "log" 233 | version = "0.4.8" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | dependencies = [ 236 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 237 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 238 | ] 239 | 240 | [[package]] 241 | name = "log-mdc" 242 | version = "0.1.0" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | 245 | [[package]] 246 | name = "log4rs" 247 | version = "0.9.0" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | dependencies = [ 250 | "antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 251 | "arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 252 | "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 253 | "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", 254 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 255 | "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 256 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 257 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 258 | "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 259 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 260 | "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 261 | "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 262 | "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", 263 | "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", 264 | "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 265 | "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 266 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 267 | ] 268 | 269 | [[package]] 270 | name = "memchr" 271 | version = "2.2.1" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | 274 | [[package]] 275 | name = "miniz_oxide" 276 | version = "0.3.5" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | dependencies = [ 279 | "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 280 | ] 281 | 282 | [[package]] 283 | name = "mio" 284 | version = "0.6.21" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | dependencies = [ 287 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 288 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 289 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 290 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 291 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 292 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 293 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 294 | "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 295 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 296 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 297 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 298 | ] 299 | 300 | [[package]] 301 | name = "mio-named-pipes" 302 | version = "0.1.6" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | dependencies = [ 305 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 306 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 307 | "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 308 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 309 | ] 310 | 311 | [[package]] 312 | name = "mio-uds" 313 | version = "0.6.7" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | dependencies = [ 316 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 317 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 318 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 319 | ] 320 | 321 | [[package]] 322 | name = "miow" 323 | version = "0.2.1" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | dependencies = [ 326 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 327 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 328 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 330 | ] 331 | 332 | [[package]] 333 | name = "miow" 334 | version = "0.3.3" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | dependencies = [ 337 | "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 338 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 339 | ] 340 | 341 | [[package]] 342 | name = "ndi-router" 343 | version = "1.0.0" 344 | dependencies = [ 345 | "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 346 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 347 | "log4rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 348 | "tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 349 | "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 350 | ] 351 | 352 | [[package]] 353 | name = "net2" 354 | version = "0.2.33" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | dependencies = [ 357 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 358 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 359 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 360 | ] 361 | 362 | [[package]] 363 | name = "num-integer" 364 | version = "0.1.42" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | dependencies = [ 367 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 368 | "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 369 | ] 370 | 371 | [[package]] 372 | name = "num-traits" 373 | version = "0.2.11" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | dependencies = [ 376 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 377 | ] 378 | 379 | [[package]] 380 | name = "num_cpus" 381 | version = "1.11.1" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | dependencies = [ 384 | "hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 385 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 386 | ] 387 | 388 | [[package]] 389 | name = "ordered-float" 390 | version = "1.0.2" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | dependencies = [ 393 | "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 394 | ] 395 | 396 | [[package]] 397 | name = "pin-project-lite" 398 | version = "0.1.1" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | 401 | [[package]] 402 | name = "pin-utils" 403 | version = "0.1.0-alpha.4" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | 406 | [[package]] 407 | name = "proc-macro-hack" 408 | version = "0.5.11" 409 | source = "registry+https://github.com/rust-lang/crates.io-index" 410 | dependencies = [ 411 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 412 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 413 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", 414 | ] 415 | 416 | [[package]] 417 | name = "proc-macro-nested" 418 | version = "0.1.3" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | 421 | [[package]] 422 | name = "proc-macro2" 423 | version = "1.0.6" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | dependencies = [ 426 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 427 | ] 428 | 429 | [[package]] 430 | name = "quick-error" 431 | version = "1.2.3" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | 434 | [[package]] 435 | name = "quote" 436 | version = "1.0.2" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | dependencies = [ 439 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 440 | ] 441 | 442 | [[package]] 443 | name = "redox_syscall" 444 | version = "0.1.56" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | 447 | [[package]] 448 | name = "ryu" 449 | version = "1.0.2" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | 452 | [[package]] 453 | name = "serde" 454 | version = "1.0.104" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | 457 | [[package]] 458 | name = "serde-value" 459 | version = "0.5.3" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | dependencies = [ 462 | "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 463 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 464 | ] 465 | 466 | [[package]] 467 | name = "serde_derive" 468 | version = "1.0.104" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | dependencies = [ 471 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 472 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 473 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", 474 | ] 475 | 476 | [[package]] 477 | name = "serde_json" 478 | version = "1.0.44" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | dependencies = [ 481 | "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 482 | "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 483 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 484 | ] 485 | 486 | [[package]] 487 | name = "serde_yaml" 488 | version = "0.8.11" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | dependencies = [ 491 | "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 492 | "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 493 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 494 | "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", 495 | ] 496 | 497 | [[package]] 498 | name = "signal-hook-registry" 499 | version = "1.2.0" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | dependencies = [ 502 | "arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 503 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 504 | ] 505 | 506 | [[package]] 507 | name = "slab" 508 | version = "0.4.2" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | 511 | [[package]] 512 | name = "socket2" 513 | version = "0.3.11" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | dependencies = [ 516 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 517 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 518 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 519 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 520 | ] 521 | 522 | [[package]] 523 | name = "syn" 524 | version = "1.0.11" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | dependencies = [ 527 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 528 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 529 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 530 | ] 531 | 532 | [[package]] 533 | name = "thread-id" 534 | version = "3.3.0" 535 | source = "registry+https://github.com/rust-lang/crates.io-index" 536 | dependencies = [ 537 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 538 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 539 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 540 | ] 541 | 542 | [[package]] 543 | name = "time" 544 | version = "0.1.42" 545 | source = "registry+https://github.com/rust-lang/crates.io-index" 546 | dependencies = [ 547 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 548 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 549 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 550 | ] 551 | 552 | [[package]] 553 | name = "tokio" 554 | version = "0.2.6" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | dependencies = [ 557 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 558 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 559 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 560 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 561 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 562 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 563 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 564 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 565 | "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 566 | "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 567 | "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", 568 | "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 569 | "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 570 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 571 | "tokio-macros 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 572 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 573 | ] 574 | 575 | [[package]] 576 | name = "tokio-macros" 577 | version = "0.2.1" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | dependencies = [ 580 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 581 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", 582 | ] 583 | 584 | [[package]] 585 | name = "tokio-util" 586 | version = "0.2.0" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | dependencies = [ 589 | "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", 590 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 591 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 592 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 593 | "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 594 | "tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 595 | ] 596 | 597 | [[package]] 598 | name = "traitobject" 599 | version = "0.1.0" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | 602 | [[package]] 603 | name = "typemap" 604 | version = "0.3.3" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | dependencies = [ 607 | "unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 608 | ] 609 | 610 | [[package]] 611 | name = "unicode-xid" 612 | version = "0.2.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | 615 | [[package]] 616 | name = "unsafe-any" 617 | version = "0.4.2" 618 | source = "registry+https://github.com/rust-lang/crates.io-index" 619 | dependencies = [ 620 | "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 621 | ] 622 | 623 | [[package]] 624 | name = "winapi" 625 | version = "0.2.8" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | 628 | [[package]] 629 | name = "winapi" 630 | version = "0.3.8" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | dependencies = [ 633 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 634 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 635 | ] 636 | 637 | [[package]] 638 | name = "winapi-build" 639 | version = "0.1.1" 640 | source = "registry+https://github.com/rust-lang/crates.io-index" 641 | 642 | [[package]] 643 | name = "winapi-i686-pc-windows-gnu" 644 | version = "0.4.0" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | 647 | [[package]] 648 | name = "winapi-x86_64-pc-windows-gnu" 649 | version = "0.4.0" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | 652 | [[package]] 653 | name = "ws2_32-sys" 654 | version = "0.2.1" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | dependencies = [ 657 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 658 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 659 | ] 660 | 661 | [[package]] 662 | name = "yaml-rust" 663 | version = "0.4.3" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | dependencies = [ 666 | "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 667 | ] 668 | 669 | [metadata] 670 | "checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" 671 | "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" 672 | "checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" 673 | "checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff" 674 | "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" 675 | "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 676 | "checksum bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38" 677 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 678 | "checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01" 679 | "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" 680 | "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" 681 | "checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" 682 | "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 683 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 684 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 685 | "checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" 686 | "checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" 687 | "checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" 688 | "checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" 689 | "checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" 690 | "checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" 691 | "checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" 692 | "checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" 693 | "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" 694 | "checksum hermit-abi 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f629dc602392d3ec14bfc8a09b5e644d7ffd725102b48b81e59f90f2633621d7" 695 | "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" 696 | "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 697 | "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" 698 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 699 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 700 | "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" 701 | "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" 702 | "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 703 | "checksum log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" 704 | "checksum log4rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e229f32d17a1a822df4bb22ffdf1c7449d0ece700f310e87254a297be31c3b63" 705 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" 706 | "checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" 707 | "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" 708 | "checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" 709 | "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" 710 | "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 711 | "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" 712 | "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 713 | "checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" 714 | "checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" 715 | "checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" 716 | "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" 717 | "checksum pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0af6cbca0e6e3ce8692ee19fb8d734b641899e07b68eb73e9bbbd32f1703991" 718 | "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" 719 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" 720 | "checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" 721 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" 722 | "checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" 723 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" 724 | "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 725 | "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" 726 | "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" 727 | "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" 728 | "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" 729 | "checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7" 730 | "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" 731 | "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" 732 | "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 733 | "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" 734 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238" 735 | "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" 736 | "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 737 | "checksum tokio 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1bef565a52394086ecac0a6fa3b8ace4cb3a138ee1d96bd2b93283b56824e3" 738 | "checksum tokio-macros 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7de6c21a09bab0ce34614bb1071403ad9996db62715eb61e63be5d82f91342bc" 739 | "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" 740 | "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" 741 | "checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" 742 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" 743 | "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" 744 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 745 | "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 746 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 747 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 748 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 749 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 750 | "checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" 751 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ndi-router" 3 | version = "1.0.0" 4 | authors = ["Luke Moscrop "] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | tokio = { version = "0.2.0", features = ["full"] } 11 | tokio-util = { version = "0.2.0", features = ["full"] } 12 | futures = "0.3.0" 13 | log4rs = "0.9.0" 14 | log = { version = "0.4.0", features = ["std"] } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NDI Router 2 | This is a work in progress to create an NDI router. The basic idea is a fixed amount of outputs is created that can be used by NDI receivers. This software can then route sources on the netowkr into one of those fixed outputs. Much like a physical hardware video router. 3 | 4 | To help in the ease of control rather than ship with a custom UI this has been built this to use the same protocol used by blackmagic to control their hardware based video routers. You can download a copy of Videohub control from [Black Magic](https://www.blackmagicdesign.com/uk/support/family/routing-and-distribution). 5 | 6 | ![](./docs/videohub_example.png) 7 | 8 | This is written in in rust so the following commands can be used to compile and run. It will require the NDI libs to be somewhere on the PATH. 9 | 10 | ```bash 11 | cargo build 12 | cargo run 13 | ``` 14 | 15 | ### Usage 16 | The plan will be to use the Blackmagic videohub ethernet protocol as a way of setting routes. 17 | The format of the protocol is text commands over TCP. 18 | The attached documentation lists the protocol spec (pg 77). 19 | 20 | The server can be accessed at `127.0.0.1:9990`. 21 | 22 | ## TODO 23 | - [x] Fetch NDI sources on network 24 | - [X] Create TCP server to control 25 | - [X] Using NDI routing API to foreward sources 26 | - [X] Make compatible with BMD videohub spec 27 | - [X] Handle Multiple clients 28 | - [ ] Handle output locking 29 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("cargo:libdir=/usr/local/lib"); 3 | println!("cargo:include=/usr/local/include"); 4 | } -------------------------------------------------------------------------------- /config/log4rs.yaml: -------------------------------------------------------------------------------- 1 | refresh_rate: 30 seconds 2 | appenders: 3 | stdout: 4 | kind: console 5 | encoder: 6 | pattern: "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} {h([{l}])} {m}{n}" 7 | root: 8 | level: info 9 | appenders: 10 | - stdout 11 | -------------------------------------------------------------------------------- /docs/VideohubInstallation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moschopsuk/ndi-router/acb981538bc4802a50ec5adaca311bb27110a172/docs/VideohubInstallation.pdf -------------------------------------------------------------------------------- /docs/videohub_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moschopsuk/ndi-router/acb981538bc4802a50ec5adaca311bb27110a172/docs/videohub_example.png -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use tokio::net::{TcpListener, TcpStream}; 2 | use tokio::sync::{Mutex}; 3 | use tokio::stream::{Stream, StreamExt}; 4 | use tokio_util::codec::{Framed, LinesCodec, LinesCodecError}; 5 | use log4rs; 6 | use futures::SinkExt; 7 | use log::{error, info, debug}; 8 | use std::{env, error::Error, mem}; 9 | use std::sync::Arc; 10 | use std::net::SocketAddr; 11 | use std::pin::Pin; 12 | use std::task::{Context, Poll}; 13 | 14 | mod ndi; 15 | mod videohub; 16 | mod peer; 17 | mod shared; 18 | 19 | use crate::videohub::{VideoHub}; 20 | use crate::peer::{Peer}; 21 | use crate::shared::{Shared}; 22 | use crate::ndi::{FindInstance, RouteInstance}; 23 | 24 | const VERSION: &'static str = env!("CARGO_PKG_VERSION"); 25 | const NUM_OUTPUTS: usize = 16; 26 | 27 | #[tokio::main] 28 | async fn main() -> Result<(), Box> { 29 | log4rs::init_file("config/log4rs.yaml", Default::default()).unwrap(); 30 | 31 | info!("starting ndi-router {}", VERSION); 32 | 33 | if !ndi::initialize() { 34 | panic!("Cannot initialize NDI libs"); 35 | } 36 | 37 | let mut find = match FindInstance::builder().show_local_sources(true).build() { 38 | None => panic!(Some("Cannot initialize NDI finder")), 39 | Some(find) => find, 40 | }; 41 | 42 | let new_sources = find.wait_for_sources(100); 43 | let sources = find.get_current_sources(); 44 | let mut outputs = vec![]; 45 | let mut inputs = vec![]; 46 | let mut video_hub = VideoHub::new(sources.len(), NUM_OUTPUTS); 47 | 48 | info!("Found {} NDI sources", sources.len()); 49 | 50 | if new_sources { 51 | let mut i : usize = 0; 52 | for source in &sources { 53 | let label = source.ndi_name().to_owned(); 54 | let ip = source.ip_address().to_owned(); 55 | debug!("Found source '{}' {} ({})", i, label, ip); 56 | video_hub.set_input_label(i, label); 57 | inputs.push(source.to_owned()); 58 | i += 1; 59 | } 60 | } else { 61 | error!("No NDI sources found"); 62 | return Ok(()) 63 | } 64 | 65 | for x in 0..NUM_OUTPUTS { 66 | let name = format!("NDI output {}", x); 67 | let route = match RouteInstance::builder(name.as_str()).build() { 68 | None => panic!(Some("Cannot create NDI route")), 69 | Some(find) => find, 70 | }; 71 | 72 | outputs.push(route); 73 | } 74 | 75 | let state = Arc::new(Mutex::new(Shared::new(video_hub, inputs, outputs))); 76 | 77 | // Parse the arguments, bind the TCP socket we'll be listening to, spin up 78 | // our worker threads, and start shipping sockets to those worker threads. 79 | let addr = env::args() 80 | .nth(1) 81 | .unwrap_or_else(|| "127.0.0.1:9990".to_string()); 82 | 83 | let mut listener = TcpListener::bind(&addr).await?; 84 | 85 | info!("server running on {}", addr); 86 | 87 | loop { 88 | // Asynchronously wait for an inbound TcpStream. 89 | let (stream, addr) = listener.accept().await?; 90 | 91 | // Clone a handle to the `Shared` state for the new connection. 92 | let state = Arc::clone(&state); 93 | 94 | // Spawn our handler to be run asynchronously. 95 | tokio::spawn(async move { 96 | if let Err(e) = process(state, stream, addr).await { 97 | println!("an error occured; error = {:?}", e); 98 | } 99 | }); 100 | } 101 | } 102 | 103 | #[derive(Debug)] 104 | pub enum Message { 105 | /// A message that should be broadcasted to others. 106 | Received(Vec), 107 | 108 | Broadcast(String), 109 | } 110 | 111 | // Peer implements `Stream` in a way that polls both the `Rx`, and `Framed` types. 112 | // A message is produced whenever an event is ready until the `Framed` stream returns `None`. 113 | impl Stream for Peer { 114 | type Item = Result; 115 | 116 | fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { 117 | 118 | if let Poll::Ready(Some(v)) = Pin::new(&mut self.rx).poll_next(cx) { 119 | return Poll::Ready(Some(Ok(Message::Broadcast(v)))); 120 | } 121 | 122 | // Secondly poll the `Framed` stream. 123 | let result: Option<_> = futures::ready!(Pin::new(&mut self.lines).poll_next(cx)); 124 | 125 | Poll::Ready(match result { 126 | // We've received a message we should broadcast to others. 127 | Some(Ok(message)) => { 128 | if message == "" { 129 | Some(Ok(Message::Received(mem::replace(&mut self.buf, vec![])))) 130 | } else { 131 | self.buf.push(message); 132 | Some(Ok(Message::Received(vec!["None".to_owned()]))) 133 | } 134 | }, 135 | 136 | // An error occured. 137 | Some(Err(e)) => Some(Err(e)), 138 | 139 | // The stream has been exhausted. 140 | None => None, 141 | }) 142 | } 143 | } 144 | 145 | /// Process an individual chat client 146 | async fn process( 147 | state: Arc>, 148 | stream: TcpStream, 149 | addr: SocketAddr, 150 | ) -> Result<(), Box> { 151 | info!("New videohub controller connected: {}", addr); 152 | 153 | let mut lines = Framed::new(stream, LinesCodec::new()); 154 | let video_hub = state.lock().await.video_hub.clone(); 155 | lines.send(video_hub.inital_status_dump()).await?; 156 | 157 | // Register our peer with state which internally sets up some channels. 158 | let mut peer = Peer::new(state.clone(), lines).await?; 159 | 160 | // Process incoming messages until our stream is exhausted by a disconnect. 161 | while let Some(result) = peer.next().await { 162 | match result { 163 | // A message was received from the current user, we should 164 | // broadcast this message to the other users. 165 | Ok(Message::Received(msg)) => { 166 | let command = msg.first().unwrap().as_str(); 167 | match command { 168 | "PING:" => { 169 | debug!("sending ACK to {}", peer.addr); 170 | peer.lines.send("ACK\n".to_owned()).await? 171 | }, 172 | "VIDEO OUTPUT ROUTING:" => { 173 | let mut split = msg[1].split_whitespace(); 174 | let mut state = state.lock().await; 175 | let route = state.outputs.get(split.next().unwrap().parse::().unwrap()); 176 | let source = state.inputs.get(split.next().unwrap().parse::().unwrap()); 177 | 178 | route.unwrap().clear(); 179 | route.unwrap().change(source.unwrap()); 180 | let update = format!("{}\n{}\n\n", command, msg[1]); 181 | state.broadcast(addr, &update).await; 182 | peer.lines.send("ACK\n".to_owned()).await? 183 | }, 184 | "VIDEO OUTPUT LOCKS:" => { 185 | println!("{}", msg[1]); 186 | peer.lines.send("ACK\n".to_owned()).await? 187 | } 188 | _ => (), 189 | } 190 | }, 191 | Ok(Message::Broadcast(msg)) => { 192 | peer.lines.send(msg).await?; 193 | } 194 | Err(e) => { 195 | println!( 196 | "an error occured while processing messages error = {:?}", 197 | e 198 | ); 199 | } 200 | } 201 | } 202 | 203 | // If this section is reached it means that the client was disconnected! 204 | // Let's let everyone still connected know about it. 205 | { 206 | info!("Client {} Disconnected", addr); 207 | let mut state = state.lock().await; 208 | state.peers.remove(&addr); 209 | } 210 | 211 | Ok(()) 212 | } -------------------------------------------------------------------------------- /src/ndi/mod.rs: -------------------------------------------------------------------------------- 1 | mod ndisys; 2 | use crate::ndi::ndisys::*; 3 | 4 | use std::ffi; 5 | use std::mem; 6 | use std::ptr; 7 | use std::sync::{Arc, Mutex}; 8 | 9 | use log::{debug, info}; 10 | 11 | pub fn initialize() -> bool { 12 | unsafe { NDIlib_initialize() } 13 | } 14 | 15 | /* 16 | dddddddd 17 | FFFFFFFFFFFFFFFFFFFFFF iiii d::::::d 18 | F::::::::::::::::::::F i::::i d::::::d 19 | F::::::::::::::::::::F iiii d::::::d 20 | FF::::::FFFFFFFFF::::F d:::::d 21 | F:::::F FFFFFFiiiiiiinnnn nnnnnnnn ddddddddd:::::d 22 | F:::::F i:::::in:::nn::::::::nn dd::::::::::::::d 23 | F::::::FFFFFFFFFF i::::in::::::::::::::nn d::::::::::::::::d 24 | F:::::::::::::::F i::::inn:::::::::::::::nd:::::::ddddd:::::d 25 | F:::::::::::::::F i::::i n:::::nnnn:::::nd::::::d d:::::d 26 | F::::::FFFFFFFFFF i::::i n::::n n::::nd:::::d d:::::d 27 | F:::::F i::::i n::::n n::::nd:::::d d:::::d 28 | F:::::F i::::i n::::n n::::nd:::::d d:::::d 29 | FF:::::::FF i::::::i n::::n n::::nd::::::ddddd::::::dd 30 | F::::::::FF i::::::i n::::n n::::n d:::::::::::::::::d 31 | F::::::::FF i::::::i n::::n n::::n d:::::::::ddd::::d 32 | FFFFFFFFFFF iiiiiiii nnnnnn nnnnnn ddddddddd ddddd 33 | */ 34 | 35 | #[derive(Debug)] 36 | pub struct FindBuilder<'a> { 37 | show_local_sources: bool, 38 | groups: Option<&'a str>, 39 | extra_ips: Option<&'a str>, 40 | } 41 | 42 | impl<'a> Default for FindBuilder<'a> { 43 | fn default() -> Self { 44 | Self { 45 | show_local_sources: true, 46 | groups: None, 47 | extra_ips: None, 48 | } 49 | } 50 | } 51 | 52 | impl<'a> FindBuilder<'a> { 53 | pub fn show_local_sources(self, show_local_sources: bool) -> Self { 54 | Self { 55 | show_local_sources, 56 | ..self 57 | } 58 | } 59 | 60 | pub fn build(self) -> Option { 61 | let groups = self.groups.map(|s| ffi::CString::new(s).unwrap()); 62 | let extra_ips = self.extra_ips.map(|s| ffi::CString::new(s).unwrap()); 63 | 64 | unsafe { 65 | let ptr = NDIlib_find_create_v2(&NDIlib_find_create_t { 66 | show_local_sources: self.show_local_sources, 67 | p_groups: groups.as_ref().map(|s| s.as_ptr()).unwrap_or(ptr::null()), 68 | p_extra_ips: extra_ips 69 | .as_ref() 70 | .map(|s| s.as_ptr()) 71 | .unwrap_or(ptr::null()), 72 | }); 73 | if ptr.is_null() { 74 | None 75 | } else { 76 | Some(FindInstance(ptr::NonNull::new_unchecked(ptr))) 77 | } 78 | } 79 | } 80 | } 81 | 82 | #[derive(Debug)] 83 | pub struct FindInstance(ptr::NonNull<::std::os::raw::c_void>); 84 | unsafe impl Send for FindInstance {} 85 | 86 | impl FindInstance { 87 | pub fn builder<'a>() -> FindBuilder<'a> { 88 | FindBuilder::default() 89 | } 90 | 91 | pub fn wait_for_sources(&mut self, timeout_in_ms: u32) -> bool { 92 | unsafe { NDIlib_find_wait_for_sources(self.0.as_ptr(), timeout_in_ms) } 93 | } 94 | 95 | pub fn get_current_sources(&mut self) -> Vec { 96 | unsafe { 97 | let mut no_sources = mem::MaybeUninit::uninit(); 98 | let sources_ptr = 99 | NDIlib_find_get_current_sources(self.0.as_ptr(), no_sources.as_mut_ptr()); 100 | let no_sources = no_sources.assume_init(); 101 | 102 | if sources_ptr.is_null() || no_sources == 0 { 103 | return vec![]; 104 | } 105 | 106 | let mut sources = vec![]; 107 | for i in 0..no_sources { 108 | sources.push(Source::Borrowed( 109 | ptr::NonNull::new_unchecked(sources_ptr.add(i as usize) as *mut _), 110 | self, 111 | )); 112 | } 113 | 114 | sources 115 | } 116 | } 117 | } 118 | 119 | impl Drop for FindInstance { 120 | fn drop(&mut self) { 121 | unsafe { 122 | NDIlib_find_destroy(self.0.as_mut()); 123 | } 124 | } 125 | } 126 | 127 | /* 128 | SSSSSSSSSSSSSSS 129 | SS:::::::::::::::S 130 | S:::::SSSSSS::::::S 131 | S:::::S SSSSSSS 132 | S:::::S ooooooooooo uuuuuu uuuuuu rrrrr rrrrrrrrr cccccccccccccccc eeeeeeeeeeee 133 | S:::::S oo:::::::::::oo u::::u u::::u r::::rrr:::::::::r cc:::::::::::::::c ee::::::::::::ee 134 | S::::SSSS o:::::::::::::::ou::::u u::::u r:::::::::::::::::r c:::::::::::::::::c e::::::eeeee:::::ee 135 | SS::::::SSSSS o:::::ooooo:::::ou::::u u::::u rr::::::rrrrr::::::rc:::::::cccccc:::::ce::::::e e:::::e 136 | SSS::::::::SS o::::o o::::ou::::u u::::u r:::::r r:::::rc::::::c ccccccce:::::::eeeee::::::e 137 | SSSSSS::::S o::::o o::::ou::::u u::::u r:::::r rrrrrrrc:::::c e:::::::::::::::::e 138 | S:::::So::::o o::::ou::::u u::::u r:::::r c:::::c e::::::eeeeeeeeeee 139 | S:::::So::::o o::::ou:::::uuuu:::::u r:::::r c::::::c ccccccce:::::::e 140 | SSSSSSS S:::::So:::::ooooo:::::ou:::::::::::::::uur:::::r c:::::::cccccc:::::ce::::::::e 141 | S::::::SSSSSS:::::So:::::::::::::::o u:::::::::::::::ur:::::r c:::::::::::::::::c e::::::::eeeeeeee 142 | S:::::::::::::::SS oo:::::::::::oo uu::::::::uu:::ur:::::r cc:::::::::::::::c ee:::::::::::::e 143 | SSSSSSSSSSSSSSS ooooooooooo uuuuuuuu uuuurrrrrrr cccccccccccccccc eeeeeeeeeeeeee 144 | */ 145 | 146 | #[derive(Debug)] 147 | pub enum Source<'a> { 148 | Borrowed(ptr::NonNull, &'a FindInstance), 149 | Owned(NDIlib_source_t, ffi::CString, ffi::CString), 150 | } 151 | 152 | unsafe impl<'a> Send for Source<'a> {} 153 | unsafe impl<'a> Sync for Source<'a> {} 154 | 155 | impl<'a> Source<'a> { 156 | pub fn ndi_name(&self) -> &str { 157 | unsafe { 158 | let ptr = match *self { 159 | Source::Borrowed(ptr, _) => &*ptr.as_ptr(), 160 | Source::Owned(ref source, _, _) => source, 161 | }; 162 | 163 | assert!(!ptr.p_ndi_name.is_null()); 164 | ffi::CStr::from_ptr(ptr.p_ndi_name).to_str().unwrap() 165 | } 166 | } 167 | 168 | pub fn ip_address(&self) -> &str { 169 | unsafe { 170 | let ptr = match *self { 171 | Source::Borrowed(ptr, _) => &*ptr.as_ptr(), 172 | Source::Owned(ref source, _, _) => source, 173 | }; 174 | 175 | assert!(!ptr.p_ip_address.is_null()); 176 | ffi::CStr::from_ptr(ptr.p_ip_address).to_str().unwrap() 177 | } 178 | } 179 | 180 | pub fn ndi_name_ptr(&self) -> *const ::std::os::raw::c_char { 181 | unsafe { 182 | match *self { 183 | Source::Borrowed(ptr, _) => ptr.as_ref().p_ndi_name, 184 | Source::Owned(_, ref ndi_name, _) => ndi_name.as_ptr(), 185 | } 186 | } 187 | } 188 | 189 | fn ip_address_ptr(&self) -> *const ::std::os::raw::c_char { 190 | unsafe { 191 | match *self { 192 | Source::Borrowed(ptr, _) => ptr.as_ref().p_ip_address, 193 | Source::Owned(_, _, ref ip_address) => ip_address.as_ptr(), 194 | } 195 | } 196 | } 197 | 198 | pub fn to_owned<'b>(&self) -> Source<'b> { 199 | unsafe { 200 | let (ndi_name, ip_address) = match *self { 201 | Source::Borrowed(ptr, _) => (ptr.as_ref().p_ndi_name, ptr.as_ref().p_ip_address), 202 | Source::Owned(_, ref ndi_name, ref ip_address) => { 203 | (ndi_name.as_ptr(), ip_address.as_ptr()) 204 | } 205 | }; 206 | 207 | let ndi_name = ffi::CString::new(ffi::CStr::from_ptr(ndi_name).to_bytes()).unwrap(); 208 | let ip_address = ffi::CString::new(ffi::CStr::from_ptr(ip_address).to_bytes()).unwrap(); 209 | 210 | Source::Owned( 211 | NDIlib_source_t { 212 | p_ndi_name: ndi_name.as_ptr(), 213 | p_ip_address: ip_address.as_ptr(), 214 | }, 215 | ndi_name, 216 | ip_address, 217 | ) 218 | } 219 | } 220 | } 221 | 222 | /* 223 | RRRRRRRRRRRRRRRRR tttt 224 | R::::::::::::::::R ttt:::t 225 | R::::::RRRRRR:::::R t:::::t 226 | RR:::::R R:::::R t:::::t 227 | R::::R R:::::R ooooooooooo uuuuuu uuuuuuttttttt:::::ttttttt eeeeeeeeeeee 228 | R::::R R:::::R oo:::::::::::oo u::::u u::::ut:::::::::::::::::t ee::::::::::::ee 229 | R::::RRRRRR:::::R o:::::::::::::::ou::::u u::::ut:::::::::::::::::t e::::::eeeee:::::ee 230 | R:::::::::::::RR o:::::ooooo:::::ou::::u u::::utttttt:::::::tttttt e::::::e e:::::e 231 | R::::RRRRRR:::::R o::::o o::::ou::::u u::::u t:::::t e:::::::eeeee::::::e 232 | R::::R R:::::Ro::::o o::::ou::::u u::::u t:::::t e:::::::::::::::::e 233 | R::::R R:::::Ro::::o o::::ou::::u u::::u t:::::t e::::::eeeeeeeeeee 234 | R::::R R:::::Ro::::o o::::ou:::::uuuu:::::u t:::::t tttttte:::::::e 235 | RR:::::R R:::::Ro:::::ooooo:::::ou:::::::::::::::uu t::::::tttt:::::te::::::::e 236 | R::::::R R:::::Ro:::::::::::::::o u:::::::::::::::u tt::::::::::::::t e::::::::eeeeeeee 237 | R::::::R R:::::R oo:::::::::::oo uu::::::::uu:::u tt:::::::::::tt ee:::::::::::::e 238 | RRRRRRRR RRRRRRR ooooooooooo uuuuuuuu uuuu ttttttttttt eeeeeeeeeeeeee 239 | */ 240 | 241 | #[derive(Debug)] 242 | pub struct RouteBuilder<'a> { 243 | ndi_name: &'a str, 244 | groups: Option<&'a str>, 245 | } 246 | 247 | impl<'a> RouteBuilder<'a> { 248 | pub fn build(self) -> Option { 249 | unsafe { 250 | let ndi_name = ffi::CString::new(self.ndi_name).unwrap(); 251 | let groups = self.groups.map(|s| ffi::CString::new(s).unwrap()); 252 | 253 | let ptr = NDIlib_routing_create(&NDIlib_routing_create_t { 254 | p_ndi_name: ndi_name.as_ptr(), 255 | p_groups: groups.as_ref().map(|s| s.as_ptr()).unwrap_or(ptr::null()), 256 | }); 257 | 258 | debug!("creating NDI source {}", self.ndi_name); 259 | 260 | if ptr.is_null() { 261 | None 262 | } else { 263 | Some(RouteInstance(Arc::new(( 264 | RouteInstanceInner(ptr::NonNull::new_unchecked(ptr), self.ndi_name.to_owned()), 265 | Mutex::new(()), 266 | )))) 267 | } 268 | } 269 | } 270 | } 271 | 272 | pub struct RouteInstance(Arc<(RouteInstanceInner, Mutex<()>)>); 273 | 274 | #[derive(Debug)] 275 | struct RouteInstanceInner(ptr::NonNull<::std::os::raw::c_void>, String); 276 | unsafe impl Send for RouteInstanceInner {} 277 | unsafe impl Sync for RouteInstanceInner {} 278 | 279 | impl RouteInstance { 280 | pub fn builder<'a>(ndi_name: &'a str) -> RouteBuilder<'a> { 281 | let groups = None; 282 | RouteBuilder { 283 | ndi_name, 284 | groups 285 | } 286 | } 287 | 288 | pub fn change(&self, source: &Source) { 289 | unsafe { 290 | let _lock = (self.0).1.lock().unwrap(); 291 | info!("routing {:?} to {:?}", source.ndi_name(), ((self.0).0).1); 292 | NDIlib_routing_change( 293 | ((self.0).0).0.as_ptr(), 294 | &NDIlib_source_t { 295 | p_ndi_name: source.ndi_name_ptr(), 296 | p_ip_address: source.ip_address_ptr(), 297 | }); 298 | } 299 | } 300 | 301 | pub fn clear(&self) { 302 | unsafe { 303 | let _lock = (self.0).1.lock().unwrap(); 304 | NDIlib_routing_clear(((self.0).0).0.as_ptr()); 305 | } 306 | } 307 | } 308 | 309 | 310 | impl Drop for RouteInstanceInner { 311 | fn drop(&mut self) { 312 | unsafe { NDIlib_routing_destroy(self.0.as_ptr() as *mut _) } 313 | } 314 | } -------------------------------------------------------------------------------- /src/ndi/ndisys.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] 2 | 3 | #[cfg_attr( 4 | all(target_os = "macos"), 5 | link(name = "ndi") 6 | )] 7 | extern "C" { 8 | pub fn NDIlib_initialize() -> bool; 9 | 10 | pub fn NDIlib_find_create_v2( 11 | p_create_settings: *const NDIlib_find_create_t, 12 | ) -> NDIlib_find_instance_t; 13 | 14 | pub fn NDIlib_find_destroy( 15 | p_instance: NDIlib_find_instance_t 16 | ); 17 | 18 | pub fn NDIlib_find_wait_for_sources( 19 | p_instance: NDIlib_find_instance_t, 20 | timeout_in_ms: u32, 21 | ) -> bool; 22 | 23 | pub fn NDIlib_find_get_current_sources( 24 | p_instance: NDIlib_find_instance_t, 25 | p_no_sources: *mut u32, 26 | ) -> *const NDIlib_source_t; 27 | 28 | pub fn NDIlib_routing_create( 29 | p_create_settings: *const NDIlib_routing_create_t 30 | ) -> NDIlib_routing_instance_t; 31 | 32 | pub fn NDIlib_routing_destroy( 33 | p_instance: NDIlib_routing_instance_t 34 | ); 35 | 36 | pub fn NDIlib_routing_change( 37 | p_instance: NDIlib_routing_instance_t, 38 | p_source: *const NDIlib_source_t 39 | ); 40 | 41 | pub fn NDIlib_routing_clear( 42 | p_instance: NDIlib_routing_instance_t 43 | ); 44 | } 45 | 46 | pub type NDIlib_find_instance_t = *mut ::std::os::raw::c_void; 47 | pub type NDIlib_routing_instance_t = *mut ::std::os::raw::c_void; 48 | 49 | #[repr(C)] 50 | #[derive(Debug, Copy, Clone)] 51 | pub struct NDIlib_find_create_t { 52 | pub show_local_sources: bool, 53 | pub p_groups: *const ::std::os::raw::c_char, 54 | pub p_extra_ips: *const ::std::os::raw::c_char, 55 | } 56 | 57 | #[repr(C)] 58 | #[derive(Debug, Copy, Clone)] 59 | pub struct NDIlib_source_t { 60 | pub p_ndi_name: *const ::std::os::raw::c_char, 61 | pub p_ip_address: *const ::std::os::raw::c_char, 62 | } 63 | 64 | #[repr(C)] 65 | #[derive(Debug, Copy, Clone)] 66 | pub struct NDIlib_routing_create_t { 67 | pub p_ndi_name: *const ::std::os::raw::c_char, 68 | pub p_groups: *const ::std::os::raw::c_char, 69 | } 70 | -------------------------------------------------------------------------------- /src/peer.rs: -------------------------------------------------------------------------------- 1 | use tokio::net::{TcpStream}; 2 | use tokio::sync::{mpsc, Mutex}; 3 | use tokio_util::codec::{Framed, LinesCodec}; 4 | use std::io; 5 | use std::sync::Arc; 6 | 7 | use std::net::SocketAddr; 8 | 9 | use crate::shared::{Shared}; 10 | 11 | /// Shorthand for the transmit half of the message channel. 12 | pub type Tx = mpsc::UnboundedSender; 13 | 14 | /// Shorthand for the receive half of the message channel. 15 | pub type Rx = mpsc::UnboundedReceiver; 16 | 17 | pub struct Peer { 18 | /// The TCP socket wrapped with the `Lines` codec, defined below. 19 | /// 20 | /// This handles sending and receiving data on the socket. When using 21 | /// `Lines`, we can work at the line level instead of having to manage the 22 | /// raw byte operations. 23 | pub lines: Framed, 24 | 25 | pub buf: Vec, 26 | 27 | pub addr: SocketAddr, 28 | 29 | /// Receive half of the message channel. 30 | /// 31 | /// This is used to receive messages from peers. When a message is received 32 | /// off of this `Rx`, it will be written to the socket. 33 | pub rx: Rx, 34 | } 35 | 36 | /// The state for each connected client. 37 | impl Peer { 38 | /// Create a new instance of `Peer`. 39 | pub async fn new( 40 | state: Arc>, 41 | lines: Framed, 42 | ) -> io::Result { 43 | // Get the client socket address 44 | let addr = lines.get_ref().peer_addr()?; 45 | 46 | // Create a channel for this peer 47 | let (tx, rx) = mpsc::unbounded_channel(); 48 | 49 | let buf = Vec::new(); 50 | 51 | // Add an entry for this `Peer` in the shared state map. 52 | state.lock().await.peers.insert(addr, tx); 53 | 54 | Ok(Peer { lines, buf, rx, addr }) 55 | } 56 | } -------------------------------------------------------------------------------- /src/shared.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | use std::net::SocketAddr; 3 | 4 | use crate::videohub::{VideoHub}; 5 | use crate::peer::{Tx}; 6 | use crate::ndi::{Source, RouteInstance}; 7 | 8 | /// Data that is shared between all peers in the chat server. 9 | /// 10 | /// This is the set of `Tx` handles for all connected clients. Whenever a 11 | /// message is received from a client, it is broadcasted to all peers by 12 | /// iterating over the `peers` entries and sending a copy of the message on each 13 | /// `Tx`. 14 | pub struct Shared { 15 | pub peers: HashMap, 16 | pub video_hub: VideoHub, 17 | pub inputs: Vec>, 18 | pub outputs: Vec, 19 | } 20 | 21 | impl Shared { 22 | /// Create a new, empty, instance of `Shared`. 23 | pub fn new(video_hub: VideoHub, inputs: Vec>, outputs: Vec) -> Self { 24 | Shared { 25 | peers: HashMap::new(), 26 | video_hub, 27 | outputs, 28 | inputs 29 | } 30 | } 31 | 32 | /// Send a `LineCodec` encoded message to every peer, except 33 | /// for the sender. 34 | pub async fn broadcast(&mut self, sender: SocketAddr, message: &str) { 35 | for peer in self.peers.iter_mut() { 36 | if *peer.0 != sender { 37 | let _ = peer.1.send(message.into()); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/videohub.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | use std::net::SocketAddr; 3 | 4 | #[derive(Clone)] 5 | pub struct VideoHub { 6 | input_lables: Vec, 7 | output_lables: Vec, 8 | routes: HashMap, 9 | locks: HashMap>, 10 | } 11 | 12 | impl VideoHub { 13 | pub fn new(num_inputs: usize, num_outputs: usize) -> VideoHub { 14 | let mut intial_routing: HashMap = HashMap::with_capacity(num_outputs); 15 | let mut intial_output_labels = Vec::with_capacity(num_outputs); 16 | let mut intial_input_labels = Vec::with_capacity(num_inputs); 17 | let mut intial_locks = HashMap::with_capacity(num_outputs); 18 | 19 | for x in 0..num_inputs { 20 | intial_input_labels.push(format!("NDI Input {}", x)); 21 | } 22 | 23 | for x in 0..num_outputs { 24 | intial_routing.insert(x as u8, x as u8); 25 | intial_output_labels.push(format!("NDI Output {}", x)); 26 | intial_locks.insert(x as u8, None); 27 | } 28 | 29 | VideoHub { 30 | input_lables: intial_input_labels, 31 | output_lables: intial_output_labels, 32 | routes: intial_routing, 33 | locks: intial_locks, 34 | } 35 | } 36 | 37 | pub fn preamble(self) -> String { 38 | format!("PROTOCOL PREAMBLE:\nVersion: {}\n\n", 2.7) 39 | } 40 | 41 | pub fn device_info(self) -> String { 42 | let mut device_info: Vec = Vec::new(); 43 | 44 | device_info.push(format!("VIDEOHUB DEVICE:")); 45 | device_info.push(format!("Device present: true")); 46 | device_info.push(format!("Model name: Blackmagic Smart Videohub")); 47 | device_info.push(format!("Video inputs: {}", self.input_lables.len())); 48 | device_info.push(format!("Video processing units: 0")); 49 | device_info.push(format!("Video outputs: {}", self.output_lables.len())); 50 | device_info.push(format!("Video monitoring outputs: 0")); 51 | device_info.push(format!("Serial ports: 0")); 52 | device_info.push(format!("\n")); 53 | 54 | device_info.join("\n") 55 | } 56 | 57 | pub fn list_inputs(&mut self) -> String { 58 | let mut labels: Vec = Vec::new(); 59 | labels.push(format!("INPUT LABELS:")); 60 | 61 | for (i, label) in self.input_lables.iter().enumerate() { 62 | labels.push(format!("{} {}", i, label)); 63 | } 64 | 65 | labels.push(format!("\n")); 66 | labels.join("\n") 67 | } 68 | 69 | pub fn list_outputs(self) -> String { 70 | let mut labels: Vec = Vec::new(); 71 | labels.push(format!("OUTPUT LABELS:")); 72 | 73 | for (i, label) in self.output_lables.iter().enumerate() { 74 | labels.push(format!("{} {}", i, label)); 75 | } 76 | 77 | labels.push(format!("\n")); 78 | labels.join("\n") 79 | } 80 | 81 | pub fn list_routes(self) -> String { 82 | let mut labels: Vec = Vec::new(); 83 | labels.push(format!("VIDEO OUTPUT ROUTING:")); 84 | 85 | for (input, output) in self.routes.iter() { 86 | labels.push(format!("{} {}", input, output)); 87 | } 88 | 89 | labels.push(format!("\n")); 90 | labels.join("\n") 91 | } 92 | 93 | pub fn list_locks(self) -> String { 94 | let mut labels: Vec = Vec::new(); 95 | labels.push(format!("VIDEO OUTPUT LOCKS:")); 96 | 97 | for (i, _) in self.locks.iter() { 98 | // let state = if *lock { "L" } else { "U" }; 99 | labels.push(format!("{} {}", i, "U")); 100 | } 101 | 102 | labels.push(format!("\n")); 103 | labels.join("\n") 104 | } 105 | 106 | pub fn set_input_label(&mut self, index: usize, label: String) { 107 | std::mem::replace(&mut self.input_lables[index], label); 108 | } 109 | 110 | pub fn inital_status_dump(self) -> String { 111 | let mut initial_dump = Vec::new(); 112 | 113 | initial_dump.push(self.clone().preamble()); 114 | initial_dump.push(self.clone().device_info()); 115 | initial_dump.push(self.clone().list_inputs()); 116 | initial_dump.push(self.clone().list_outputs()); 117 | initial_dump.push(self.clone().list_routes()); 118 | initial_dump.push(self.clone().list_locks()); 119 | 120 | initial_dump.join("") 121 | } 122 | } 123 | --------------------------------------------------------------------------------