})
}
-fn play_file(name: &str) {
+fn play_file(args: Vec<String>) {
+
+ let mut cur_arg: usize = 1;
+ let mut decode_audio = true;
+ while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
+ match args[cur_arg].as_str() {
+ "--" => { break; },
+ "-an" => { decode_audio = false; },
+ _ => { println!("unknown option {}", args[cur_arg]); return; },
+ }
+ cur_arg += 1;
+ }
+ let name = args[cur_arg].as_str();
+
let path = Path::new(name);
let mut file = File::open(path).unwrap();
let dmx_fact;
tb_den = tbd;
}
} else if info.is_audio() {
- if audio_dec.is_none() {
+ if audio_dec.is_none() && decode_audio {
if decfunc.is_none() {
println!("no audio decoder for {} found!", info.get_name());
} else {
}
fn main() {
- let args: Vec<_> = env::args().collect();
+ let args: Vec<String> = env::args().collect();
if args.len() == 1 {
println!("usage: nihav-player input");
return;
}
- let name = args[1].as_str();
- play_file(name);
+ play_file(args);
sdl::quit();
}