mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 13:01:05 +00:00
examples: More robust cli arg handling
This commit is contained in:
parent
246a54368d
commit
d18cbe5943
4 changed files with 8 additions and 4 deletions
|
@ -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);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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"))] {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue