Run everything through rustfmt again

This commit is contained in:
Sebastian Dröge 2018-04-05 11:35:34 +03:00
parent 40f243dfc3
commit c7103765db
14 changed files with 52 additions and 56 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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(

View file

@ -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;

View file

@ -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::*;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<T: ElementBase>: ObjectImpl<T> + AnyImpl + Send + Sync + '
}
}
use std::any::Any;
pub trait ElementImplExt<T> {
fn catch_panic_pad_function<R, F: FnOnce(&Self, &T) -> R, G: FnOnce() -> R>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> R;
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> R;
}
impl<S: ElementImpl<T>, T: ObjectType + glib::IsA<gst::Element> + glib::IsA<gst::Object>> ElementImplExt<T> for S {
impl<S: ElementImpl<T>, T: ObjectType + glib::IsA<gst::Element> + glib::IsA<gst::Object>>
ElementImplExt<T> for S
{
fn catch_panic_pad_function<R, F: FnOnce(&Self, &T) -> R, G: FnOnce() -> R>(
parent: &Option<gst::Object>,
fallback: G,
f: F,
) -> R {
let element = parent
.as_ref()
.cloned()
.unwrap()
.downcast::<T>()
.unwrap();
let element = parent.as_ref().cloned().unwrap().downcast::<T>().unwrap();
let imp = Any::downcast_ref::<Self>(element.get_impl()).unwrap();
element.catch_panic(fallback, |element| f(imp, element))
}