upgrade examples from structopt to clap 4.0
This commit is contained in:
parent
9682f4e52c
commit
74ff5de837
260
Cargo.lock
generated
260
Cargo.lock
generated
@ -101,15 +101,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.58"
|
||||
@ -145,7 +136,7 @@ version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
@ -346,13 +337,46 @@ version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim 0.8.0",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"is-terminal",
|
||||
"once_cell",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -361,12 +385,12 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
"clap 4.1.4",
|
||||
"futures",
|
||||
"itertools",
|
||||
"log",
|
||||
"mylog",
|
||||
"retina",
|
||||
"structopt",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
@ -432,7 +456,7 @@ checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"cast 0.3.0",
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"criterion-plot",
|
||||
"csv",
|
||||
"futures",
|
||||
@ -622,7 +646,7 @@ dependencies = [
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.10.0",
|
||||
"strsim",
|
||||
"syn",
|
||||
]
|
||||
|
||||
@ -848,8 +872,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e11dcc7e4d79a8c89b9ab4c6f5c30b1fc4a83c420792da3542fd31179ed5f517"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
"rustix 0.35.7",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1063,12 +1087,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
@ -1079,6 +1100,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
@ -1168,12 +1198,34 @@ version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb"
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
|
||||
dependencies = [
|
||||
"hermit-abi 0.2.6",
|
||||
"io-lifetimes 1.0.4",
|
||||
"rustix 0.36.7",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.3"
|
||||
@ -1225,9 +1277,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
@ -1235,6 +1287,12 @@ version = "0.0.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.7"
|
||||
@ -1299,7 +1357,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1420,7 +1478,7 @@ version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@ -1460,6 +1518,12 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
||||
|
||||
[[package]]
|
||||
name = "p256"
|
||||
version = "0.10.1"
|
||||
@ -1492,7 +1556,7 @@ dependencies = [
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-sys",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1642,9 +1706,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -1918,10 +1982,24 @@ checksum = "d51cc38aa10f6bbb377ed28197aa052aa4e2b762c22be9d3153d01822587e787"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"io-lifetimes 0.7.2",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
"linux-raw-sys 0.0.46",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes 1.0.4",
|
||||
"libc",
|
||||
"linux-raw-sys 0.1.4",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2185,42 +2263,12 @@ version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stun"
|
||||
version = "0.4.2"
|
||||
@ -2284,6 +2332,15 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
@ -2520,12 +2577,6 @@ dependencies = [
|
||||
"getrandom 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
@ -2792,6 +2843,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
"clap 4.1.4",
|
||||
"futures",
|
||||
"log",
|
||||
"mylog",
|
||||
@ -2799,7 +2851,6 @@ dependencies = [
|
||||
"rustyline",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"structopt",
|
||||
"tokio",
|
||||
"url",
|
||||
"webrtc",
|
||||
@ -2904,43 +2955,100 @@ version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_msvc 0.36.1",
|
||||
"windows_i686_gnu 0.36.1",
|
||||
"windows_i686_msvc 0.36.1",
|
||||
"windows_x86_64_gnu 0.36.1",
|
||||
"windows_x86_64_msvc 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.2.0"
|
||||
|
@ -15,4 +15,4 @@ url = "2.2.1"
|
||||
anyhow = "1.0.41"
|
||||
itertools = "0.10.1"
|
||||
mylog = { git = "https://github.com/scottlamb/mylog" }
|
||||
structopt = "0.3.21"
|
||||
clap = { version = "4.1.4", features = ["derive"] }
|
||||
|
@ -4,18 +4,19 @@
|
||||
//! Gets info about available streams and exits.
|
||||
|
||||
use anyhow::Error;
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(structopt::StructOpt)]
|
||||
#[derive(Parser)]
|
||||
pub struct Opts {
|
||||
#[structopt(flatten)]
|
||||
#[command(flatten)]
|
||||
src: super::Source,
|
||||
|
||||
/// Prints the SDP (Session Description Protocol) session description.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
print_sdp: bool,
|
||||
|
||||
/// Prints debug output for each decoded stream.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
print_streams: bool,
|
||||
}
|
||||
|
||||
|
@ -8,26 +8,26 @@ mod mp4;
|
||||
mod onvif;
|
||||
|
||||
use anyhow::Error;
|
||||
use clap::Parser;
|
||||
use log::{error, info};
|
||||
use std::str::FromStr;
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
#[derive(Parser)]
|
||||
struct Source {
|
||||
/// `rtsp://` URL to connect to.
|
||||
#[structopt(long, parse(try_from_str))]
|
||||
#[clap(long)]
|
||||
url: url::Url,
|
||||
|
||||
/// Username to send if the server requires authentication.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
username: Option<String>,
|
||||
|
||||
/// Password; requires username.
|
||||
#[structopt(long, requires = "username")]
|
||||
#[clap(long, requires = "username")]
|
||||
password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(StructOpt)]
|
||||
#[derive(Parser)]
|
||||
enum Cmd {
|
||||
/// Gets info about available streams and exits.
|
||||
Info(info::Opts),
|
||||
@ -75,12 +75,12 @@ fn creds(
|
||||
password: password.unwrap_or_default(),
|
||||
}),
|
||||
(None, None) => None,
|
||||
_ => unreachable!(), // structopt/clap enforce that password requires username.
|
||||
_ => unreachable!(), // clap enforces that password requires username.
|
||||
}
|
||||
}
|
||||
|
||||
async fn main_inner() -> Result<(), Error> {
|
||||
let cmd = Cmd::from_args();
|
||||
let cmd = Cmd::parse();
|
||||
match cmd {
|
||||
Cmd::Info(opts) => info::run(opts).await,
|
||||
Cmd::Mp4(opts) => mp4::run(opts).await,
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
use anyhow::{anyhow, bail, Context, Error};
|
||||
use bytes::{Buf, BufMut, BytesMut};
|
||||
use clap::Parser;
|
||||
use futures::{Future, StreamExt};
|
||||
use log::{debug, info, warn};
|
||||
use retina::{
|
||||
@ -35,44 +36,43 @@ use tokio::{
|
||||
io::{AsyncSeek, AsyncSeekExt, AsyncWrite, AsyncWriteExt},
|
||||
};
|
||||
|
||||
#[derive(structopt::StructOpt)]
|
||||
#[derive(Parser)]
|
||||
pub struct Opts {
|
||||
#[structopt(flatten)]
|
||||
#[command(flatten)]
|
||||
src: super::Source,
|
||||
|
||||
/// Policy for handling the `rtptime` parameter normally seem in the `RTP-Info` header.
|
||||
/// One of `default`, `require`, `ignore`, `permissive`.
|
||||
#[structopt(default_value, long)]
|
||||
#[arg(default_value_t, long)]
|
||||
initial_timestamp: retina::client::InitialTimestampPolicy,
|
||||
|
||||
/// Don't attempt to include video streams.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
no_video: bool,
|
||||
|
||||
/// Don't attempt to include audio streams.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
no_audio: bool,
|
||||
|
||||
/// Allow lost packets mid-stream without aborting.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
allow_loss: bool,
|
||||
|
||||
/// When to issue a `TEARDOWN` request: `auto`, `always`, or `never`.
|
||||
#[structopt(default_value, long)]
|
||||
#[arg(default_value_t, long)]
|
||||
teardown: retina::client::TeardownPolicy,
|
||||
|
||||
/// Duration after which to exit automatically, in seconds.
|
||||
#[structopt(long, name = "secs")]
|
||||
#[arg(long, name = "secs")]
|
||||
duration: Option<u64>,
|
||||
|
||||
/// The transport to use: `tcp` or `udp` (experimental).
|
||||
///
|
||||
/// Note: `--allow-loss` is strongly recommended with `udp`.
|
||||
#[structopt(default_value, long)]
|
||||
#[arg(default_value_t, long)]
|
||||
transport: retina::client::Transport,
|
||||
|
||||
/// Path to `.mp4` file to write.
|
||||
#[structopt(parse(try_from_str))]
|
||||
out: PathBuf,
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use anyhow::{anyhow, Error};
|
||||
use clap::Parser;
|
||||
use futures::StreamExt;
|
||||
use log::{error, info};
|
||||
use retina::client::{SessionGroup, SetupOptions};
|
||||
use retina::codec::CodecItem;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(structopt::StructOpt)]
|
||||
#[derive(Parser)]
|
||||
pub struct Opts {
|
||||
#[structopt(flatten)]
|
||||
#[command(flatten)]
|
||||
src: super::Source,
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
anyhow = "1.0.41"
|
||||
base64 = "0.13.0"
|
||||
clap = { version = "4.1.4", features = ["derive"] }
|
||||
futures = "0.3.14"
|
||||
log = "0.4.8"
|
||||
mylog = { git = "https://github.com/scottlamb/mylog" }
|
||||
@ -15,7 +16,6 @@ retina = { path = "../../" }
|
||||
rustyline = { version = "9.1.2", default-features = false }
|
||||
serde = "1.0.139"
|
||||
serde_json = "1.0.82"
|
||||
structopt = "0.3.21"
|
||||
tokio = { version = "1.5.0", features = ["macros", "rt-multi-thread", "signal"] }
|
||||
url = "2.2.1"
|
||||
webrtc = "0.4.0"
|
||||
|
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use anyhow::{anyhow, bail, Error};
|
||||
use clap::Parser;
|
||||
use futures::StreamExt;
|
||||
use log::{error, info};
|
||||
use retina::{
|
||||
@ -9,7 +10,6 @@ use retina::{
|
||||
codec::{CodecItem, VideoFrame},
|
||||
};
|
||||
use std::{str::FromStr, sync::Arc};
|
||||
use structopt::StructOpt;
|
||||
use webrtc::{
|
||||
api::{interceptor_registry::register_default_interceptors, APIBuilder},
|
||||
ice_transport::{ice_connection_state::RTCIceConnectionState, ice_server::RTCIceServer},
|
||||
@ -33,26 +33,26 @@ use webrtc::{
|
||||
///
|
||||
/// A future version might embed a webserver so you can just go to the supplied
|
||||
/// URL and have everything work.
|
||||
#[derive(StructOpt)]
|
||||
#[derive(Parser)]
|
||||
struct Opts {
|
||||
/// `rtsp://` URL to connect to.
|
||||
#[structopt(long, parse(try_from_str))]
|
||||
#[arg(long)]
|
||||
url: url::Url,
|
||||
|
||||
/// Username to send if the server requires authentication.
|
||||
#[structopt(long)]
|
||||
#[arg(long)]
|
||||
username: Option<String>,
|
||||
|
||||
/// Password; requires username.
|
||||
#[structopt(long, requires = "username")]
|
||||
#[arg(long, requires = "username")]
|
||||
password: Option<String>,
|
||||
|
||||
/// When to issue a `TEARDOWN` request: `auto`, `always`, or `never`.
|
||||
#[structopt(default_value, long)]
|
||||
#[arg(default_value_t, long)]
|
||||
teardown: retina::client::TeardownPolicy,
|
||||
|
||||
/// The transport to use: `tcp` or `udp` (experimental).
|
||||
#[structopt(default_value, long)]
|
||||
#[arg(default_value_t, long)]
|
||||
transport: retina::client::Transport,
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ fn read_offer() -> Result<RTCSessionDescription, Error> {
|
||||
}
|
||||
|
||||
async fn run() -> Result<(), Error> {
|
||||
let opts = Opts::from_args();
|
||||
let opts = Opts::parse();
|
||||
let creds = match (opts.username, opts.password) {
|
||||
(Some(username), password) => Some(retina::client::Credentials {
|
||||
username,
|
||||
|
Loading…
Reference in New Issue
Block a user