add option for not stopping on the first decoding error
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 16 Apr 2020 11:32:39 +0000 (13:32 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 16 Apr 2020 11:32:39 +0000 (13:32 +0200)
src/main.rs

index ff6baac91cea84ed7bf3dc46c6ae0465fc5eaf70..bb94c1218432969bcebead768e75deb3fbaa6b68 100644 (file)
@@ -94,6 +94,7 @@ fn main() {
     let mut seek_time = 0u64;
     let mut vpfx: Option<String> = None;
     let mut apfx: Option<&str> = None;
+    let mut ignore_errors = false;
 
     while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
         match args[cur_arg].as_str() {
@@ -133,6 +134,7 @@ fn main() {
                 }
                 vpfx = Some(args[cur_arg].clone());
             },
+            "-ignerr"   => { ignore_errors = true; },
             _           => { println!("unknown option {}", args[cur_arg]); return; },
         }
         cur_arg += 1;
@@ -256,7 +258,9 @@ panic!("decoder {} not found", info.get_name());
                 },
                 Err(reason) => {
                     println!("error decoding frame {:?}", reason);
-                    break;
+                    if !ignore_errors {
+                        break;
+                    }
                 },
             };
             if pkt.get_pts() != None && lastpts.is_some() && pkt.get_pts() >= lastpts { break; }