From 9a059583c9a9bc7ab06b99f07e665993a856bdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 7 Nov 2018 23:59:08 +0200 Subject: [PATCH] Run everything through rustfmt --- examples/src/bin/appsink.rs | 4 +-- examples/src/bin/appsrc.rs | 4 +-- examples/src/bin/decodebin.rs | 7 ++-- examples/src/bin/pad_probes.rs | 3 +- examples/src/bin/pango-cairo.rs | 10 +++--- examples/src/bin/queries.rs | 10 +++--- examples/src/bin/rtpfecclient.rs | 31 ++++++++-------- examples/src/bin/rtpfecserver.rs | 25 ++++++------- examples/src/bin/tagsetter.rs | 4 +-- gstreamer-net/src/net_client_clock.rs | 6 ++-- gstreamer-net/src/ntp_clock.rs | 6 ++-- gstreamer-net/src/ptp_clock.rs | 6 ++-- gstreamer/src/buffer_serde.rs | 6 ++-- gstreamer/src/bufferlist_serde.rs | 3 +- gstreamer/src/caps.rs | 3 +- gstreamer/src/caps_serde.rs | 6 ++-- gstreamer/src/clock.rs | 3 +- gstreamer/src/ghost_pad.rs | 3 +- gstreamer/src/iterator.rs | 3 +- gstreamer/src/object.rs | 3 +- gstreamer/src/pad.rs | 24 ++++++++----- gstreamer/src/sample_serde.rs | 6 ++-- gstreamer/src/segment_serde.rs | 3 +- gstreamer/src/structure_serde.rs | 6 ++-- gstreamer/src/tags.rs | 31 ++++++++-------- gstreamer/src/tags_serde.rs | 3 +- gstreamer/src/toc_serde.rs | 3 +- gstreamer/src/value_serde.rs | 6 ++-- tutorials/src/bin/basic-tutorial-4.rs | 48 +++++++++++++------------ tutorials/src/bin/basic-tutorial-5.rs | 52 +++++++++++++++------------ tutorials/src/bin/basic-tutorial-6.rs | 15 +++++--- tutorials/src/bin/basic-tutorial-8.rs | 3 +- 32 files changed, 196 insertions(+), 150 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 6c9023283..0f734c537 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -29,9 +29,7 @@ struct MissingElement(&'static str); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 604baba21..3c459a0ff 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -23,9 +23,7 @@ struct MissingElement(&'static str); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index d5ead4335..e824e7ea6 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -25,9 +25,7 @@ struct MissingElement(&'static str); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, @@ -189,7 +187,8 @@ fn example_main() -> Result<(), Error> { error: err.get_error().description().into(), debug: err.get_debug(), cause: err.get_error(), - }.into()), + } + .into()), }?; } #[cfg(not(feature = "v1_10"))] diff --git a/examples/src/bin/pad_probes.rs b/examples/src/bin/pad_probes.rs index fad75f74c..493860280 100644 --- a/examples/src/bin/pad_probes.rs +++ b/examples/src/bin/pad_probes.rs @@ -16,7 +16,8 @@ fn example_main() { let pipeline = gst::parse_launch(&format!( "audiotestsrc name=src ! audio/x-raw,format={},channels=1 ! fakesink", gst_audio::AUDIO_FORMAT_S16.to_string() - )).unwrap(); + )) + .unwrap(); let pipeline = pipeline.dynamic_cast::().unwrap(); let src = pipeline.get_by_name("src").unwrap(); diff --git a/examples/src/bin/pango-cairo.rs b/examples/src/bin/pango-cairo.rs index d0a3bbe5d..840c615db 100644 --- a/examples/src/bin/pango-cairo.rs +++ b/examples/src/bin/pango-cairo.rs @@ -29,9 +29,7 @@ struct MissingElement(&'static str); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, @@ -146,7 +144,8 @@ fn create_pipeline() -> Result { } None - }).unwrap(); + }) + .unwrap(); let drawer_clone = drawer.clone(); overlay @@ -159,7 +158,8 @@ fn create_pipeline() -> Result { drawer.info = Some(gst_video::VideoInfo::from_caps(&caps).unwrap()); None - }).unwrap(); + }) + .unwrap(); Ok(pipeline) } diff --git a/examples/src/bin/queries.rs b/examples/src/bin/queries.rs index 45a0fd96f..cb5cc79f8 100644 --- a/examples/src/bin/queries.rs +++ b/examples/src/bin/queries.rs @@ -39,8 +39,9 @@ fn example_main() { } else { None } - }.and_then(|pos| pos.try_into_time().ok()) - .unwrap(); + } + .and_then(|pos| pos.try_into_time().ok()) + .unwrap(); let dur = { let mut q = gst::Query::new_duration(gst::Format::Time); @@ -49,8 +50,9 @@ fn example_main() { } else { None } - }.and_then(|dur| dur.try_into_time().ok()) - .unwrap(); + } + .and_then(|dur| dur.try_into_time().ok()) + .unwrap(); println!("{} / {}", pos, dur); diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index 3272ea3f6..1ea881fba 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -35,9 +35,7 @@ struct UsageError(String); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, @@ -172,7 +170,8 @@ fn example_main() -> Result<(), Error> { ("clock-rate", &90000i32), ("is-fec", &true), ], - ).to_value(), + ) + .to_value(), ), 96 => Some( gst::Caps::new_simple( @@ -182,7 +181,8 @@ fn example_main() -> Result<(), Error> { ("clock-rate", &90000i32), ("encoding-name", &"VP8"), ], - ).to_value(), + ) + .to_value(), ), _ => None, } @@ -266,17 +266,20 @@ fn example_main() -> Result<(), Error> { error: err.get_error().description().into(), debug: err.get_debug(), cause: err.get_error(), - }.into()); + } + .into()); } MessageView::StateChanged(s) => match msg.get_src() { - Some(element) => if element == pipeline && s.get_current() == gst::State::Playing { - eprintln!("PLAYING"); - gst::debug_bin_to_dot_file( - &pipeline, - gst::DebugGraphDetails::all(), - "client-playing", - ); - }, + Some(element) => { + if element == pipeline && s.get_current() == gst::State::Playing { + eprintln!("PLAYING"); + gst::debug_bin_to_dot_file( + &pipeline, + gst::DebugGraphDetails::all(), + "client-playing", + ); + } + } None => (), }, _ => (), diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index de78cc0d7..1122427f6 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -32,9 +32,7 @@ struct UsageError(String); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, @@ -199,17 +197,20 @@ fn example_main() -> Result<(), Error> { error: err.get_error().description().into(), debug: err.get_debug(), cause: err.get_error(), - }.into()); + } + .into()); } MessageView::StateChanged(s) => match msg.get_src() { - Some(element) => if element == pipeline && s.get_current() == gst::State::Playing { - eprintln!("PLAYING"); - gst::debug_bin_to_dot_file( - &pipeline, - gst::DebugGraphDetails::all(), - "server-playing", - ); - }, + Some(element) => { + if element == pipeline && s.get_current() == gst::State::Playing { + eprintln!("PLAYING"); + gst::debug_bin_to_dot_file( + &pipeline, + gst::DebugGraphDetails::all(), + "server-playing", + ); + } + } None => (), }, _ => (), diff --git a/examples/src/bin/tagsetter.rs b/examples/src/bin/tagsetter.rs index 9e4e73be0..3bd520e5f 100644 --- a/examples/src/bin/tagsetter.rs +++ b/examples/src/bin/tagsetter.rs @@ -21,9 +21,7 @@ struct MissingElement(String); #[derive(Debug, Fail)] #[fail( display = "Received error from {}: {} (debug: {:?})", - src, - error, - debug + src, error, debug )] struct ErrorMessage { src: String, diff --git a/gstreamer-net/src/net_client_clock.rs b/gstreamer-net/src/net_client_clock.rs index 4b73525db..a3a3366f0 100644 --- a/gstreamer-net/src/net_client_clock.rs +++ b/gstreamer-net/src/net_client_clock.rs @@ -31,7 +31,8 @@ impl NetClientClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 @@ -41,7 +42,8 @@ impl NetClientClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } } diff --git a/gstreamer-net/src/ntp_clock.rs b/gstreamer-net/src/ntp_clock.rs index 1f9d81787..3b3727a20 100644 --- a/gstreamer-net/src/ntp_clock.rs +++ b/gstreamer-net/src/ntp_clock.rs @@ -31,7 +31,8 @@ impl NtpClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 @@ -41,7 +42,8 @@ impl NtpClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } } diff --git a/gstreamer-net/src/ptp_clock.rs b/gstreamer-net/src/ptp_clock.rs index d6c10b435..343140a61 100644 --- a/gstreamer-net/src/ptp_clock.rs +++ b/gstreamer-net/src/ptp_clock.rs @@ -31,7 +31,8 @@ impl PtpClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } else { // Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13 @@ -41,7 +42,8 @@ impl PtpClock { remote_address.to_glib_none().0, remote_port, base_time.to_glib(), - )).downcast_unchecked() + )) + .downcast_unchecked() } } } diff --git a/gstreamer/src/buffer_serde.rs b/gstreamer/src/buffer_serde.rs index 1b0e096f4..34c628f29 100644 --- a/gstreamer/src/buffer_serde.rs +++ b/gstreamer/src/buffer_serde.rs @@ -117,7 +117,8 @@ mod tests { " ),", " buffer: \"AQIDBA==\",", ")" - ).to_owned()), + ) + .to_owned()), res ); @@ -133,7 +134,8 @@ mod tests { "\"flags\":{\"bits\":1048592},", "\"buffer\":[1,2,3,4]", "}" - ).to_owned(), + ) + .to_owned(), res ); diff --git a/gstreamer/src/bufferlist_serde.rs b/gstreamer/src/bufferlist_serde.rs index 2082cf21d..2b10782af 100644 --- a/gstreamer/src/bufferlist_serde.rs +++ b/gstreamer/src/bufferlist_serde.rs @@ -131,7 +131,8 @@ mod tests { " buffer: \"BQY=\",", " ),", "]" - ).to_owned()), + ) + .to_owned()), res, ); } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index a6e2ed860..a0d4afb26 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -439,7 +439,8 @@ mod tests { ("fraction", &Fraction::new(1, 2)), ("array", &Array::new(&[&1, &2])), ], - ).as_ref() + ) + .as_ref() ); } diff --git a/gstreamer/src/caps_serde.rs b/gstreamer/src/caps_serde.rs index 169bca2f5..a4bf49f99 100644 --- a/gstreamer/src/caps_serde.rs +++ b/gstreamer/src/caps_serde.rs @@ -270,7 +270,8 @@ mod tests { " ]),", " ]), None),", "])" - ).to_owned()), + ) + .to_owned()), res, ); @@ -326,7 +327,8 @@ mod tests { ("fraction", &Fraction::new(1, 2)), ("array", &Array::new(&[&1, &2])), ], - ).as_ref() + ) + .as_ref() ); } diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 10cfeab91..8553b85f1 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -43,7 +43,8 @@ unsafe extern "C" fn trampoline_wait_async( &from_glib_borrow(clock), from_glib(time), &from_glib_borrow(id), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn destroy_closure_wait_async(ptr: gpointer) { diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index cdf13272f..ac0d1f5fd 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -40,7 +40,8 @@ impl GhostPad { name.0, target.to_glib_none().0, templ.to_glib_none().0, - )).map(|o| Downcast::downcast_unchecked(o)) + )) + .map(|o| Downcast::downcast_unchecked(o)) } } diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index 3056a2619..b2a56c456 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -384,7 +384,8 @@ unsafe extern "C" fn filter_boxed_get_type() -> glib_ff "GstRsIteratorFilterBoxed-{}-{}", T::static_type().name(), idx - )).unwrap(); + )) + .unwrap(); if gobject_ffi::g_type_from_name(type_name.as_ptr()) == gobject_ffi::G_TYPE_INVALID { break type_name; diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index d1ddb647b..562797b60 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -60,7 +60,8 @@ impl + IsA + glib::value::SetValue> GstObjectExtM f(&obj, &prop_obj, &pspec); None - }).unwrap() + }) + .unwrap() } } diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index cddffc1ff..47e0567aa 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -1023,7 +1023,8 @@ unsafe extern "C" fn trampoline_activatemode_function( &from_glib_borrow(parent), from_glib(mode), from_glib(active), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_chain_function( @@ -1041,7 +1042,8 @@ unsafe extern "C" fn trampoline_chain_function( &from_glib_borrow(pad), &from_glib_borrow(parent), from_glib_full(buffer), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_chain_list_function( @@ -1059,7 +1061,8 @@ unsafe extern "C" fn trampoline_chain_list_function( &from_glib_borrow(pad), &from_glib_borrow(parent), from_glib_full(list), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_event_function( @@ -1075,7 +1078,8 @@ unsafe extern "C" fn trampoline_event_function( &from_glib_borrow(pad), &from_glib_borrow(parent), from_glib_full(event), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_event_full_function( @@ -1093,7 +1097,8 @@ unsafe extern "C" fn trampoline_event_full_function( &from_glib_borrow(pad), &from_glib_borrow(parent), from_glib_full(event), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_getrange_function( @@ -1154,7 +1159,8 @@ unsafe extern "C" fn trampoline_link_function( &from_glib_borrow(pad), &from_glib_borrow(parent), &from_glib_borrow(peer), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_query_function( @@ -1172,7 +1178,8 @@ unsafe extern "C" fn trampoline_query_function( &from_glib_borrow(pad), &from_glib_borrow(parent), ::QueryRef::from_mut_ptr(query), - ).to_glib() + ) + .to_glib() } unsafe extern "C" fn trampoline_unlink_function( @@ -1276,7 +1283,8 @@ mod tests { sender.send(i).unwrap(); pad_clone.pause_task().unwrap(); } - }).unwrap(); + }) + .unwrap(); assert_eq!(receiver.recv().unwrap(), 3); } diff --git a/gstreamer/src/sample_serde.rs b/gstreamer/src/sample_serde.rs index 5dd5e8d56..c3be5c8d7 100644 --- a/gstreamer/src/sample_serde.rs +++ b/gstreamer/src/sample_serde.rs @@ -173,7 +173,8 @@ mod tests { " (\"f3\", \"i32\", 123),", " ])),", ")" - ).to_owned()), + ) + .to_owned()), res ); @@ -225,7 +226,8 @@ mod tests { " )),", " info: None,", ")" - ).to_owned()), + ) + .to_owned()), res ); } diff --git a/gstreamer/src/segment_serde.rs b/gstreamer/src/segment_serde.rs index 69acc3ed4..fcaf22580 100644 --- a/gstreamer/src/segment_serde.rs +++ b/gstreamer/src/segment_serde.rs @@ -158,7 +158,8 @@ mod tests { " position: 256,", " duration: -1,", ")" - ).to_owned()), + ) + .to_owned()), res, ); } diff --git a/gstreamer/src/structure_serde.rs b/gstreamer/src/structure_serde.rs index bde72ecfc..57d75cd9b 100644 --- a/gstreamer/src/structure_serde.rs +++ b/gstreamer/src/structure_serde.rs @@ -197,7 +197,8 @@ mod tests { " (\"i32\", 2),", " ]),", "])" - ).to_owned()), + ) + .to_owned()), res, ); } @@ -229,7 +230,8 @@ mod tests { ("fraction", &Fraction::new(1, 2)), ("array", &Array::new(&[&1, &2])), ], - ).as_ref() + ) + .as_ref() ); } diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 05c755e0a..2b9e6723f 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -592,7 +592,8 @@ impl<'a, T: Tag<'a>> ExactSizeIterator for TagIterator<'a, T> where >::TagType: 'a, T: 'a, -{} +{ +} pub struct GenericTagIterator<'a> { taglist: &'a TagListRef, @@ -761,22 +762,18 @@ mod tests { let mut tags = TagList::new(); { let tags = tags.get_mut().unwrap(); - assert!( - tags.add_generic(&TAG_TITLE, &"some title", TagMergeMode::Append) - .is_ok() - ); - assert!( - tags.add_generic(&TAG_TITLE, &"second title", TagMergeMode::Append) - .is_ok() - ); - assert!( - tags.add_generic(&TAG_DURATION, &(::SECOND * 120), TagMergeMode::Append) - .is_ok() - ); - assert!( - tags.add_generic(&TAG_TITLE, &"third title", TagMergeMode::Append) - .is_ok() - ); + assert!(tags + .add_generic(&TAG_TITLE, &"some title", TagMergeMode::Append) + .is_ok()); + assert!(tags + .add_generic(&TAG_TITLE, &"second title", TagMergeMode::Append) + .is_ok()); + assert!(tags + .add_generic(&TAG_DURATION, &(::SECOND * 120), TagMergeMode::Append) + .is_ok()); + assert!(tags + .add_generic(&TAG_TITLE, &"third title", TagMergeMode::Append) + .is_ok()); assert_eq!( tags.add_generic( diff --git a/gstreamer/src/tags_serde.rs b/gstreamer/src/tags_serde.rs index 6d1f763f1..b456edd9d 100644 --- a/gstreamer/src/tags_serde.rs +++ b/gstreamer/src/tags_serde.rs @@ -336,7 +336,8 @@ mod tests { " ),", " ]),", "]", - ).to_owned()), + ) + .to_owned()), res, ); } diff --git a/gstreamer/src/toc_serde.rs b/gstreamer/src/toc_serde.rs index f0597929a..fd1e3e7a7 100644 --- a/gstreamer/src/toc_serde.rs +++ b/gstreamer/src/toc_serde.rs @@ -268,7 +268,8 @@ mod tests { " ),", " ],", ")", - ).to_owned()), + ) + .to_owned()), res, ); } diff --git a/gstreamer/src/value_serde.rs b/gstreamer/src/value_serde.rs index e5d553ae4..446a2ac97 100644 --- a/gstreamer/src/value_serde.rs +++ b/gstreamer/src/value_serde.rs @@ -348,7 +348,8 @@ mod tests { " (\"Fraction\", (1, 2)),", " (\"String\", \"test str\"),", "]" - ).to_owned()), + ) + .to_owned()), res, ); @@ -374,7 +375,8 @@ mod tests { " (\"Fraction\", (1, 2)),", " (\"String\", \"test str\"),", "]" - ).to_owned()), + ) + .to_owned()), res, ); } diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index f521ae4ae..58158a17d 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -115,35 +115,37 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::GstRc if state_changed - .get_src() - .map(|s| s == custom_data.playbin) - .unwrap_or(false) - { - let new_state = state_changed.get_current(); - let old_state = state_changed.get_old(); + MessageView::StateChanged(state_changed) => { + if state_changed + .get_src() + .map(|s| s == custom_data.playbin) + .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 - ); + println!( + "Pipeline state changed from {:?} to {:?}", + old_state, new_state + ); - custom_data.playing = new_state == gst::State::Playing; - if custom_data.playing { - let mut seeking = gst::Query::new_seeking(gst::Format::Time); - if custom_data.playbin.query(&mut seeking) { - let (seekable, start, end) = seeking.get_result(); - custom_data.seek_enabled = seekable; - if seekable { - println!("Seeking is ENABLED from {:?} to {:?}", start, end) + custom_data.playing = new_state == gst::State::Playing; + if custom_data.playing { + let mut seeking = gst::Query::new_seeking(gst::Format::Time); + if custom_data.playbin.query(&mut seeking) { + let (seekable, start, end) = seeking.get_result(); + custom_data.seek_enabled = seekable; + if seekable { + println!("Seeking is ENABLED from {:?} to {:?}", start, end) + } else { + println!("Seeking is DISABLED for this stream.") + } } else { - println!("Seeking is DISABLED for this stream.") + eprintln!("Seeking query failed.") } - } else { - eprintln!("Seeking query failed.") } } - }, + } _ => (), } } diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index c20330c0e..5615d6cf3 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -50,35 +50,43 @@ mod tutorial5 { let signame: &str = &format!("get-{}-tags", stype); match playbin.get_property(propname).unwrap().get() { - Some(x) => for i in 0..x { - let tags = playbin.emit(signame, &[&i]).unwrap().unwrap(); + Some(x) => { + for i in 0..x { + let tags = playbin.emit(signame, &[&i]).unwrap().unwrap(); - if let Some(tags) = tags.get::() { - textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i)); + if let Some(tags) = tags.get::() { + textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i)); - if let Some(codec) = tags.get::() { - textbuf - .insert_at_cursor(&format!(" codec: {} \n", codec.get().unwrap())); - } + if let Some(codec) = tags.get::() { + textbuf.insert_at_cursor(&format!( + " codec: {} \n", + codec.get().unwrap() + )); + } - if let Some(codec) = tags.get::() { - textbuf - .insert_at_cursor(&format!(" codec: {} \n", codec.get().unwrap())); - } + if let Some(codec) = tags.get::() { + textbuf.insert_at_cursor(&format!( + " codec: {} \n", + codec.get().unwrap() + )); + } - if let Some(lang) = tags.get::() { - textbuf - .insert_at_cursor(&format!(" language: {} \n", lang.get().unwrap())); - } + if let Some(lang) = tags.get::() { + textbuf.insert_at_cursor(&format!( + " language: {} \n", + lang.get().unwrap() + )); + } - if let Some(bitrate) = tags.get::() { - textbuf.insert_at_cursor(&format!( - " bitrate: {} \n", - bitrate.get().unwrap() - )); + if let Some(bitrate) = tags.get::() { + textbuf.insert_at_cursor(&format!( + " bitrate: {} \n", + bitrate.get().unwrap() + )); + } } } - }, + } None => { eprintln!("Could not get {}!", propname); } 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-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index d248766f0..32d2fe176 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -98,7 +98,8 @@ fn main() { &visual, &video_convert, &video_sink, - ]).unwrap(); + ]) + .unwrap(); gst::Element::link_many(&[&app_queue, &appsink]).unwrap(); let tee_audio_pad = tee.get_request_pad("src_%u").unwrap();