From 18b934c2970ed89208b01e2af43ee2aa22c9b14c Mon Sep 17 00:00:00 2001 From: quietvoid <39477805+quietvoid@users.noreply.github.com> Date: Thu, 29 Sep 2022 19:16:26 -0400 Subject: [PATCH] Update clap & hevc_parser --- Cargo.lock | 82 ++++++++++++++++--------------------- Cargo.toml | 8 ++-- dolby_vision/Cargo.toml | 4 +- src/commands/convert.rs | 12 +++--- src/commands/demux.rs | 14 +++---- src/commands/editor.rs | 14 +++---- src/commands/export.rs | 12 +++--- src/commands/extract_rpu.rs | 10 ++--- src/commands/generate.rs | 31 ++++++++------ src/commands/info.rs | 14 +++---- src/commands/inject_rpu.rs | 18 ++++---- src/commands/mod.rs | 28 ++++++------- src/commands/mux.rs | 21 ++++------ src/dovi/generator.rs | 8 ++-- src/dovi/mod.rs | 2 +- src/main.rs | 18 ++++---- tests/mod.rs | 2 +- 17 files changed, 141 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d3a78d..9080ca6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,27 +125,25 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.22" +version = "4.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "7f78ad8e84aa8e8aa3e821857be40eb4b925ff232de430d4dd2ae6aa058cbd92" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", "once_cell", "strsim", "termcolor", "terminal_size 0.2.1", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "ca689d7434ce44517a12a89456b2be4d1ea1cafcd8f581978c03d45f5a5c12a7" dependencies = [ "heck", "proc-macro-error", @@ -156,22 +154,22 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] [[package]] name = "console" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89eab4d20ce20cea182308bca13088fecea9c05f6776cf287205d41a0ed3c847" +checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" dependencies = [ "encode_unicode", + "lazy_static", "libc", - "once_cell", "terminal_size 0.1.17", "unicode-width", "winapi", @@ -194,12 +192,11 @@ checksum = "2d0165d2900ae6778e36e80bbc4da3b5eefccee9ba939761f9c2882a5d9af3ff" [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -414,9 +411,9 @@ dependencies = [ [[package]] name = "hevc_parser" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d61e626001ccb5247eebfb11c9246517ebcb535050a8de693e6ba644eaf8650" +checksum = "1e36a04d2c1ecdd400308b3739833ab4e2e02df458ce388c8d6a2969c5d99eff" dependencies = [ "anyhow", "bitvec_helpers", @@ -490,9 +487,9 @@ checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06" [[package]] name = "itertools" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf247779e67a9082a4790b45e71ac7cfd1321331a5c856a74a9faebdab78d0" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -505,9 +502,9 @@ checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jobserver" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" dependencies = [ "libc", ] @@ -520,9 +517,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "329c933548736bc49fd575ee68c89e8be4d260064184389a5b77517cddd99ffb" [[package]] name = "libgit2-sys" @@ -627,9 +624,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "once_cell" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "os_str_bytes" @@ -705,9 +702,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" dependencies = [ "unicode-ident", ] @@ -779,9 +776,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.35.9" +version = "0.35.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada" +checksum = "fbb2fda4666def1433b1b05431ab402e42a1084285477222b72d6c564c417cef" dependencies = [ "bitflags", "errno", @@ -814,18 +811,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.144" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" dependencies = [ "proc-macro2", "quote", @@ -852,9 +849,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e" +checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" dependencies = [ "proc-macro2", "quote", @@ -916,29 +913,20 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" -[[package]] -name = "textwrap" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" -dependencies = [ - "terminal_size 0.2.1", -] - [[package]] name = "thiserror" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c867008..35eb3ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,18 +9,18 @@ build = "build.rs" [dependencies] bitvec_helpers = "2.0.0" -hevc_parser = { version = "0.5.0", features = ["hevc_io"] } +hevc_parser = { version = "0.5.1", features = ["hevc_io"] } dolby_vision = { path = "dolby_vision", "features" = ["xml", "serde_feature"] } madvr_parse = "1.0.1" anyhow = "1.0.65" -clap = { version = "3.2.22", features = ["derive", "wrap_help", "deprecated"] } +clap = { version = "4.0.4", features = ["derive", "wrap_help", "deprecated"] } indicatif = "0.17.1" regex = "1.6.0" bitvec = "1.0.1" -serde = { version = "1.0.144", features = ["derive"] } +serde = { version = "1.0.145", features = ["derive"] } serde_json = { version = "1.0.85", features = ["preserve_order"] } -itertools = "0.10.4" +itertools = "0.10.5" [dev-dependencies] assert_cmd = "2.0.4" diff --git a/dolby_vision/Cargo.toml b/dolby_vision/Cargo.toml index 85c962b..c10ddd5 100644 --- a/dolby_vision/Cargo.toml +++ b/dolby_vision/Cargo.toml @@ -13,11 +13,11 @@ bitvec_helpers = "2.0.0" anyhow = "1.0.65" bitvec = "1.0.1" crc = "3.0.0" -serde = { version = "1.0.144", features = ["derive"], "optional" = true } +serde = { version = "1.0.145", features = ["derive"], "optional" = true } serde_json = { version = "1.0.85", features = ["preserve_order"], "optional" = true } roxmltree = { version = "0.15.0", optional = true } -libc = { version = "0.2.132", optional = true } +libc = { version = "0.2.134", optional = true } [features] xml = ["roxmltree"] diff --git a/src/commands/convert.rs b/src/commands/convert.rs index b33cbce..ea18de0 100644 --- a/src/commands/convert.rs +++ b/src/commands/convert.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct ConvertArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input HEVC file to use, or piped with -", long, short = 'i', @@ -14,8 +14,8 @@ pub struct ConvertArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input HEVC file to use, or piped with - (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,7 +23,7 @@ pub struct ConvertArgs { )] pub input_pos: Option, - #[clap( + #[arg( long, short = 'o', help = "Converted single layer output file location", @@ -31,6 +31,6 @@ pub struct ConvertArgs { )] pub output: Option, - #[clap(short = 'd', long, help = "Discard the EL stream")] + #[arg(short = 'd', long, help = "Discard the EL stream")] pub discard: bool, } diff --git a/src/commands/demux.rs b/src/commands/demux.rs index f455b7e..28cff62 100644 --- a/src/commands/demux.rs +++ b/src/commands/demux.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct DemuxArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input HEVC file to use, or piped with -", long, short = 'i', @@ -14,8 +14,8 @@ pub struct DemuxArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input HEVC file to use, or piped with - (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,7 +23,7 @@ pub struct DemuxArgs { )] pub input_pos: Option, - #[clap( + #[arg( long, short = 'b', help = "BL output file location", @@ -31,7 +31,7 @@ pub struct DemuxArgs { )] pub bl_out: Option, - #[clap( + #[arg( long, short = 'e', help = "EL output file location", @@ -39,6 +39,6 @@ pub struct DemuxArgs { )] pub el_out: Option, - #[clap(long, help = "Output the EL file only")] + #[arg(long, help = "Output the EL file only")] pub el_only: bool, } diff --git a/src/commands/editor.rs b/src/commands/editor.rs index ac541b6..4b33e72 100644 --- a/src/commands/editor.rs +++ b/src/commands/editor.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct EditorArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input RPU file to use", long, short = 'i', @@ -14,8 +14,8 @@ pub struct EditorArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input RPU file to use (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,8 +23,8 @@ pub struct EditorArgs { )] pub input_pos: Option, - #[clap( - name = "json", + #[arg( + id = "json", long, short = 'j', help = "Sets the edit JSON file to use", @@ -32,7 +32,7 @@ pub struct EditorArgs { )] pub json_file: PathBuf, - #[clap( + #[arg( long, short = 'o', help = "Modified RPU output file location", diff --git a/src/commands/export.rs b/src/commands/export.rs index b0546bf..19fbd29 100644 --- a/src/commands/export.rs +++ b/src/commands/export.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct ExportArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input RPU file to use", long, short = 'i', @@ -14,8 +14,8 @@ pub struct ExportArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input RPU file to use (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,8 +23,8 @@ pub struct ExportArgs { )] pub input_pos: Option, - #[clap( - name = "output", + #[arg( + id = "output", long, short = 'o', help = "Output JSON file name", diff --git a/src/commands/extract_rpu.rs b/src/commands/extract_rpu.rs index 9f7d4e0..804b00b 100644 --- a/src/commands/extract_rpu.rs +++ b/src/commands/extract_rpu.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct ExtractRpuArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input HEVC file to use, or piped with -", long, short = 'i', @@ -14,8 +14,8 @@ pub struct ExtractRpuArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input HEVC file to use, or piped with - (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,7 +23,7 @@ pub struct ExtractRpuArgs { )] pub input_pos: Option, - #[clap( + #[arg( long, short = 'o', help = "RPU output file location", diff --git a/src/commands/generate.rs b/src/commands/generate.rs index 37a0a45..31bbe04 100644 --- a/src/commands/generate.rs +++ b/src/commands/generate.rs @@ -5,8 +5,8 @@ use crate::dovi::generator::GeneratorProfile; #[derive(Args, Debug, Default)] pub struct GenerateArgs { - #[clap( - name = "json", + #[arg( + id = "json", long, short = 'j', help = "Sets the generator config JSON file to use", @@ -16,7 +16,7 @@ pub struct GenerateArgs { )] pub json_file: Option, - #[clap( + #[arg( long, short = 'o', help = "Generated RPU output file location", @@ -24,8 +24,8 @@ pub struct GenerateArgs { )] pub rpu_out: Option, - #[clap( - name = "hdr10plus-json", + #[arg( + id = "hdr10plus-json", long, help = "HDR10+ JSON file to generate from", conflicts_with = "madvr-file", @@ -33,7 +33,7 @@ pub struct GenerateArgs { )] pub hdr10plus_json: Option, - #[clap( + #[arg( short = 'x', long, help = "XML metadata file to generate from", @@ -43,29 +43,34 @@ pub struct GenerateArgs { )] pub xml: Option, - #[clap(long, help = "Canvas width for L5 metadata generation")] + #[arg(long, help = "Canvas width for L5 metadata generation")] pub canvas_width: Option, - #[clap(long, help = "Canvas height for L5 metadata generation")] + #[arg(long, help = "Canvas height for L5 metadata generation")] pub canvas_height: Option, - #[clap( - name = "madvr-file", + #[arg( + id = "madvr-file", long, help = "madVR measurement file to generate from", value_hint = ValueHint::FilePath )] pub madvr_file: Option, - #[clap( + #[arg( long, help = "madVR source: use custom per-frame target nits if available" )] pub use_custom_targets: bool, - #[clap(arg_enum, short = 'p', long, help = "Dolby Vision profile to generate")] + #[arg( + value_enum, + short = 'p', + long, + help = "Dolby Vision profile to generate" + )] pub profile: Option, - #[clap(long, help = "Set scene cut flag for every frame")] + #[arg(long, help = "Set scene cut flag for every frame")] pub long_play_mode: Option, } diff --git a/src/commands/info.rs b/src/commands/info.rs index e7e77b0..f0a5cbd 100644 --- a/src/commands/info.rs +++ b/src/commands/info.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct InfoArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input RPU file to use", long, short = 'i', @@ -14,8 +14,8 @@ pub struct InfoArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input RPU file to use (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,14 +23,14 @@ pub struct InfoArgs { )] pub input_pos: Option, - #[clap( - name = "frame", + #[arg( + id = "frame", long, short = 'f', help = "Frame number to show info for" )] pub frame: Option, - #[clap(name = "summary", long, short = 's', help = "Show the RPU summary")] + #[arg(id = "summary", long, short = 's', help = "Show the RPU summary")] pub summary: bool, } diff --git a/src/commands/inject_rpu.rs b/src/commands/inject_rpu.rs index e22af55..ca20521 100644 --- a/src/commands/inject_rpu.rs +++ b/src/commands/inject_rpu.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct InjectRpuArgs { - #[clap( - name = "input", + #[arg( + id = "input", help = "Sets the input HEVC file to use", long, short = 'i', @@ -14,8 +14,8 @@ pub struct InjectRpuArgs { )] pub input: Option, - #[clap( - name = "input_pos", + #[arg( + id = "input_pos", help = "Sets the input HEVC file to use (positional)", conflicts_with = "input", required_unless_present = "input", @@ -23,10 +23,10 @@ pub struct InjectRpuArgs { )] pub input_pos: Option, - #[clap(long, short = 'r', help = "Sets the input RPU file to use", value_hint = ValueHint::FilePath)] + #[arg(long, short = 'r', help = "Sets the input RPU file to use", value_hint = ValueHint::FilePath)] pub rpu_in: PathBuf, - #[clap( + #[arg( long, short = 'o', help = "Output HEVC file location", @@ -34,10 +34,6 @@ pub struct InjectRpuArgs { )] pub output: Option, - #[clap( - long, - takes_value = false, - help = "Disable adding AUD NALUs between frames" - )] + #[arg(long, num_args = 0, help = "Disable adding AUD NALUs between frames")] pub no_add_aud: bool, } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index c730ec1..0ff2d34 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -24,47 +24,47 @@ pub use mux::MuxArgs; #[derive(Parser, Debug)] pub enum Command { - #[clap(about = "Converts RPU within a single layer HEVC file")] + #[command(about = "Converts RPU within a single layer HEVC file")] Convert(ConvertArgs), - #[clap( + #[command( about = "Demuxes single track dual layer Dolby Vision into Base layer and Enhancement layer files" )] Demux(DemuxArgs), - #[clap(about = "Edits a binary RPU according to a JSON config")] + #[command(about = "Edits a binary RPU according to a JSON config")] Editor(EditorArgs), - #[clap(about = "Exports a binary RPU file to JSON for simpler analysis")] + #[command(about = "Exports a binary RPU file to JSON for simpler analysis")] Export(ExportArgs), - #[clap(about = "Extracts Dolby Vision RPU from an HEVC file")] + #[command(about = "Extracts Dolby Vision RPU from an HEVC file")] ExtractRpu(ExtractRpuArgs), - #[clap(about = "Interleaves RPU NAL units between slices in an HEVC encoded bitstream")] + #[command(about = "Interleaves RPU NAL units between slices in an HEVC encoded bitstream")] InjectRpu(InjectRpuArgs), - #[clap(about = "Generates a binary RPU from different sources")] + #[command(about = "Generates a binary RPU from different sources")] Generate(GenerateArgs), - #[clap(about = "Prints the parsed RPU data as JSON for a specific frame")] + #[command(about = "Prints the parsed RPU data as JSON for a specific frame")] Info(InfoArgs), - #[clap(about = "Interleaves the enhancement layer into a base layer HEVC bitstream")] + #[command(about = "Interleaves the enhancement layer into a base layer HEVC bitstream")] Mux(MuxArgs), } #[derive(clap::ValueEnum, Debug, Copy, Clone)] pub enum ConversionModeCli { - #[clap(name = "0")] + #[value(name = "0")] Lossless = 0, - #[clap(name = "1")] + #[value(name = "1")] ToMel, - #[clap(name = "2")] + #[value(name = "2")] To81, - #[clap(name = "3")] + #[value(name = "3")] Profile5To81, - #[clap(name = "4")] + #[value(name = "4")] To84, } diff --git a/src/commands/mux.rs b/src/commands/mux.rs index 3c1a9e8..58a3ef6 100644 --- a/src/commands/mux.rs +++ b/src/commands/mux.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; #[derive(Args, Debug)] pub struct MuxArgs { - #[clap( - name = "bl", + #[arg( + id = "bl", long, short = 'b', help = "Sets the base layer HEVC file to use", @@ -12,8 +12,8 @@ pub struct MuxArgs { )] pub bl: PathBuf, - #[clap( - name = "el", + #[arg( + id = "el", long, short = 'e', help = "Sets the input enhancement layer HEVC file to use", @@ -21,7 +21,7 @@ pub struct MuxArgs { )] pub el: PathBuf, - #[clap( + #[arg( long, short = 'o', help = "Output BL+EL+RPU HEVC file location", @@ -29,16 +29,11 @@ pub struct MuxArgs { )] pub output: Option, - #[clap( - long, - takes_value = false, - help = "Disable adding AUD NALUs between frames" - )] + #[arg(long, num_args = 0, help = "Disable adding AUD NALUs between frames")] pub no_add_aud: bool, - #[clap( + #[arg( long, - takes_value = false, help = "Write the EOS/EOB NALUs before the EL. Defaults to false. See --help for more info", long_help = "Write the EOS/EOB NALUs before the EL. Defaults to false.\n\ In the case of the last frame containing EOS/EOB NALUs, they are written after the EL by default.\n\n\ @@ -47,7 +42,7 @@ pub struct MuxArgs { )] pub eos_before_el: bool, - #[clap( + #[arg( short = 'd', long, help = "Discard the EL video NALUs, keeping only the RPU" diff --git a/src/dovi/generator.rs b/src/dovi/generator.rs index cb275ce..9487800 100644 --- a/src/dovi/generator.rs +++ b/src/dovi/generator.rs @@ -12,13 +12,13 @@ use dolby_vision::rpu::generate::{GenerateConfig, GenerateProfile, ShotFrameEdit use dolby_vision::utils::nits_to_pq; use dolby_vision::xml::{CmXmlParser, XmlParserOpts}; -#[derive(clap::ArgEnum, Debug, Clone, Copy, PartialEq, Eq)] +#[derive(clap::ValueEnum, Debug, Clone, Copy, PartialEq, Eq)] pub enum GeneratorProfile { - #[clap(name = "5")] + #[value(name = "5")] Profile5, - #[clap(name = "8.1")] + #[value(name = "8.1")] Profile81, - #[clap(name = "8.4")] + #[value(name = "8.4")] Profile84, } diff --git a/src/dovi/mod.rs b/src/dovi/mod.rs index daa6947..1538721 100644 --- a/src/dovi/mod.rs +++ b/src/dovi/mod.rs @@ -36,7 +36,7 @@ pub struct CliOptions { pub start_code: WriteStartCodePreset, } -#[derive(clap::ArgEnum, Debug, Clone, Copy, PartialEq, Eq)] +#[derive(clap::ValueEnum, Debug, Clone, Copy, PartialEq, Eq)] pub enum WriteStartCodePreset { Four, AnnexB, diff --git a/src/main.rs b/src/main.rs index 4bc4f67..05cfdef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,15 +24,15 @@ use dovi::{ }; #[derive(Parser, Debug)] -#[clap( +#[command( name = env!("CARGO_PKG_NAME"), about = "CLI tool combining multiple utilities for working with Dolby Vision", author = "quietvoid", version = option_env!("VERGEN_GIT_SEMVER_LIGHTWEIGHT").unwrap_or(env!("VERGEN_BUILD_SEMVER")) )] struct Opt { - #[clap( - name = "mode", + #[arg( + id = "mode", short = 'm', long, help = "Sets the mode for RPU processing. See --help for more info", @@ -46,32 +46,32 @@ struct Opt { )] mode: Option, - #[clap( + #[arg( long, short = 'c', help = "Set active area offsets to 0 (meaning no letterbox bars)" )] crop: bool, - #[clap(long, help = "Ignore HDR10+ metadata when writing the output HEVC.")] + #[arg(long, help = "Ignore HDR10+ metadata when writing the output HEVC.")] drop_hdr10plus: bool, - #[clap( + #[arg( long, help = "Sets the edit JSON config file to use", value_hint = ValueHint::FilePath )] edit_config: Option, - #[clap( - arg_enum, + #[arg( + value_enum, long, help = "Start code to use when writing HEVC", default_value = "four" )] start_code: WriteStartCodePreset, - #[clap(subcommand)] + #[command(subcommand)] cmd: Command, } diff --git a/tests/mod.rs b/tests/mod.rs index e650b76..2a1a911 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -13,7 +13,7 @@ fn help() -> Result<()> { assert .success() .stderr(predicate::str::is_empty()) - .stdout(predicate::str::contains("dovi_tool [OPTIONS] ")); + .stdout(predicate::str::contains("dovi_tool [OPTIONS] ")); Ok(()) }