mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
Fix various clippy warnings in examples
This commit is contained in:
parent
35aeaa1395
commit
5d5b1e6908
7 changed files with 8 additions and 9 deletions
|
@ -67,7 +67,7 @@ fn create_pipeline() -> Result<gst::Pipeline, utils::ExampleError> {
|
||||||
let sum: f64 = samples
|
let sum: f64 = samples
|
||||||
.iter()
|
.iter()
|
||||||
.map(|sample| {
|
.map(|sample| {
|
||||||
let f = (*sample as f64) / (i16::MAX as f64);
|
let f = f64::from(*sample) / f64::from(i16::MAX);
|
||||||
f * f
|
f * f
|
||||||
})
|
})
|
||||||
.sum();
|
.sum();
|
||||||
|
|
|
@ -13,7 +13,7 @@ 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");
|
panic!("Usage: decodebin file_path")
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::new(None);
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
||||||
println!("Failed to parse pipeline: {}", err);
|
println!("Failed to parse pipeline: {}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
process::exit(-1);
|
process::exit(-1)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let bus = pipeline.get_bus().unwrap();
|
let bus = pipeline.get_bus().unwrap();
|
||||||
|
|
|
@ -37,7 +37,7 @@ fn main() {
|
||||||
let sum: f64 = samples
|
let sum: f64 = samples
|
||||||
.iter()
|
.iter()
|
||||||
.map(|sample| {
|
.map(|sample| {
|
||||||
let f = (*sample as f64) / (i16::MAX as f64);
|
let f = f64::from(*sample) / f64::from(i16::MAX);
|
||||||
f * f
|
f * f
|
||||||
})
|
})
|
||||||
.sum();
|
.sum();
|
||||||
|
|
|
@ -13,7 +13,7 @@ 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");
|
panic!("Usage: playbin uri")
|
||||||
};
|
};
|
||||||
|
|
||||||
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
|
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
|
||||||
|
|
|
@ -73,7 +73,7 @@ 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");
|
panic!("Usage: player uri")
|
||||||
};
|
};
|
||||||
|
|
||||||
match main_loop(uri) {
|
match main_loop(uri) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ 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");
|
panic!("Usage: toc file_path")
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::new(None);
|
||||||
|
@ -61,7 +61,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
match msg.view() {
|
match msg.view() {
|
||||||
MessageView::Eos(..) => break,
|
MessageView::Eos(_) | MessageView::AsyncDone(_) => break,
|
||||||
MessageView::Error(err) => {
|
MessageView::Error(err) => {
|
||||||
println!(
|
println!(
|
||||||
"Error from {}: {} ({:?})",
|
"Error from {}: {} ({:?})",
|
||||||
|
@ -71,7 +71,6 @@ fn main() {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MessageView::AsyncDone(_) => break,
|
|
||||||
MessageView::Toc(msg_toc) => {
|
MessageView::Toc(msg_toc) => {
|
||||||
let (toc, updated) = msg_toc.get_toc();
|
let (toc, updated) = msg_toc.get_toc();
|
||||||
println!(
|
println!(
|
||||||
|
|
Loading…
Reference in a new issue