examples: More robust cli arg handling

This commit is contained in:
Zeeshan Ali 2017-11-10 16:53:32 +01:00 committed by Sebastian Dröge
parent 246a54368d
commit d18cbe5943
4 changed files with 8 additions and 4 deletions

View file

@ -12,7 +12,8 @@ fn main() {
let uri: &str = if args.len() == 2 { let uri: &str = if args.len() == 2 {
args[1].as_ref() args[1].as_ref()
} else { } else {
panic!("Usage: decodebin file_path") println!("Usage: decodebin file_path");
std::process::exit(-1);
}; };
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::new(None);

View file

@ -12,7 +12,8 @@ fn main() {
let uri: &str = if args.len() == 2 { let uri: &str = if args.len() == 2 {
args[1].as_ref() args[1].as_ref()
} else { } else {
panic!("Usage: playbin uri") println!("Usage: playbin uri");
std::process::exit(-1);
}; };
let playbin = gst::ElementFactory::make("playbin", None).unwrap(); let playbin = gst::ElementFactory::make("playbin", None).unwrap();

View file

@ -70,7 +70,8 @@ fn main() {
let uri: &str = if args.len() == 2 { let uri: &str = if args.len() == 2 {
args[1].as_ref() args[1].as_ref()
} else { } else {
panic!("Usage: player uri") println!("Usage: player uri");
std::process::exit(-1);
}; };
#[cfg(not(feature = "gst-player"))] { #[cfg(not(feature = "gst-player"))] {

View file

@ -12,7 +12,8 @@ fn main() {
let uri: &str = if args.len() == 2 { let uri: &str = if args.len() == 2 {
args[1].as_ref() args[1].as_ref()
} else { } else {
panic!("Usage: toc file_path") println!("Usage: toc file_path");
std::process::exit(-1);
}; };
let pipeline = gst::Pipeline::new(None); let pipeline = gst::Pipeline::new(None);