diff --git a/gst-plugin-audiofx/src/audioecho.rs b/gst-plugin-audiofx/src/audioecho.rs index 13db5970..048ec57c 100644 --- a/gst-plugin-audiofx/src/audioecho.rs +++ b/gst-plugin-audiofx/src/audioecho.rs @@ -11,18 +11,18 @@ use gst; use gst::prelude::*; use gst_audio; -use gst_plugin::properties::*; -use gst_plugin::object::*; -use gst_plugin::element::*; use gst_plugin::base_transform::*; +use gst_plugin::element::*; +use gst_plugin::object::*; +use gst_plugin::properties::*; -use std::{cmp, iter, i32, u64}; use std::sync::Mutex; +use std::{cmp, iter, i32, u64}; use byte_slice_cast::*; -use num_traits::float::Float; use num_traits::cast::{FromPrimitive, ToPrimitive}; +use num_traits::float::Float; const DEFAULT_MAX_DELAY: u64 = gst::SECOND_VAL; const DEFAULT_DELAY: u64 = 500 * gst::MSECOND_VAL; diff --git a/gst-plugin-file/src/filesink.rs b/gst-plugin-file/src/filesink.rs index 9f02fa17..a964e4e8 100644 --- a/gst-plugin-file/src/filesink.rs +++ b/gst-plugin-file/src/filesink.rs @@ -12,9 +12,9 @@ use url::Url; use std::io::Write; +use gst_plugin_simple::UriValidator; use gst_plugin_simple::error::*; use gst_plugin_simple::sink::*; -use gst_plugin_simple::UriValidator; use gst; diff --git a/gst-plugin-file/src/filesrc.rs b/gst-plugin-file/src/filesrc.rs index 5c849e84..5cf30db0 100644 --- a/gst-plugin-file/src/filesrc.rs +++ b/gst-plugin-file/src/filesrc.rs @@ -6,14 +6,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::u64; -use std::io::{Read, Seek, SeekFrom}; use std::fs::File; +use std::io::{Read, Seek, SeekFrom}; +use std::u64; use url::Url; +use gst_plugin_simple::UriValidator; use gst_plugin_simple::error::*; use gst_plugin_simple::source::*; -use gst_plugin_simple::UriValidator; use gst; diff --git a/gst-plugin-file/src/lib.rs b/gst-plugin-file/src/lib.rs index 230ecc84..556a4d8d 100644 --- a/gst-plugin-file/src/lib.rs +++ b/gst-plugin-file/src/lib.rs @@ -15,14 +15,14 @@ extern crate gst_plugin_simple; extern crate gstreamer as gst; extern crate url; -use gst_plugin_simple::source::*; use gst_plugin_simple::sink::*; +use gst_plugin_simple::source::*; -mod filesrc; mod filesink; +mod filesrc; -use filesrc::FileSrc; use filesink::FileSink; +use filesrc::FileSrc; fn plugin_init(plugin: &gst::Plugin) -> bool { source_register( diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-http/src/httpsrc.rs index f647130e..08b40607 100644 --- a/gst-plugin-http/src/httpsrc.rs +++ b/gst-plugin-http/src/httpsrc.rs @@ -6,16 +6,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::u64; -use std::io::Read; -use url::Url; -use reqwest::{Client, Response}; use reqwest::header::{AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec, Range, RangeUnit}; +use reqwest::{Client, Response}; +use std::io::Read; +use std::u64; +use url::Url; +use gst_plugin_simple::UriValidator; use gst_plugin_simple::error::*; use gst_plugin_simple::source::*; -use gst_plugin_simple::UriValidator; use gst; diff --git a/gst-plugin-simple/src/demuxer.rs b/gst-plugin-simple/src/demuxer.rs index a1c7c760..134647f0 100644 --- a/gst-plugin-simple/src/demuxer.rs +++ b/gst-plugin-simple/src/demuxer.rs @@ -8,12 +8,12 @@ use std::sync::Mutex; +use std::collections::BTreeMap; use std::u32; use std::u64; -use std::collections::BTreeMap; -use gst_plugin::object::*; use gst_plugin::element::*; +use gst_plugin::object::*; use error::*; diff --git a/gst-plugin-simple/src/error.rs b/gst-plugin-simple/src/error.rs index d7adb40b..6ab568f9 100644 --- a/gst-plugin-simple/src/error.rs +++ b/gst-plugin-simple/src/error.rs @@ -7,8 +7,8 @@ // except according to those terms. use std::error::Error; -use std::fmt::{Display, Formatter}; use std::fmt::Error as FmtError; +use std::fmt::{Display, Formatter}; use glib; use gst; diff --git a/gst-plugin-simple/src/lib.rs b/gst-plugin-simple/src/lib.rs index d97985f4..0a67edaa 100644 --- a/gst-plugin-simple/src/lib.rs +++ b/gst-plugin-simple/src/lib.rs @@ -14,9 +14,9 @@ extern crate gstreamer_base as gst_base; extern crate url; -pub mod source; -pub mod sink; pub mod demuxer; pub mod error; +pub mod sink; +pub mod source; pub type UriValidator = Fn(&url::Url) -> Result<(), error::UriError> + Send + Sync + 'static; diff --git a/gst-plugin-simple/src/sink.rs b/gst-plugin-simple/src/sink.rs index 5453029c..4b86c8cc 100644 --- a/gst-plugin-simple/src/sink.rs +++ b/gst-plugin-simple/src/sink.rs @@ -15,12 +15,12 @@ use gst; use gst::prelude::*; use gst_base::prelude::*; +use error::*; +use gst_plugin::base_sink::*; +use gst_plugin::element::*; use gst_plugin::object::*; use gst_plugin::properties::*; -use gst_plugin::element::*; -use gst_plugin::base_sink::*; use gst_plugin::uri_handler::*; -use error::*; pub use gst_plugin::base_sink::BaseSink; diff --git a/gst-plugin-simple/src/source.rs b/gst-plugin-simple/src/source.rs index e29b35c9..34d3b259 100644 --- a/gst-plugin-simple/src/source.rs +++ b/gst-plugin-simple/src/source.rs @@ -17,12 +17,12 @@ use gst; use gst::prelude::*; use gst_base::prelude::*; +use error::*; +use gst_plugin::base_src::*; +use gst_plugin::element::*; use gst_plugin::object::*; use gst_plugin::properties::*; -use gst_plugin::element::*; -use gst_plugin::base_src::*; use gst_plugin::uri_handler::*; -use error::*; pub use gst_plugin::base_src::BaseSrc; diff --git a/gst-plugin-togglerecord/src/togglerecord.rs b/gst-plugin-togglerecord/src/togglerecord.rs index c923c504..b5bad942 100644 --- a/gst-plugin-togglerecord/src/togglerecord.rs +++ b/gst-plugin-togglerecord/src/togglerecord.rs @@ -21,15 +21,15 @@ use gst; use gst::prelude::*; use gst_video; -use gst_plugin::properties::*; -use gst_plugin::object::*; use gst_plugin::element::*; +use gst_plugin::object::*; +use gst_plugin::properties::*; -use std::sync::{Arc, Condvar, Mutex}; -use std::collections::HashMap; -use std::iter; use std::cmp; +use std::collections::HashMap; use std::f64; +use std::iter; +use std::sync::{Arc, Condvar, Mutex}; const DEFAULT_RECORD: bool = false; diff --git a/gst-plugin-tutorial/src/rgb2gray.rs b/gst-plugin-tutorial/src/rgb2gray.rs index 1bd88f6b..463c6817 100644 --- a/gst-plugin-tutorial/src/rgb2gray.rs +++ b/gst-plugin-tutorial/src/rgb2gray.rs @@ -11,10 +11,10 @@ use gst; use gst::prelude::*; use gst_video; -use gst_plugin::properties::*; -use gst_plugin::object::*; -use gst_plugin::element::*; use gst_plugin::base_transform::*; +use gst_plugin::element::*; +use gst_plugin::object::*; +use gst_plugin::properties::*; use std::i32; use std::sync::Mutex; diff --git a/gst-plugin-tutorial/src/sinesrc.rs b/gst-plugin-tutorial/src/sinesrc.rs index 08d4027b..1de19782 100644 --- a/gst-plugin-tutorial/src/sinesrc.rs +++ b/gst-plugin-tutorial/src/sinesrc.rs @@ -9,22 +9,22 @@ use glib; use gst; use gst::prelude::*; -use gst_base::prelude::*; use gst_audio; +use gst_base::prelude::*; use byte_slice_cast::*; -use gst_plugin::properties::*; -use gst_plugin::object::*; -use gst_plugin::element::*; use gst_plugin::base_src::*; +use gst_plugin::element::*; +use gst_plugin::object::*; +use gst_plugin::properties::*; -use std::{i32, u32}; -use std::sync::Mutex; use std::ops::Rem; +use std::sync::Mutex; +use std::{i32, u32}; -use num_traits::float::Float; use num_traits::cast::NumCast; +use num_traits::float::Float; // Default values of properties const DEFAULT_SAMPLES_PER_BUFFER: u32 = 1024; diff --git a/gst-plugin/src/element.rs b/gst-plugin/src/element.rs index 93c51903..89917bb7 100644 --- a/gst-plugin/src/element.rs +++ b/gst-plugin/src/element.rs @@ -6,6 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::any::Any; use std::mem; use std::ptr; @@ -53,28 +54,23 @@ pub trait ElementImpl: ObjectImpl + AnyImpl + Send + Sync + ' } } -use std::any::Any; - pub trait ElementImplExt { fn catch_panic_pad_function R, G: FnOnce() -> R>( - parent: &Option, - fallback: G, - f: F, - ) -> R; + parent: &Option, + fallback: G, + f: F, + ) -> R; } -impl, T: ObjectType + glib::IsA + glib::IsA> ElementImplExt for S { +impl, T: ObjectType + glib::IsA + glib::IsA> + ElementImplExt for S +{ fn catch_panic_pad_function R, G: FnOnce() -> R>( parent: &Option, fallback: G, f: F, ) -> R { - let element = parent - .as_ref() - .cloned() - .unwrap() - .downcast::() - .unwrap(); + let element = parent.as_ref().cloned().unwrap().downcast::().unwrap(); let imp = Any::downcast_ref::(element.get_impl()).unwrap(); element.catch_panic(fallback, |element| f(imp, element)) }