]> git.nihav.org Git - nihav-encoder.git/commitdiff
add options to print codec and (de)muxer lists
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 12 Jun 2020 14:14:53 +0000 (16:14 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 12 Jun 2020 14:14:53 +0000 (16:14 +0200)
src/main.rs

index 55630fcdcc4161c96867f5210a70037da98c02ad..e37092badf81b46d1720f2b976d494b56335fa77 100644 (file)
@@ -13,6 +13,7 @@ use nihav_core::muxers::*;
 use nihav_core::scale::*;
 use nihav_core::soundcvt::*;
 use nihav_registry::detect;
+use nihav_registry::register;
 use nihav_allstuff::*;
 use std::env;
 
@@ -571,6 +572,44 @@ fn main() {
     let mut arg_idx = 1;
     while arg_idx < args.len() {
         match args[arg_idx].as_str() {
+            "--list-decoders" => {
+                if dec_reg.iter().len() > 0 {
+                    println!("Registered decoders:");
+                    for dec in dec_reg.iter() {
+                        let cdesc = register::get_codec_description(dec.name);
+                        let full_name = if let Some(cd) = cdesc { cd.get_full_name() } else { "???" };
+                        println!(" {} ({})", dec.name, full_name);
+                    }
+                } else {
+                    println!("No registered decoders.");
+                }
+            },
+            "--list-encoders" => {
+                if enc_reg.iter().len() > 0 {
+                    println!("Registered encoders:");
+                    for enc in enc_reg.iter() {
+                        let cdesc = register::get_codec_description(enc.name);
+                        let full_name = if let Some(cd) = cdesc { cd.get_full_name() } else { "???" };
+                        println!(" {} ({})", enc.name, full_name);
+                    }
+                } else {
+                    println!("No registered encoders.");
+                }
+            },
+            "--list-demuxers" => {
+                print!("Registered demuxers:");
+                for dmx in dmx_reg.iter() {
+                    print!(" {}", dmx.get_name());
+                }
+                println!();
+            },
+            "--list-muxers" => {
+                print!("Registered muxers:");
+                for mux in mux_reg.iter() {
+                    print!(" {}", mux.get_name());
+                }
+                println!();
+            },
             "--query-decoder-options" => {
                 next_arg!(args, arg_idx);
                 let cname = args[arg_idx].as_str();