diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 78eeee8ac..3ce7e6bee 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -61,7 +61,7 @@ fn create_ui(app: >k::Application) { let pipeline = &pipeline_clone; let position = pipeline .query_position::() - .unwrap_or(0.into()); + .unwrap_or_else(|| 0.into()); label.set_text(&format!("Position: {:.0}", position)); glib::Continue(true) diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 38db9d91a..b28c1ccea 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -131,7 +131,7 @@ fn create_ui(app: >k::Application) { let pipeline = &pipeline_clone; let position = pipeline .query_position::() - .unwrap_or(0.into()); + .unwrap_or_else(|| 0.into()); label.set_text(&format!("Position: {:.0}", position)); glib::Continue(true) diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 1ab72359a..e87b9fb36 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -44,16 +44,6 @@ pub struct AppSrcCallbacksBuilder { } impl AppSrcCallbacksBuilder { - pub fn new() -> Self { - skip_assert_initialized!(); - - AppSrcCallbacksBuilder { - need_data: None, - enough_data: None, - seek_data: None, - } - } - pub fn need_data(self, need_data: F) -> Self { Self { need_data: Some(Box::new(need_data)), diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index f0272a6ee..cb584f43a 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -85,13 +85,11 @@ where Arc::into_raw(Arc::new(func_box)) as gpointer, ); - let it = from_glib_full(ffi::gst_iterator_filter( + from_glib_full(ffi::gst_iterator_filter( it as *mut _, Some(filter_trampoline::), closure_value.to_glib_none().0, - )); - - it + )) } } diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index fd310ae72..8f0f714db 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -323,7 +323,7 @@ impl GstRc { } #[cfg(any(feature = "v1_10", feature = "dox"))] - pub fn new_property_notify<'a>(property_name: &'a str) -> PropertyNotifyBuilder<'a> { + pub fn new_property_notify(property_name: &str) -> PropertyNotifyBuilder { assert_initialized_main_thread!(); PropertyNotifyBuilder::new(property_name) } @@ -341,7 +341,7 @@ impl GstRc { } #[cfg(any(feature = "v1_10", feature = "dox"))] - pub fn new_redirect<'a>(location: &'a str) -> RedirectBuilder<'a> { + pub fn new_redirect(location: &str) -> RedirectBuilder { assert_initialized_main_thread!(); RedirectBuilder::new(location) } diff --git a/gstreamer/src/stream_collection.rs b/gstreamer/src/stream_collection.rs index ce8ab520b..584bdda95 100644 --- a/gstreamer/src/stream_collection.rs +++ b/gstreamer/src/stream_collection.rs @@ -72,4 +72,8 @@ impl StreamCollection { pub fn len(&self) -> usize { self.get_size() as usize } + + pub fn is_empty(&self) -> bool { + self.len() == 0 + } } diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index bb165aa5d..25170eaaf 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -263,7 +263,7 @@ mod tutorial5 { // thread of this event through a message in the bus fn post_app_message(playbin: &gst::Element) { let mbuilder = gst::Message::new_application(gst::Structure::new_empty("tags-changed")); - playbin.post_message(&mbuilder.build()); + let _ = playbin.post_message(&mbuilder.build()); } pub fn run() { diff --git a/tutorials/src/bin/basic-tutorial-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index 2ecbad6c6..847815a05 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -13,7 +13,7 @@ extern crate glib; use glib::source::SourceId; const CHUNK_SIZE: usize = 1024; // Amount of bytes we are sending in each buffer -const SAMPLE_RATE: u32 = 44100; // Samples per second we are sending +const SAMPLE_RATE: u32 = 44_100; // Samples per second we are sending #[derive(Debug)] struct CustomData {