aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-06-12 16:18:31 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-06-12 16:18:31 +0200
commit5a8a7cdb622c8b607c2e7f52bc9f12917ee99622 (patch)
tree09e61517f27ddab4372c37a50e63719b734a6b4c
parente6cb09af4353d230189592e288497ea06471f0bd (diff)
downloadnihav-encoder-5a8a7cdb622c8b607c2e7f52bc9f12917ee99622.tar.gz
exit after printing options or lists
-rw-r--r--src/main.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index e37092b..dd308d1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -570,6 +570,7 @@ fn main() {
let mut transcoder = Transcoder::new();
let mut arg_idx = 1;
+ let mut printed_info = false;
while arg_idx < args.len() {
match args[arg_idx].as_str() {
"--list-decoders" => {
@@ -583,6 +584,7 @@ fn main() {
} else {
println!("No registered decoders.");
}
+ printed_info = true;
},
"--list-encoders" => {
if enc_reg.iter().len() > 0 {
@@ -595,6 +597,7 @@ fn main() {
} else {
println!("No registered encoders.");
}
+ printed_info = true;
},
"--list-demuxers" => {
print!("Registered demuxers:");
@@ -602,6 +605,7 @@ fn main() {
print!(" {}", dmx.get_name());
}
println!();
+ printed_info = true;
},
"--list-muxers" => {
print!("Registered muxers:");
@@ -609,6 +613,7 @@ fn main() {
print!(" {}", mux.get_name());
}
println!();
+ printed_info = true;
},
"--query-decoder-options" => {
next_arg!(args, arg_idx);
@@ -620,6 +625,7 @@ fn main() {
} else {
println!("codec {} is not found", cname);
}
+ printed_info = true;
},
"--query-demuxer-options" => {
next_arg!(args, arg_idx);
@@ -633,6 +639,7 @@ fn main() {
} else {
println!("demuxer {} is not found", dname);
}
+ printed_info = true;
},
"--query-encoder-options" => {
next_arg!(args, arg_idx);
@@ -644,6 +651,7 @@ fn main() {
} else {
println!("codec {} is not found", cname);
}
+ printed_info = true;
},
"--query-muxer-options" => {
next_arg!(args, arg_idx);
@@ -658,6 +666,7 @@ fn main() {
} else {
println!("muxer {} is not found", name);
}
+ printed_info = true;
},
"--input" => {
next_arg!(args, arg_idx);
@@ -720,6 +729,10 @@ fn main() {
arg_idx += 1;
}
+ if printed_info {
+ return;
+ }
+
if transcoder.input_name.len() == 0 {
println!("no input name provided");
return;