diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 6c9023283..0916c0daf 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -115,14 +115,12 @@ fn create_pipeline() -> Result { .map(|sample| { let f = f64::from(*sample) / f64::from(i16::MAX); f * f - }) - .sum(); + }).sum(); let rms = (sum / (samples.len() as f64)).sqrt(); println!("rms: {}", rms); gst::FlowReturn::Ok - }) - .build(), + }).build(), ); Ok(pipeline) diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 604baba21..d415ccafa 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -105,8 +105,7 @@ fn create_pipeline() -> Result { // appsrc already handles the error here let _ = appsrc.push_buffer(buffer); - }) - .build(), + }).build(), ); Ok(pipeline) diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index d5ead4335..2c0e5e889 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -178,8 +178,7 @@ fn example_main() -> Result<(), Error> { .and_then(|v| { v.downcast_ref::>>>() .and_then(|v| v.lock().unwrap().take()) - }) - .map(Result::Err) + }).map(Result::Err) .expect("error-details message without actual error"), _ => Err(ErrorMessage { src: err diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index 551b4470f..d46fa6bbe 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -26,7 +26,12 @@ mod examples_common; struct MissingElement(&'static str); #[derive(Debug, Fail)] -#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)] +#[fail( + display = "Received error from {}: {} (debug: {:?})", + src, + error, + debug +)] struct ErrorMessage { src: String, error: String, @@ -37,32 +42,25 @@ struct ErrorMessage { fn configure_encodebin(encodebin: &gst::Element) -> Result<(), Error> { let audio_profile = gst_pbutils::EncodingAudioProfileBuilder::new() - .format(&gst::Caps::new_simple( - "audio/x-vorbis", - &[], - )) + .format(&gst::Caps::new_simple("audio/x-vorbis", &[])) .presence(0) .build()?; let video_profile = gst_pbutils::EncodingVideoProfileBuilder::new() - .format(&gst::Caps::new_simple( - "video/x-theora", - &[], - )) + .format(&gst::Caps::new_simple("video/x-theora", &[])) .presence(0) .build()?; let container_profile = gst_pbutils::EncodingContainerProfileBuilder::new() .name("container") - .format(&gst::Caps::new_simple( - "video/x-matroska", - &[], - )) + .format(&gst::Caps::new_simple("video/x-matroska", &[])) .add_profile(&(video_profile)) .add_profile(&(audio_profile)) .build()?; - encodebin.set_property("profile", &container_profile).expect("set profile property failed"); + encodebin + .set_property("profile", &container_profile) + .expect("set profile property failed"); Ok(()) } @@ -83,16 +81,22 @@ fn example_main() -> Result<(), Error> { }; let pipeline = gst::Pipeline::new(None); - let src = gst::ElementFactory::make("uridecodebin", None).ok_or(MissingElement("uridecodebin"))?; - let encodebin = gst::ElementFactory::make("encodebin", None).ok_or(MissingElement("encodebin"))?; + let src = + gst::ElementFactory::make("uridecodebin", None).ok_or(MissingElement("uridecodebin"))?; + let encodebin = + gst::ElementFactory::make("encodebin", None).ok_or(MissingElement("encodebin"))?; let sink = gst::ElementFactory::make("filesink", None).ok_or(MissingElement("filesink"))?; - src.set_property("uri", &uri).expect("setting URI Property failed"); - sink.set_property("location", &output_file).expect("setting location property failed"); + src.set_property("uri", &uri) + .expect("setting URI Property failed"); + sink.set_property("location", &output_file) + .expect("setting location property failed"); configure_encodebin(&encodebin)?; - pipeline.add_many(&[&src, &encodebin, &sink]).expect("failed to add elements to pipeline"); + pipeline + .add_many(&[&src, &encodebin, &sink]) + .expect("failed to add elements to pipeline"); gst::Element::link_many(&[&encodebin, &sink])?; // Need to move a new reference into the closure @@ -113,7 +117,10 @@ fn example_main() -> Result<(), Error> { gst_element_warning!( dbin, gst::CoreError::Negotiation, - ("Failed to get media type from pad {}", dbin_src_pad.get_name()) + ( + "Failed to get media type from pad {}", + dbin_src_pad.get_name() + ) ); return; @@ -132,11 +139,17 @@ fn example_main() -> Result<(), Error> { .ok_or(MissingElement("audioresample"))?; let elements = &[&queue, &convert, &resample]; - pipeline.add_many(elements).expect("failed to add audio elements to pipeline"); + pipeline + .add_many(elements) + .expect("failed to add audio elements to pipeline"); gst::Element::link_many(elements)?; - let enc_sink_pad = encodebin.get_request_pad("audio_%u").expect("Could not get audio pad from encodebin"); - let src_pad = resample.get_static_pad("src").expect("resample has no srcpad"); + let enc_sink_pad = encodebin + .get_request_pad("audio_%u") + .expect("Could not get audio pad from encodebin"); + let src_pad = resample + .get_static_pad("src") + .expect("resample has no srcpad"); src_pad.link(&enc_sink_pad).into_result()?; for e in elements { @@ -154,11 +167,17 @@ fn example_main() -> Result<(), Error> { .ok_or(MissingElement("videoscale"))?; let elements = &[&queue, &convert, &scale]; - pipeline.add_many(elements).expect("failed to add video elements to pipeline"); + pipeline + .add_many(elements) + .expect("failed to add video elements to pipeline"); gst::Element::link_many(elements)?; - let enc_sink_pad = encodebin.get_request_pad("video_%u").expect("Could not get video pad from encodebin"); - let src_pad = scale.get_static_pad("src").expect("videoscale has no srcpad"); + let enc_sink_pad = encodebin + .get_request_pad("video_%u") + .expect("Could not get video pad from encodebin"); + let src_pad = scale + .get_static_pad("src") + .expect("videoscale has no srcpad"); src_pad.link(&enc_sink_pad).into_result()?; for e in elements { @@ -217,11 +236,11 @@ fn example_main() -> Result<(), Error> { .and_then(|v| { v.downcast_ref::>>>() .and_then(|v| v.lock().unwrap().take()) - }) - .map(Result::Err) + }).map(Result::Err) .expect("error-details message without actual error"), _ => Err(ErrorMessage { - src: err.get_src() + src: err + .get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), @@ -233,7 +252,8 @@ fn example_main() -> Result<(), Error> { #[cfg(not(feature = "v1_10"))] { Err(ErrorMessage { - src: err.get_src() + src: err + .get_src() .map(|s| s.get_path_string()) .unwrap_or_else(|| String::from("None")), error: err.get_error().description().into(), diff --git a/examples/src/bin/futures.rs b/examples/src/bin/futures.rs index ffc59bfdb..eeca1553d 100644 --- a/examples/src/bin/futures.rs +++ b/examples/src/bin/futures.rs @@ -44,8 +44,7 @@ fn example_main() { } else { Ok(()) } - }) - .and_then(|_| Ok(())); + }).and_then(|_| Ok(())); let _ = block_on(messages); diff --git a/examples/src/bin/glib-futures.rs b/examples/src/bin/glib-futures.rs index 94ebef574..a556d2156 100644 --- a/examples/src/bin/glib-futures.rs +++ b/examples/src/bin/glib-futures.rs @@ -47,8 +47,7 @@ fn example_main() { } else { Ok(()) } - }) - .and_then(|_| Ok(())); + }).and_then(|_| Ok(())); let _ = ctx.block_on(messages); diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index fad75f74c..692ee34aa 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -36,8 +36,7 @@ fn example_main() { .map(|sample| { let f = f64::from(*sample) / f64::from(i16::MAX); f * f - }) - .sum(); + }).sum(); let rms = (sum / (samples.len() as f64)).sqrt(); println!("rms: {}", rms); } diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index 5d0bb0c7a..8eccd13c9 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -60,8 +60,7 @@ fn example_main() { } None - }) - .unwrap(); + }).unwrap(); let bus = playbin.get_bus().unwrap(); diff --git a/examples/src/bin/queries.rs b/examples/src/bin/queries.rs index 45a0fd96f..cf0fe729c 100644 --- a/examples/src/bin/queries.rs +++ b/examples/src/bin/queries.rs @@ -40,7 +40,7 @@ fn example_main() { None } }.and_then(|pos| pos.try_into_time().ok()) - .unwrap(); + .unwrap(); let dur = { let mut q = gst::Query::new_duration(gst::Format::Time); @@ -50,7 +50,7 @@ fn example_main() { None } }.and_then(|dur| dur.try_into_time().ok()) - .unwrap(); + .unwrap(); println!("{} / {}", pos, dur); diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index b33023eab..f65adf16c 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -64,6 +64,6 @@ pub mod prelude { pub use glib::prelude::*; pub use gst::prelude::*; - pub use encoding_profile::EncodingProfileBuilder; pub use auto::traits::*; + pub use encoding_profile::EncodingProfileBuilder; } diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index f521ae4ae..4b08e39a6 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -82,8 +82,7 @@ fn tutorial_main() { .seek_simple( gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT, 30 * gst::SECOND, - ) - .expect("Failed to seek."); + ).expect("Failed to seek."); custom_data.seek_done = true; } } diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index c20330c0e..232f1bbd2 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -328,24 +328,21 @@ mod tutorial5 { let pipeline = args[0].get::().unwrap(); post_app_message(&pipeline); None - }) - .unwrap(); + }).unwrap(); playbin .connect("audio-tags-changed", false, |args| { let pipeline = args[0].get::().unwrap(); post_app_message(&pipeline); None - }) - .unwrap(); + }).unwrap(); playbin .connect("text-tags-changed", false, move |args| { let pipeline = args[0].get::().unwrap(); post_app_message(&pipeline); None - }) - .unwrap(); + }).unwrap(); let window = create_ui(&playbin); diff --git a/tutorials/src/bin/basic-tutorial-6.rs b/tutorials/src/bin/basic-tutorial-6.rs index 271a5bab7..838b785d2 100644 --- a/tutorials/src/bin/basic-tutorial-6.rs +++ b/tutorials/src/bin/basic-tutorial-6.rs @@ -137,18 +137,23 @@ fn tutorial_main() { break; } MessageView::StateChanged(state_changed) => - // We are only interested in state-changed messages from the pipeline - if state_changed.get_src().map(|s| s == pipeline).unwrap_or(false) { + // We are only interested in state-changed messages from the pipeline + { + if state_changed + .get_src() + .map(|s| s == pipeline) + .unwrap_or(false) + { let new_state = state_changed.get_current(); let old_state = state_changed.get_old(); println!( "Pipeline state changed from {:?} to {:?}", - old_state, - new_state + old_state, new_state ); print_pad_capabilities(&sink, "sink"); - }, + } + } _ => (), } } diff --git a/tutorials/src/bin/basic-tutorial-7.rs b/tutorials/src/bin/basic-tutorial-7.rs index b7d7b44a7..08fb2ff7a 100644 --- a/tutorials/src/bin/basic-tutorial-7.rs +++ b/tutorials/src/bin/basic-tutorial-7.rs @@ -40,8 +40,7 @@ fn tutorial_main() { &visual, &video_convert, &video_sink, - ]) - .unwrap(); + ]).unwrap(); gst::Element::link_many(&[&audio_source, &tee]).unwrap(); gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap(); diff --git a/tutorials/src/bin/basic-tutorial-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index d248766f0..ade447e93 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -86,8 +86,7 @@ fn main() { &video_sink, &app_queue, &appsink, - ]) - .unwrap(); + ]).unwrap(); gst::Element::link_many(&[&appsrc, &tee]).unwrap(); gst::Element::link_many(&[&audio_queue, &audio_convert1, &audio_resample, &audio_sink])