Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2018-05-01 17:16:12 +0300
committerSebastian Dröge <sebastian@centricular.com>2018-05-01 17:16:12 +0300
commit8bc3f12061deb244435d08dc806b8029a27da8b4 (patch)
treecb46ec318389b6936d5399fb37467cff87cb5b04
parentd74995ee7e2868cfed7a4ee4c1f0cad6c63473ac (diff)
Run everything through rustfmt again
-rw-r--r--gobject-subclass/src/guard.rs2
-rw-r--r--gobject-subclass/src/object.rs47
-rw-r--r--gst-plugin-audiofx/src/audioecho.rs2
-rw-r--r--gst-plugin-file/src/filesink.rs4
-rw-r--r--gst-plugin-file/src/filesrc.rs4
-rw-r--r--gst-plugin-flv/src/flvdemux.rs17
-rw-r--r--gst-plugin-http/src/httpsrc.rs2
-rw-r--r--gst-plugin-simple/src/sink.rs16
-rw-r--r--gst-plugin-simple/src/source.rs16
-rw-r--r--gst-plugin-togglerecord/src/togglerecord.rs4
-rw-r--r--gst-plugin/src/base_sink.rs34
-rw-r--r--gst-plugin/src/base_src.rs42
-rw-r--r--gst-plugin/src/base_transform.rs34
-rw-r--r--gst-plugin/src/bin.rs11
-rw-r--r--gst-plugin/src/element.rs42
-rw-r--r--gst-plugin/src/lib.rs6
-rw-r--r--gst-plugin/src/object.rs21
-rw-r--r--gst-plugin/src/pipeline.rs4
18 files changed, 148 insertions, 160 deletions
diff --git a/gobject-subclass/src/guard.rs b/gobject-subclass/src/guard.rs
index ead6a6d2d..851453694 100644
--- a/gobject-subclass/src/guard.rs
+++ b/gobject-subclass/src/guard.rs
@@ -8,9 +8,9 @@
use std::ptr;
+use glib;
use glib_ffi;
use gobject_ffi;
-use glib;
#[macro_export]
macro_rules! callback_guard {
diff --git a/gobject-subclass/src/object.rs b/gobject-subclass/src/object.rs
index 08a460035..9a9f5cd05 100644
--- a/gobject-subclass/src/object.rs
+++ b/gobject-subclass/src/object.rs
@@ -70,10 +70,10 @@ pub trait ImplTypeStatic<T: ObjectType>: Send + Sync + 'static {
pub struct ClassInitToken(());
pub struct TypeInitToken(());
-
pub trait ObjectType: FromGlibPtrBorrow<*mut <Self as ObjectType>::InstanceStructType>
-where Self: Sized + 'static,
- Self::InstanceStructType: Instance<Self>
+where
+ Self: Sized + 'static,
+ Self::InstanceStructType: Instance<Self>,
{
const NAME: &'static str;
type InstanceStructType: Instance<Self> + 'static;
@@ -81,7 +81,6 @@ where Self: Sized + 'static,
type GlibClassType;
type ImplType: ObjectImpl<Self>;
-
fn glib_type() -> glib::Type;
fn class_init(token: &ClassInitToken, klass: &mut ClassStruct<Self>);
@@ -96,12 +95,11 @@ where Self: Sized + 'static,
unsafe fn get_instance(&self) -> *mut Self::InstanceStructType;
-
- fn get_impl(&self) -> &Self::ImplType{
+ fn get_impl(&self) -> &Self::ImplType {
unsafe { (*self.get_instance()).get_impl() }
}
- unsafe fn get_class(&self) -> *const ClassStruct<Self>{
+ unsafe fn get_class(&self) -> *const ClassStruct<Self> {
(*self.get_instance()).get_class()
}
}
@@ -115,29 +113,24 @@ macro_rules! object_type_fns(
}
);
-
-pub trait Instance<T: ObjectType>
-{
+pub trait Instance<T: ObjectType> {
fn parent(&self) -> &T::GlibType;
fn get_impl(&self) -> &T::ImplType;
- unsafe fn set_impl(&mut self, imp:ptr::NonNull<T::ImplType>);
+ unsafe fn set_impl(&mut self, imp: ptr::NonNull<T::ImplType>);
unsafe fn get_class(&self) -> *const ClassStruct<T>;
}
#[repr(C)]
-pub struct InstanceStruct<T: ObjectType>
-{
+pub struct InstanceStruct<T: ObjectType> {
_parent: T::GlibType,
_imp: ptr::NonNull<T::ImplType>,
}
-
-impl<T: ObjectType> Instance<T> for InstanceStruct<T>
-{
- fn parent(&self) -> &T::GlibType{
+impl<T: ObjectType> Instance<T> for InstanceStruct<T> {
+ fn parent(&self) -> &T::GlibType {
&self._parent
}
@@ -145,7 +138,7 @@ impl<T: ObjectType> Instance<T> for InstanceStruct<T>
unsafe { self._imp.as_ref() }
}
- unsafe fn set_impl(&mut self, imp:ptr::NonNull<T::ImplType>){
+ unsafe fn set_impl(&mut self, imp: ptr::NonNull<T::ImplType>) {
self._imp = imp;
}
@@ -308,8 +301,7 @@ unsafe impl<T: ObjectType> ObjectClass for ClassStruct<T> {}
unsafe extern "C" fn class_init<T: ObjectType>(
klass: glib_ffi::gpointer,
_klass_data: glib_ffi::gpointer,
-)
-{
+) {
callback_guard!();
{
let gobject_klass = &mut *(klass as *mut gobject_ffi::GObjectClass);
@@ -349,8 +341,7 @@ unsafe extern "C" fn get_property<T: ObjectType>(
id: u32,
value: *mut gobject_ffi::GValue,
_pspec: *mut gobject_ffi::GParamSpec,
-)
-{
+) {
callback_guard!();
floating_reference_guard!(obj);
match T::get_property(&from_glib_borrow(obj as *mut T::InstanceStructType), id - 1) {
@@ -368,8 +359,7 @@ unsafe extern "C" fn set_property<T: ObjectType>(
id: u32,
value: *mut gobject_ffi::GValue,
_pspec: *mut gobject_ffi::GParamSpec,
-)
-{
+) {
callback_guard!();
floating_reference_guard!(obj);
T::set_property(
@@ -381,8 +371,7 @@ unsafe extern "C" fn set_property<T: ObjectType>(
static mut TYPES: *mut Mutex<BTreeMap<TypeId, glib::Type>> = 0 as *mut _;
-pub unsafe fn get_type<T: ObjectType>() -> glib_ffi::GType
-{
+pub unsafe fn get_type<T: ObjectType>() -> glib_ffi::GType {
use std::sync::{Once, ONCE_INIT};
static ONCE: Once = ONCE_INIT;
@@ -495,8 +484,7 @@ unsafe extern "C" fn sub_set_property<T: ObjectType>(
unsafe extern "C" fn sub_init<T: ObjectType>(
obj: *mut gobject_ffi::GTypeInstance,
_klass: glib_ffi::gpointer,
-)
-{
+) {
callback_guard!();
floating_reference_guard!(obj);
let instance = &mut *(obj as *mut T::InstanceStructType);
@@ -507,8 +495,7 @@ unsafe extern "C" fn sub_init<T: ObjectType>(
instance.set_impl(ptr::NonNull::new_unchecked(Box::into_raw(Box::new(imp))));
}
-pub fn register_type<T: ObjectType, I: ImplTypeStatic<T>>(imp: I) -> glib::Type
-{
+pub fn register_type<T: ObjectType, I: ImplTypeStatic<T>>(imp: I) -> glib::Type {
unsafe {
let parent_type = get_type::<T>();
let type_name = format!("{}-{}", T::NAME, imp.get_name());
diff --git a/gst-plugin-audiofx/src/audioecho.rs b/gst-plugin-audiofx/src/audioecho.rs
index 048ec57c2..551b1350c 100644
--- a/gst-plugin-audiofx/src/audioecho.rs
+++ b/gst-plugin-audiofx/src/audioecho.rs
@@ -17,7 +17,7 @@ use gst_plugin::object::*;
use gst_plugin::properties::*;
use std::sync::Mutex;
-use std::{cmp, iter, i32, u64};
+use std::{cmp, i32, iter, u64};
use byte_slice_cast::*;
diff --git a/gst-plugin-file/src/filesink.rs b/gst-plugin-file/src/filesink.rs
index a964e4e83..600106df5 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;
@@ -93,7 +93,7 @@ impl SinkImpl for FileSink {
[
"Could not open file for writing '{}': {}",
location.to_str().unwrap_or("Non-UTF8 path"),
- err.to_string()
+ err.to_string(),
]
))
}));
diff --git a/gst-plugin-file/src/filesrc.rs b/gst-plugin-file/src/filesrc.rs
index 5cf30db02..0a03486d3 100644
--- a/gst-plugin-file/src/filesrc.rs
+++ b/gst-plugin-file/src/filesrc.rs
@@ -11,9 +11,9 @@ 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;
@@ -104,7 +104,7 @@ impl SourceImpl for FileSrc {
[
"Could not open file for reading '{}': {}",
location.to_str().unwrap_or("Non-UTF8 path"),
- err.to_string()
+ err.to_string(),
]
))
}));
diff --git a/gst-plugin-flv/src/flvdemux.rs b/gst-plugin-flv/src/flvdemux.rs
index f604421c6..d5c01d8a8 100644
--- a/gst-plugin-flv/src/flvdemux.rs
+++ b/gst-plugin-flv/src/flvdemux.rs
@@ -346,12 +346,10 @@ impl VideoFormat {
if let Some(par) = self.pixel_aspect_ratio {
if *par.numer() != 0 && par.numer() != par.denom() {
caps.as_mut().map(|c| {
- c.get_mut().unwrap().set_simple(&[
- (
- "pixel-aspect-ratio",
- &gst::Fraction::new(*par.numer(), *par.denom()),
- ),
- ])
+ c.get_mut().unwrap().set_simple(&[(
+ "pixel-aspect-ratio",
+ &gst::Fraction::new(*par.numer(), *par.denom()),
+ )])
});
}
}
@@ -359,9 +357,10 @@ impl VideoFormat {
if let Some(fps) = self.framerate {
if *fps.numer() != 0 {
caps.as_mut().map(|c| {
- c.get_mut().unwrap().set_simple(&[
- ("framerate", &gst::Fraction::new(*fps.numer(), *fps.denom())),
- ])
+ c.get_mut().unwrap().set_simple(&[(
+ "framerate",
+ &gst::Fraction::new(*fps.numer(), *fps.denom()),
+ )])
});
}
}
diff --git a/gst-plugin-http/src/httpsrc.rs b/gst-plugin-http/src/httpsrc.rs
index 08b406073..0fb8f690c 100644
--- a/gst-plugin-http/src/httpsrc.rs
+++ b/gst-plugin-http/src/httpsrc.rs
@@ -13,9 +13,9 @@ 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/sink.rs b/gst-plugin-simple/src/sink.rs
index 4b86c8cc9..ea70e691f 100644
--- a/gst-plugin-simple/src/sink.rs
+++ b/gst-plugin-simple/src/sink.rs
@@ -41,15 +41,13 @@ struct Sink {
imp: Mutex<Box<SinkImpl>>,
}
-static PROPERTIES: [Property; 1] = [
- Property::String(
- "uri",
- "URI",
- "URI to read from",
- None,
- PropertyMutability::ReadWrite,
- ),
-];
+static PROPERTIES: [Property; 1] = [Property::String(
+ "uri",
+ "URI",
+ "URI to read from",
+ None,
+ PropertyMutability::ReadWrite,
+)];
impl Sink {
fn new(sink: &BaseSink, sink_info: &SinkInfo) -> Self {
diff --git a/gst-plugin-simple/src/source.rs b/gst-plugin-simple/src/source.rs
index 34d3b259d..98c3c5e8e 100644
--- a/gst-plugin-simple/src/source.rs
+++ b/gst-plugin-simple/src/source.rs
@@ -59,15 +59,13 @@ struct Source {
push_only: bool,
}
-static PROPERTIES: [Property; 1] = [
- Property::String(
- "uri",
- "URI",
- "URI to read from",
- None,
- PropertyMutability::ReadWrite,
- ),
-];
+static PROPERTIES: [Property; 1] = [Property::String(
+ "uri",
+ "URI",
+ "URI to read from",
+ None,
+ PropertyMutability::ReadWrite,
+)];
impl Source {
fn new(source: &BaseSrc, source_info: &SourceInfo) -> Self {
diff --git a/gst-plugin-togglerecord/src/togglerecord.rs b/gst-plugin-togglerecord/src/togglerecord.rs
index b5bad9428..93bfbf449 100644
--- a/gst-plugin-togglerecord/src/togglerecord.rs
+++ b/gst-plugin-togglerecord/src/togglerecord.rs
@@ -919,7 +919,7 @@ impl ToggleRecord {
gst::StreamError::Format,
[
"Only Time segments supported, got {:?}",
- segment.get_format()
+ segment.get_format(),
]
);
return false;
@@ -933,7 +933,7 @@ impl ToggleRecord {
gst::StreamError::Format,
[
"Only rate==1.0 segments supported, got {:?}",
- segment.get_rate()
+ segment.get_rate(),
]
);
return false;
diff --git a/gst-plugin/src/base_sink.rs b/gst-plugin/src/base_sink.rs
index f637a1a6c..cd6012a81 100644
--- a/gst-plugin/src/base_sink.rs
+++ b/gst-plugin/src/base_sink.rs
@@ -27,7 +27,7 @@ use object::*;
pub trait BaseSinkImpl<T: BaseSinkBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn start(&self, _element: &T) -> bool {
true
@@ -165,7 +165,7 @@ pub unsafe trait BaseSinkBase:
pub unsafe trait BaseSinkClassExt<T: BaseSinkBase>
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn override_vfuncs(&mut self, _: &ClassInitToken) {
unsafe {
@@ -311,7 +311,7 @@ unsafe extern "C" fn base_sink_start<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -327,7 +327,7 @@ unsafe extern "C" fn base_sink_stop<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -344,7 +344,7 @@ unsafe extern "C" fn base_sink_render<T: BaseSinkBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -364,7 +364,7 @@ unsafe extern "C" fn base_sink_prepare<T: BaseSinkBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -384,7 +384,7 @@ unsafe extern "C" fn base_sink_render_list<T: BaseSinkBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -404,7 +404,7 @@ unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -424,7 +424,7 @@ unsafe extern "C" fn base_sink_query<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -444,7 +444,7 @@ unsafe extern "C" fn base_sink_event<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -463,7 +463,7 @@ unsafe extern "C" fn base_sink_get_caps<T: BaseSinkBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -488,7 +488,7 @@ unsafe extern "C" fn base_sink_set_caps<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -508,7 +508,7 @@ unsafe extern "C" fn base_sink_fixate<T: BaseSinkBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -527,7 +527,7 @@ unsafe extern "C" fn base_sink_unlock<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -543,7 +543,7 @@ unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSinkImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -551,5 +551,7 @@ where
let wrap: T = from_glib_borrow(ptr as *mut T::InstanceStructType);
let imp = element.get_impl();
- panic_to_error!(&wrap, &element.panicked(), false, { imp.unlock_stop(&wrap) }).to_glib()
+ panic_to_error!(&wrap, &element.panicked(), false, {
+ imp.unlock_stop(&wrap)
+ }).to_glib()
}
diff --git a/gst-plugin/src/base_src.rs b/gst-plugin/src/base_src.rs
index e945a2236..0664a018d 100644
--- a/gst-plugin/src/base_src.rs
+++ b/gst-plugin/src/base_src.rs
@@ -27,7 +27,7 @@ use object::*;
pub trait BaseSrcImpl<T: BaseSrcBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn start(&self, _element: &T) -> bool {
true
@@ -214,7 +214,7 @@ pub unsafe trait BaseSrcBase:
pub unsafe trait BaseSrcClassExt<T: BaseSrcBase>
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn override_vfuncs(&mut self, _: &ClassInitToken) {
unsafe {
@@ -382,7 +382,7 @@ unsafe extern "C" fn base_src_start<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -398,7 +398,7 @@ unsafe extern "C" fn base_src_stop<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -414,7 +414,7 @@ unsafe extern "C" fn base_src_is_seekable<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -422,7 +422,9 @@ where
let wrap: T = from_glib_borrow(ptr as *mut T::InstanceStructType);
let imp = element.get_impl();
- panic_to_error!(&wrap, &element.panicked(), false, { imp.is_seekable(&wrap) }).to_glib()
+ panic_to_error!(&wrap, &element.panicked(), false, {
+ imp.is_seekable(&wrap)
+ }).to_glib()
}
unsafe extern "C" fn base_src_get_size<T: BaseSrcBase>(
@@ -431,7 +433,7 @@ unsafe extern "C" fn base_src_get_size<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -458,7 +460,7 @@ unsafe extern "C" fn base_src_fill<T: BaseSrcBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -480,7 +482,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -508,7 +510,7 @@ unsafe extern "C" fn base_src_do_seek<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -527,7 +529,7 @@ unsafe extern "C" fn base_src_query<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -547,7 +549,7 @@ unsafe extern "C" fn base_src_event<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -566,7 +568,7 @@ unsafe extern "C" fn base_src_get_caps<T: BaseSrcBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -590,7 +592,7 @@ unsafe extern "C" fn base_src_negotiate<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -607,7 +609,7 @@ unsafe extern "C" fn base_src_set_caps<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -627,7 +629,7 @@ unsafe extern "C" fn base_src_fixate<T: BaseSrcBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -646,7 +648,7 @@ unsafe extern "C" fn base_src_unlock<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -662,7 +664,7 @@ unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseSrcImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -670,5 +672,7 @@ where
let wrap: T = from_glib_borrow(ptr as *mut T::InstanceStructType);
let imp = element.get_impl();
- panic_to_error!(&wrap, &element.panicked(), false, { imp.unlock_stop(&wrap) }).to_glib()
+ panic_to_error!(&wrap, &element.panicked(), false, {
+ imp.unlock_stop(&wrap)
+ }).to_glib()
}
diff --git a/gst-plugin/src/base_transform.rs b/gst-plugin/src/base_transform.rs
index 66afaf852..f4cc23947 100644
--- a/gst-plugin/src/base_transform.rs
+++ b/gst-plugin/src/base_transform.rs
@@ -27,7 +27,7 @@ use object::*;
pub trait BaseTransformImpl<T: BaseTransformBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn start(&self, _element: &T) -> bool {
true
@@ -115,7 +115,7 @@ any_impl!(BaseTransformBase, BaseTransformImpl, PanicPoison);
pub unsafe trait BaseTransformBase:
IsA<gst::Element> + IsA<gst_base::BaseTransform> + ObjectType
where
- Self::InstanceStructType: PanicPoison
+ Self::InstanceStructType: PanicPoison,
{
fn parent_transform_caps(
&self,
@@ -264,7 +264,7 @@ pub enum BaseTransformMode {
pub unsafe trait BaseTransformClassExt<T: BaseTransformBase>
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn configure(
&mut self,
@@ -325,7 +325,7 @@ glib_wrapper! {
unsafe impl<T: IsA<gst::Element> + IsA<gst_base::BaseTransform> + ObjectType> BaseTransformBase
for T
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
}
pub type BaseTransformClass = ClassStruct<BaseTransform>;
@@ -444,7 +444,7 @@ unsafe extern "C" fn base_transform_start<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -460,7 +460,7 @@ unsafe extern "C" fn base_transform_stop<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -479,7 +479,7 @@ unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -511,7 +511,7 @@ unsafe extern "C" fn base_transform_fixate_caps<T: BaseTransformBase>(
) -> *mut gst_ffi::GstCaps
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -536,7 +536,7 @@ unsafe extern "C" fn base_transform_set_caps<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -556,7 +556,7 @@ unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -576,7 +576,7 @@ unsafe extern "C" fn base_transform_query<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -604,7 +604,7 @@ unsafe extern "C" fn base_transform_transform_size<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -636,7 +636,7 @@ unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -661,7 +661,7 @@ unsafe extern "C" fn base_transform_sink_event<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -680,7 +680,7 @@ unsafe extern "C" fn base_transform_src_event<T: BaseTransformBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -700,7 +700,7 @@ unsafe extern "C" fn base_transform_transform<T: BaseTransformBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -723,7 +723,7 @@ unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformBase>(
) -> gst_ffi::GstFlowReturn
where
T::ImplType: BaseTransformImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
diff --git a/gst-plugin/src/bin.rs b/gst-plugin/src/bin.rs
index 68c92c9fb..69ebc2eef 100644
--- a/gst-plugin/src/bin.rs
+++ b/gst-plugin/src/bin.rs
@@ -25,7 +25,7 @@ use object::*;
pub trait BinImpl<T: BinBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn add_element(&self, bin: &T, element: &gst::Element) -> bool {
bin.parent_add_element(element)
@@ -79,8 +79,7 @@ pub unsafe trait BinBase: IsA<gst::Element> + IsA<gst::Bin> + ObjectType {
pub unsafe trait BinClassExt<T: BinBase>
where
T::ImplType: BinImpl<T>,
- T::InstanceStructType: PanicPoison
-
+ T::InstanceStructType: PanicPoison,
{
fn override_vfuncs(&mut self, _: &ClassInitToken) {
unsafe {
@@ -167,7 +166,7 @@ unsafe extern "C" fn bin_add_element<T: BinBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BinImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -186,7 +185,7 @@ unsafe extern "C" fn bin_remove_element<T: BinBase>(
) -> glib_ffi::gboolean
where
T::ImplType: BinImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -204,7 +203,7 @@ unsafe extern "C" fn bin_handle_message<T: BinBase>(
message: *mut gst_ffi::GstMessage,
) where
T::ImplType: BinImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
diff --git a/gst-plugin/src/element.rs b/gst-plugin/src/element.rs
index aeeb274f7..a9ce4efcc 100644
--- a/gst-plugin/src/element.rs
+++ b/gst-plugin/src/element.rs
@@ -26,7 +26,7 @@ use object::*;
pub trait ElementImpl<T: ElementBase>: ObjectImpl<T> + AnyImpl + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn change_state(&self, element: &T, transition: gst::StateChange) -> gst::StateChangeReturn {
element.parent_change_state(transition)
@@ -68,7 +68,7 @@ pub trait ElementImplExt<T> {
impl<S: ElementImpl<T>, T: ObjectType + glib::IsA<gst::Element> + glib::IsA<gst::Object>>
ElementImplExt<T> for S
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn catch_panic_pad_function<R, F: FnOnce(&Self, &T) -> R, G: FnOnce() -> R>(
parent: &Option<gst::Object>,
@@ -88,7 +88,7 @@ any_impl!(ElementBase, ElementImpl, PanicPoison);
pub unsafe trait ElementBase: IsA<gst::Element> + ObjectType
where
- Self::InstanceStructType: PanicPoison
+ Self::InstanceStructType: PanicPoison,
{
fn parent_change_state(&self, transition: gst::StateChange) -> gst::StateChangeReturn {
unsafe {
@@ -134,8 +134,7 @@ where
}
}
- fn catch_panic<T, F: FnOnce(&Self) -> T, G: FnOnce() -> T>(&self, fallback: G, f: F) -> T
- {
+ fn catch_panic<T, F: FnOnce(&Self) -> T, G: FnOnce() -> T>(&self, fallback: G, f: F) -> T {
let panicked = unsafe { &(*self.get_instance()).panicked() };
panic_to_error!(self, panicked, fallback(), { f(self) })
}
@@ -144,7 +143,7 @@ where
pub unsafe trait ElementClassExt<T: ElementBase>
where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn add_pad_template(&mut self, pad_template: gst::PadTemplate) {
unsafe {
@@ -173,8 +172,7 @@ where
}
}
- fn override_vfuncs(&mut self, _: &ClassInitToken)
- {
+ fn override_vfuncs(&mut self, _: &ClassInitToken) {
unsafe {
let klass = &mut *(self as *const Self as *mut gst_ffi::GstElementClass);
klass.change_state = Some(element_change_state::<T>);
@@ -198,7 +196,10 @@ glib_wrapper! {
}
unsafe impl<T: IsA<gst::Element> + ObjectType> ElementBase for T
-where Self::InstanceStructType: PanicPoison{}
+where
+ Self::InstanceStructType: PanicPoison,
+{
+}
pub type ElementClass = ClassStruct<Element>;
@@ -256,8 +257,7 @@ macro_rules! box_element_impl(
box_element_impl!(ElementImpl);
-impl ObjectType for Element
-{
+impl ObjectType for Element {
const NAME: &'static str = "RsElement";
type GlibType = gst_ffi::GstElement;
type GlibClassType = gst_ffi::GstElementClass;
@@ -281,7 +281,7 @@ unsafe extern "C" fn element_change_state<T: ElementBase>(
) -> gst_ffi::GstStateChangeReturn
where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -312,7 +312,7 @@ unsafe extern "C" fn element_request_new_pad<T: ElementBase>(
) -> *mut gst_ffi::GstPad
where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -347,9 +347,9 @@ where
unsafe extern "C" fn element_release_pad<T: ElementBase>(
ptr: *mut gst_ffi::GstElement,
pad: *mut gst_ffi::GstPad,
-)where
+) where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -368,7 +368,7 @@ unsafe extern "C" fn element_send_event<T: ElementBase>(
) -> glib_ffi::gboolean
where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -387,7 +387,7 @@ unsafe extern "C" fn element_query<T: ElementBase>(
) -> glib_ffi::gboolean
where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
@@ -396,15 +396,17 @@ where
let imp = element.get_impl();
let query = gst::QueryRef::from_mut_ptr(query);
- panic_to_error!(&wrap, &element.panicked(), false, { imp.query(&wrap, query) }).to_glib()
+ panic_to_error!(&wrap, &element.panicked(), false, {
+ imp.query(&wrap, query)
+ }).to_glib()
}
unsafe extern "C" fn element_set_context<T: ElementBase>(
ptr: *mut gst_ffi::GstElement,
context: *mut gst_ffi::GstContext,
-)where
+) where
T::ImplType: ElementImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
callback_guard!();
floating_reference_guard!(ptr);
diff --git a/gst-plugin/src/lib.rs b/gst-plugin/src/lib.rs
index 86ef42b9d..1210d93ae 100644
--- a/gst-plugin/src/lib.rs
+++ b/gst-plugin/src/lib.rs
@@ -26,10 +26,16 @@ extern crate gstreamer_base as gst_base;
extern crate gobject_subclass;
#[macro_use]
+#[macro_use]
+#[macro_use]
+#[macro_use]
pub use gobject_subclass::anyimpl;
pub use gobject_subclass::properties;
#[macro_use]
+#[macro_use]
+#[macro_use]
+#[macro_use]
pub use gobject_subclass::guard;
pub mod object;
diff --git a/gst-plugin/src/object.rs b/gst-plugin/src/object.rs
index 01703857f..abc8f35d1 100644
--- a/gst-plugin/src/object.rs
+++ b/gst-plugin/src/object.rs
@@ -3,24 +3,20 @@ use std::sync::atomic::AtomicBool;
pub use gobject_subclass::object::*;
-
#[repr(C)]
-pub struct ElementInstanceStruct<T: ObjectType>
-{
+pub struct ElementInstanceStruct<T: ObjectType> {
_parent: T::GlibType,
_imp: ptr::NonNull<T::ImplType>,
_panicked: AtomicBool,
}
-pub trait PanicPoison{
+pub trait PanicPoison {
fn panicked(&self) -> &AtomicBool;
}
-
-impl<T: ObjectType> Instance<T> for ElementInstanceStruct<T>
-{
- fn parent(&self) -> &T::GlibType{
+impl<T: ObjectType> Instance<T> for ElementInstanceStruct<T> {
+ fn parent(&self) -> &T::GlibType {
&self._parent
}
@@ -28,7 +24,7 @@ impl<T: ObjectType> Instance<T> for ElementInstanceStruct<T>
unsafe { self._imp.as_ref() }
}
- unsafe fn set_impl(&mut self, imp:ptr::NonNull<T::ImplType>){
+ unsafe fn set_impl(&mut self, imp: ptr::NonNull<T::ImplType>) {
self._imp = imp;
}
@@ -37,11 +33,8 @@ impl<T: ObjectType> Instance<T> for ElementInstanceStruct<T>
}
}
-
-impl<T: ObjectType> PanicPoison for ElementInstanceStruct<T>
-{
- fn panicked(&self) -> &AtomicBool{
+impl<T: ObjectType> PanicPoison for ElementInstanceStruct<T> {
+ fn panicked(&self) -> &AtomicBool {
&self._panicked
}
-
}
diff --git a/gst-plugin/src/pipeline.rs b/gst-plugin/src/pipeline.rs
index e1ebd46fb..146f6126c 100644
--- a/gst-plugin/src/pipeline.rs
+++ b/gst-plugin/src/pipeline.rs
@@ -26,7 +26,7 @@ use object::*;
pub trait PipelineImpl<T: PipelineBase>:
AnyImpl + ObjectImpl<T> + ElementImpl<T> + BinImpl<T> + Send + Sync + 'static
where
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
}
@@ -40,7 +40,7 @@ pub unsafe trait PipelineBase:
pub unsafe trait PipelineClassExt<T: PipelineBase>
where
T::ImplType: PipelineImpl<T>,
- T::InstanceStructType: PanicPoison
+ T::InstanceStructType: PanicPoison,
{
fn override_vfuncs(&mut self, _: &ClassInitToken) {}
}