X-Git-Url: https://git.nihav.org/?p=nihav-player.git;a=blobdiff_plain;f=src%2Fmain.rs;h=b70f3f1537c4243e22949263fc021b9e852b6aa5;hp=e0c934007e1b6ee1fbe6bdd7944daa0023a172ae;hb=a41925a20ad149f8b91a3a65a089f12fbf7ac8cb;hpb=860a2b4e79e9ad5b4ba4046998170755ff9bf45c diff --git a/src/main.rs b/src/main.rs index e0c9340..b70f3f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ extern crate sdl; extern crate nihav_core; +extern crate nihav_registry; extern crate nihav_allstuff; use sdl::video::*; @@ -16,7 +17,7 @@ use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicBool, Ordering}; use std::str::FromStr; -use nihav_core::detect; +use nihav_registry::detect; use nihav_core::formats::*; use nihav_core::frame::*; use nihav_core::io::byteio::{FileReader, ByteReader}; @@ -311,7 +312,20 @@ println!("reinit scaler!"); }) } -fn play_file(name: &str) { +fn play_file(args: Vec) { + + 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; @@ -379,7 +393,7 @@ fn play_file(name: &str) { 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 { @@ -572,15 +586,14 @@ fn play_file(name: &str) { } fn main() { - let args: Vec<_> = env::args().collect(); + let args: Vec = 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(); }