mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-10 17:25:33 +00:00
Fix some clippy warnings in examples/tutorials
This commit is contained in:
parent
2508f432f4
commit
b6d13272df
7 changed files with 13 additions and 13 deletions
|
@ -142,7 +142,7 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
||||||
Err(ErrorMessage {
|
Err(ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
|
|
@ -113,7 +113,7 @@ fn main_loop(pipeline: gst::Pipeline, appsrc: gst_app::AppSrc) -> Result<(), Err
|
||||||
Err(ErrorMessage {
|
Err(ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
args[1].as_ref()
|
args[1].as_ref()
|
||||||
} else {
|
} else {
|
||||||
println!("Usage: decodebin file_path");
|
println!("Usage: decodebin file_path");
|
||||||
std::process::exit(-1);
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::new(None);
|
||||||
|
@ -177,7 +177,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
ErrorMessage {
|
ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
@ -190,7 +190,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
Err(ErrorMessage {
|
Err(ErrorMessage {
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or_else(|| String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn example_main() {
|
||||||
args[1].as_ref()
|
args[1].as_ref()
|
||||||
} else {
|
} else {
|
||||||
println!("Usage: playbin uri");
|
println!("Usage: playbin uri");
|
||||||
std::process::exit(-1);
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
|
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
|
||||||
|
|
|
@ -75,13 +75,13 @@ fn example_main() {
|
||||||
args[1].as_ref()
|
args[1].as_ref()
|
||||||
} else {
|
} else {
|
||||||
println!("Usage: player uri");
|
println!("Usage: player uri");
|
||||||
std::process::exit(-1);
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "gst-player"))]
|
#[cfg(not(feature = "gst-player"))]
|
||||||
{
|
{
|
||||||
eprintln!("Feature gst-player is required. Please rebuild with --features gst-player");
|
eprintln!("Feature gst-player is required. Please rebuild with --features gst-player");
|
||||||
std::process::exit(-1);
|
std::process::exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gst-player")]
|
#[cfg(feature = "gst-player")]
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn example_main() {
|
||||||
args[1].as_ref()
|
args[1].as_ref()
|
||||||
} else {
|
} else {
|
||||||
println!("Usage: toc file_path");
|
println!("Usage: toc file_path");
|
||||||
std::process::exit(-1);
|
std::process::exit(-1)
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipeline = gst::Pipeline::new(None);
|
let pipeline = gst::Pipeline::new(None);
|
||||||
|
|
|
@ -144,7 +144,7 @@ fn main() {
|
||||||
|
|
||||||
let data: Arc<Mutex<CustomData>> = Arc::new(Mutex::new(CustomData::new(&appsrc, &appsink)));
|
let data: Arc<Mutex<CustomData>> = Arc::new(Mutex::new(CustomData::new(&appsrc, &appsink)));
|
||||||
|
|
||||||
let data_clone = data.clone();
|
let data_clone = Arc::clone(&data);
|
||||||
appsrc.connect_need_data(move |_, _size| {
|
appsrc.connect_need_data(move |_, _size| {
|
||||||
let data = &data_clone;
|
let data = &data_clone;
|
||||||
let mut d = data.lock().unwrap();
|
let mut d = data.lock().unwrap();
|
||||||
|
@ -152,7 +152,7 @@ fn main() {
|
||||||
if d.source_id.is_none() {
|
if d.source_id.is_none() {
|
||||||
println!("start feeding");
|
println!("start feeding");
|
||||||
|
|
||||||
let data_clone = data.clone();
|
let data_clone = Arc::clone(data);
|
||||||
d.source_id = Some(glib::source::idle_add(move || {
|
d.source_id = Some(glib::source::idle_add(move || {
|
||||||
let data = &data_clone;
|
let data = &data_clone;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let data_clone = data.clone();
|
let data_clone = Arc::clone(&data);
|
||||||
appsrc.connect_enough_data(move |_| {
|
appsrc.connect_enough_data(move |_| {
|
||||||
let data = &data_clone;
|
let data = &data_clone;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ fn main() {
|
||||||
appsink.set_emit_signals(true);
|
appsink.set_emit_signals(true);
|
||||||
appsink.set_caps(&audio_caps);
|
appsink.set_caps(&audio_caps);
|
||||||
|
|
||||||
let data_clone = data.clone();
|
let data_clone = Arc::clone(&data);
|
||||||
appsink.connect_new_sample(move |_| {
|
appsink.connect_new_sample(move |_| {
|
||||||
let appsink = {
|
let appsink = {
|
||||||
let data = &data_clone.lock().unwrap();
|
let data = &data_clone.lock().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue