mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
Fix various clippy warnings
This commit is contained in:
parent
15ea81e473
commit
9b6efb2339
8 changed files with 12 additions and 20 deletions
|
@ -61,7 +61,7 @@ fn create_ui(app: >k::Application) {
|
||||||
let pipeline = &pipeline_clone;
|
let pipeline = &pipeline_clone;
|
||||||
let position = pipeline
|
let position = pipeline
|
||||||
.query_position::<gst::ClockTime>()
|
.query_position::<gst::ClockTime>()
|
||||||
.unwrap_or(0.into());
|
.unwrap_or_else(|| 0.into());
|
||||||
label.set_text(&format!("Position: {:.0}", position));
|
label.set_text(&format!("Position: {:.0}", position));
|
||||||
|
|
||||||
glib::Continue(true)
|
glib::Continue(true)
|
||||||
|
|
|
@ -131,7 +131,7 @@ fn create_ui(app: >k::Application) {
|
||||||
let pipeline = &pipeline_clone;
|
let pipeline = &pipeline_clone;
|
||||||
let position = pipeline
|
let position = pipeline
|
||||||
.query_position::<gst::ClockTime>()
|
.query_position::<gst::ClockTime>()
|
||||||
.unwrap_or(0.into());
|
.unwrap_or_else(|| 0.into());
|
||||||
label.set_text(&format!("Position: {:.0}", position));
|
label.set_text(&format!("Position: {:.0}", position));
|
||||||
|
|
||||||
glib::Continue(true)
|
glib::Continue(true)
|
||||||
|
|
|
@ -44,16 +44,6 @@ pub struct AppSrcCallbacksBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppSrcCallbacksBuilder {
|
impl AppSrcCallbacksBuilder {
|
||||||
pub fn new() -> Self {
|
|
||||||
skip_assert_initialized!();
|
|
||||||
|
|
||||||
AppSrcCallbacksBuilder {
|
|
||||||
need_data: None,
|
|
||||||
enough_data: None,
|
|
||||||
seek_data: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn need_data<F: Fn(&AppSrc, u32) + Send + Sync + 'static>(self, need_data: F) -> Self {
|
pub fn need_data<F: Fn(&AppSrc, u32) + Send + Sync + 'static>(self, need_data: F) -> Self {
|
||||||
Self {
|
Self {
|
||||||
need_data: Some(Box::new(need_data)),
|
need_data: Some(Box::new(need_data)),
|
||||||
|
|
|
@ -85,13 +85,11 @@ where
|
||||||
Arc::into_raw(Arc::new(func_box)) as gpointer,
|
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 _,
|
it as *mut _,
|
||||||
Some(filter_trampoline::<T>),
|
Some(filter_trampoline::<T>),
|
||||||
closure_value.to_glib_none().0,
|
closure_value.to_glib_none().0,
|
||||||
));
|
))
|
||||||
|
|
||||||
it
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ impl GstRc<MessageRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[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!();
|
assert_initialized_main_thread!();
|
||||||
PropertyNotifyBuilder::new(property_name)
|
PropertyNotifyBuilder::new(property_name)
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ impl GstRc<MessageRef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[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!();
|
assert_initialized_main_thread!();
|
||||||
RedirectBuilder::new(location)
|
RedirectBuilder::new(location)
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,8 @@ impl StreamCollection {
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.get_size() as usize
|
self.get_size() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.len() == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ mod tutorial5 {
|
||||||
// thread of this event through a message in the bus
|
// thread of this event through a message in the bus
|
||||||
fn post_app_message(playbin: &gst::Element) {
|
fn post_app_message(playbin: &gst::Element) {
|
||||||
let mbuilder = gst::Message::new_application(gst::Structure::new_empty("tags-changed"));
|
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() {
|
pub fn run() {
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern crate glib;
|
||||||
use glib::source::SourceId;
|
use glib::source::SourceId;
|
||||||
|
|
||||||
const CHUNK_SIZE: usize = 1024; // Amount of bytes we are sending in each buffer
|
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)]
|
#[derive(Debug)]
|
||||||
struct CustomData {
|
struct CustomData {
|
||||||
|
|
Loading…
Reference in a new issue