diff --git a/gstreamer-app/src/lib.rs b/gstreamer-app/src/lib.rs index f60065cb6..c8606070b 100644 --- a/gstreamer-app/src/lib.rs +++ b/gstreamer-app/src/lib.rs @@ -11,10 +11,10 @@ extern crate libc; extern crate glib_sys as glib_ffi; extern crate gobject_sys as gobject_ffi; extern crate gstreamer as gst; -extern crate gstreamer_base as gst_base; extern crate gstreamer_app_sys as ffi; -extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_base as gst_base; extern crate gstreamer_base_sys as gst_base_ffi; +extern crate gstreamer_sys as gst_ffi; #[macro_use] extern crate glib; diff --git a/gstreamer-audio/src/audio_format_info.rs b/gstreamer-audio/src/audio_format_info.rs index 2802af4f1..05de0e664 100644 --- a/gstreamer-audio/src/audio_format_info.rs +++ b/gstreamer-audio/src/audio_format_info.rs @@ -264,8 +264,8 @@ impl glib::value::SetValue for AudioFormatInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -275,8 +275,8 @@ impl glib::value::SetValueOptional for AudioFormatInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 817f4909c..e1ac233e9 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -281,9 +281,8 @@ impl glib::types::StaticType for AudioInfo { #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for AudioInfo { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo, - ) + Option::::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) + as *mut ffi::GstAudioInfo) } } @@ -292,8 +291,8 @@ impl glib::value::SetValue for AudioInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -303,8 +302,8 @@ impl glib::value::SetValueOptional for AudioInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index 118bfbb0c..38909e014 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -32,9 +32,7 @@ glib_wrapper! { impl FlowCombiner { pub fn new() -> FlowCombiner { assert_initialized_main_thread!(); - unsafe { - from_glib_full(ffi::gst_flow_combiner_new()) - } + unsafe { from_glib_full(ffi::gst_flow_combiner_new()) } } pub fn add_pad>(&self, pad: &P) { @@ -63,13 +61,24 @@ impl FlowCombiner { pub fn update_flow(&self, fret: gst::FlowReturn) -> gst::FlowReturn { unsafe { - from_glib(ffi::gst_flow_combiner_update_flow(self.to_glib_none().0, fret.to_glib())) + from_glib(ffi::gst_flow_combiner_update_flow( + self.to_glib_none().0, + fret.to_glib(), + )) } } - pub fn update_pad_flow>(&self, pad: &P, fret: gst::FlowReturn) -> gst::FlowReturn { + pub fn update_pad_flow>( + &self, + pad: &P, + fret: gst::FlowReturn, + ) -> gst::FlowReturn { unsafe { - from_glib(ffi::gst_flow_combiner_update_pad_flow(self.to_glib_none().0, pad.to_glib_none().0, fret.to_glib())) + from_glib(ffi::gst_flow_combiner_update_pad_flow( + self.to_glib_none().0, + pad.to_glib_none().0, + fret.to_glib(), + )) } } } diff --git a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs index d8ce10717..52249a976 100644 --- a/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs +++ b/gstreamer-player/src/player_g_main_context_signal_dispatcher.rs @@ -20,8 +20,8 @@ impl PlayerGMainContextSignalDispatcher { let application_context = application_context.to_glib_none(); unsafe { from_glib_full( - ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as - *mut ffi::GstPlayerGMainContextSignalDispatcher, + ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) + as *mut ffi::GstPlayerGMainContextSignalDispatcher, ) } } diff --git a/gstreamer-player/src/player_video_overlay_video_renderer.rs b/gstreamer-player/src/player_video_overlay_video_renderer.rs index a85819ccc..a1d584674 100644 --- a/gstreamer-player/src/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/player_video_overlay_video_renderer.rs @@ -60,8 +60,8 @@ impl< O: IsA + IsA, > PlayerVideoOverlayVideoRendererExtManual for O { unsafe fn get_window_handle(&self) -> uintptr_t { - ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) as - uintptr_t + ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) + as uintptr_t } unsafe fn set_window_handle(&self, window_handle: uintptr_t) { diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 0191ddb48..f825ab88a 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -248,8 +248,8 @@ impl VideoFrame { info.to_glib_none().0 as *mut _, buffer.to_glib_none().0, mem::transmute( - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() | - gst_ffi::GST_MAP_WRITE.bits(), + ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() + | gst_ffi::GST_MAP_WRITE.bits(), ), )); @@ -277,8 +277,8 @@ impl VideoFrame { buffer.to_glib_none().0, id, mem::transmute( - ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() | - gst_ffi::GST_MAP_WRITE.bits(), + ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() + | gst_ffi::GST_MAP_WRITE.bits(), ), )); diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index adf148fa0..6fc13fa67 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -596,9 +596,8 @@ impl glib::types::StaticType for VideoInfo { #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for VideoInfo { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo, - ) + Option::::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) + as *mut ffi::GstVideoInfo) } } @@ -607,8 +606,8 @@ impl glib::value::SetValue for VideoInfo { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -618,8 +617,8 @@ impl glib::value::SetValueOptional for VideoInfo { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 7dc7a4622..1178fa26d 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -11,7 +11,7 @@ use Element; use glib; use glib::IsA; -use glib::translate::{from_glib, from_glib_full, ToGlibPtr, ToGlib}; +use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; use ffi; @@ -60,37 +60,30 @@ impl> BinExtManual for O { fn iterate_all_by_interface(&self, iface: glib::types::Type) -> ::Iterator { unsafe { - from_glib_full(ffi::gst_bin_iterate_all_by_interface(self.to_glib_none().0, iface.to_glib())) + from_glib_full(ffi::gst_bin_iterate_all_by_interface( + self.to_glib_none().0, + iface.to_glib(), + )) } } fn iterate_elements(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_bin_iterate_elements(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_bin_iterate_elements(self.to_glib_none().0)) } } fn iterate_recurse(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_bin_iterate_recurse(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_bin_iterate_recurse(self.to_glib_none().0)) } } fn iterate_sinks(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_bin_iterate_sinks(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_bin_iterate_sinks(self.to_glib_none().0)) } } fn iterate_sorted(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_bin_iterate_sorted(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_bin_iterate_sorted(self.to_glib_none().0)) } } fn iterate_sources(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_bin_iterate_sources(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.to_glib_none().0)) } } } diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index d4aba14e6..8b097576a 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -334,8 +334,8 @@ impl ToOwned for BufferRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index 8a910a661..3bcf3aef2 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -88,8 +88,8 @@ impl ToOwned for BufferListRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index aca3defde..e8d0e8420 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -357,8 +357,8 @@ impl ToOwned for CapsRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index 939bbe3cc..0769712a0 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -81,8 +81,8 @@ impl ToOwned for ContextRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index fbdd59735..9aef44ba2 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -23,8 +23,8 @@ pub trait DeviceProviderExtManual { impl> DeviceProviderExtManual for O { fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> { unsafe { - let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as - *mut ffi::GstDeviceProviderClass; + let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class + as *mut ffi::GstDeviceProviderClass; let ptr = ffi::gst_device_provider_class_get_metadata(klass, key.to_glib_none().0); diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 67c933f3f..1e82c48a2 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -10,7 +10,7 @@ use Element; use glib; use glib::IsA; -use glib::translate::{from_glib, from_glib_none, from_glib_full, FromGlibPtrContainer, ToGlibPtr}; +use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlibPtr}; use QueryRef; use Event; use Pad; @@ -115,8 +115,8 @@ impl> ElementExtManual for O { fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> { unsafe { - let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as - *mut ffi::GstElementClass; + let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class + as *mut ffi::GstElementClass; let ptr = ffi::gst_element_class_get_metadata(klass, key.to_glib_none().0); @@ -130,8 +130,8 @@ impl> ElementExtManual for O { fn get_pad_template(&self, name: &str) -> Option { unsafe { - let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as - *mut ffi::GstElementClass; + let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class + as *mut ffi::GstElementClass; from_glib_none(ffi::gst_element_class_get_pad_template( klass, @@ -142,8 +142,8 @@ impl> ElementExtManual for O { fn get_pad_template_list(&self) -> Vec { unsafe { - let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as - *mut ffi::GstElementClass; + let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class + as *mut ffi::GstElementClass; FromGlibPtrContainer::from_glib_none( ffi::gst_element_class_get_pad_template_list(klass), @@ -217,21 +217,15 @@ impl> ElementExtManual for O { } fn iterate_pads(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_element_iterate_pads(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_element_iterate_pads(self.to_glib_none().0)) } } fn iterate_sink_pads(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_element_iterate_sink_pads(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_element_iterate_sink_pads(self.to_glib_none().0)) } } fn iterate_src_pads(&self) -> ::Iterator { - unsafe { - from_glib_full(ffi::gst_element_iterate_src_pads(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::gst_element_iterate_src_pads(self.to_glib_none().0)) } } } diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index f39396c63..730e55caa 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -498,8 +498,8 @@ impl glib::value::SetValue for Iterator { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -509,8 +509,8 @@ impl glib::value::SetValueOptional for Iterator { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index a08e6d887..e78ba8041 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -2315,8 +2315,7 @@ pub struct RedirectBuilder<'a> { tag_list: Option<&'a TagList>, entry_struct: Option, #[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] - entries: - Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>, + entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>, } #[cfg(feature = "v1_10")] impl<'a> RedirectBuilder<'a> { diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index b9ed9d6f6..b49be9fe7 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -67,8 +67,8 @@ impl GstRc { } self.obj = T::from_mut_ptr( - ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject) as - *mut T::GstType, + ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject) + as *mut T::GstType, ); assert!(self.is_writable()); @@ -194,8 +194,8 @@ where fn copy(&self) -> GstRc { unsafe { GstRc::from_glib_full( - ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject) as - *const Self::GstType, + ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject) + as *const Self::GstType, ) } } @@ -261,8 +261,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect(); let v_ptr = unsafe { - let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as - *mut *mut T::GstType; + let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) + as *mut *mut T::GstType; for (i, s) in v.iter().enumerate() { ptr::write(v_ptr.offset(i as isize), s.0); @@ -277,8 +277,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT fn to_glib_full_from_slice(t: &[GstRc]) -> *mut *mut T::GstType { skip_assert_initialized!(); unsafe { - let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as - *mut *mut T::GstType; + let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) + as *mut *mut T::GstType; for (i, s) in t.iter().enumerate() { ptr::write(v_ptr.offset(i as isize), s.to_glib_full()); diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index bbb1be850..24c58d601 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -25,7 +25,7 @@ use std::cell::RefCell; use glib; use glib::{IsA, StaticType}; -use glib::translate::{mut_override, from_glib, from_glib_borrow, from_glib_full, from_glib_none, +use glib::translate::{from_glib, from_glib_borrow, from_glib_full, from_glib_none, mut_override, FromGlib, ToGlib, ToGlibPtr}; use glib::source::CallbackGuard; use glib_ffi; @@ -40,7 +40,10 @@ impl Pad { pub fn new_from_static_template(templ: &StaticPadTemplate, name: &str) -> Pad { assert_initialized_main_thread!(); unsafe { - from_glib_none(ffi::gst_pad_new_from_static_template(mut_override(templ.to_glib_none().0), name.to_glib_none().0)) + from_glib_none(ffi::gst_pad_new_from_static_template( + mut_override(templ.to_glib_none().0), + name.to_glib_none().0, + )) } } } diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index b7dbaa1ce..5c15fadcb 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -78,12 +78,23 @@ impl ProxyPad { } } - pub fn iterate_internal_links_default<'a, P: IsA, Q: IsA + 'a, R: Into>>(pad: &P, parent: R) -> Option<::Iterator> { + pub fn iterate_internal_links_default< + 'a, + P: IsA, + Q: IsA + 'a, + R: Into>, + >( + pad: &P, + parent: R, + ) -> Option<::Iterator> { skip_assert_initialized!(); let parent = parent.into(); let parent = parent.to_glib_none(); unsafe { - from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(pad.to_glib_none().0, parent.0)) + from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default( + pad.to_glib_none().0, + parent.0, + )) } } } diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index 7b8be58c5..e017fcf8e 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -89,8 +89,8 @@ impl ToOwned for SampleRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 4b10ab7cb..eba0f5bab 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -330,8 +330,8 @@ impl Default for Segment { #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for Segment { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as - *mut ffi::GstSegment) + Option::::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) + as *mut ffi::GstSegment) } } @@ -340,8 +340,8 @@ impl glib::value::SetValue for Segment { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -351,8 +351,8 @@ impl glib::value::SetValueOptional for Segment { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer/src/static_caps.rs b/gstreamer/src/static_caps.rs index 6026125ee..91cb825d4 100644 --- a/gstreamer/src/static_caps.rs +++ b/gstreamer/src/static_caps.rs @@ -36,9 +36,8 @@ impl glib::types::StaticType for StaticCaps { #[doc(hidden)] impl<'a> glib::value::FromValueOptional<'a> for StaticCaps { unsafe fn from_value_optional(value: &glib::Value) -> Option { - Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps, - ) + Option::::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) + as *mut ffi::GstStaticCaps) } } @@ -47,8 +46,8 @@ impl glib::value::SetValue for StaticCaps { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -58,8 +57,8 @@ impl glib::value::SetValueOptional for StaticCaps { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index 7a46b137e..62c8d683e 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -55,8 +55,8 @@ impl glib::types::StaticType for StaticPadTemplate { impl<'a> glib::value::FromValueOptional<'a> for StaticPadTemplate { unsafe fn from_value_optional(value: &glib::Value) -> Option { Option::::from_glib_none( - gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as - *mut ffi::GstStaticPadTemplate, + gobject_ffi::g_value_get_boxed(value.to_glib_none().0) + as *mut ffi::GstStaticPadTemplate, ) } } @@ -66,8 +66,8 @@ impl glib::value::SetValue for StaticPadTemplate { unsafe fn set_value(value: &mut glib::Value, this: &Self) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(this).0 + as glib_ffi::gpointer, ) } } @@ -77,8 +77,8 @@ impl glib::value::SetValueOptional for StaticPadTemplate { unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) { gobject_ffi::g_value_set_boxed( value.to_glib_none_mut().0, - glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(&this).0 as - glib_ffi::gpointer, + glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(&this).0 + as glib_ffi::gpointer, ) } } diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 54dfc65d7..0c5798f99 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -103,7 +103,11 @@ impl_tag!(GeoLocationLongitute, f64, *TAG_GEO_LOCATION_LONGITUDE); impl_tag!(GeoLocationElevation, f64, *TAG_GEO_LOCATION_ELEVATION); impl_tag!(GeoLocationCity, &'a str, *TAG_GEO_LOCATION_CITY); impl_tag!(GeoLocationCountry, &'a str, *TAG_GEO_LOCATION_COUNTRY); -impl_tag!(GeoLocationSublocation, &'a str, *TAG_GEO_LOCATION_SUBLOCATION); +impl_tag!( + GeoLocationSublocation, + &'a str, + *TAG_GEO_LOCATION_SUBLOCATION +); impl_tag!( GeoLocationHorizontalError, f64, @@ -333,8 +337,8 @@ impl ToOwned for TagListRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 482935acf..98f84cb08 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -104,8 +104,8 @@ impl ToOwned for TocRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } @@ -256,8 +256,8 @@ impl ToOwned for TocEntryRef { fn to_owned(&self) -> GstRc { unsafe { - from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as - *mut _) + from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) + as *mut _) } } } diff --git a/tutorials/src/bin/basic-tutorial-1.rs b/tutorials/src/bin/basic-tutorial-1.rs index aa0a353a2..c2a849096 100644 --- a/tutorials/src/bin/basic-tutorial-1.rs +++ b/tutorials/src/bin/basic-tutorial-1.rs @@ -6,7 +6,8 @@ fn main() { gst::init().unwrap(); // Build the pipeline - let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; + let uri = + "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap(); // Start playing diff --git a/tutorials/src/bin/basic-tutorial-3.rs b/tutorials/src/bin/basic-tutorial-3.rs index fdfc7d2bb..a2650e009 100644 --- a/tutorials/src/bin/basic-tutorial-3.rs +++ b/tutorials/src/bin/basic-tutorial-3.rs @@ -23,7 +23,8 @@ fn main() { convert.link(&sink).expect("Elements could not be linked."); // Set the URI to play - let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; + let uri = + "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; source .set_property("uri", &uri) .expect("Can't set uri property on uridecodebin"); diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index 228a04766..5d53af5f6 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -22,7 +22,8 @@ fn main() { gst::ElementFactory::make("playbin", "playbin").expect("Failed to create playbin element"); // Set the URI to play - let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; + let uri = + "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"; playbin .set_property("uri", &uri) .expect("Can't set uri property on playbin"); @@ -62,16 +63,16 @@ fn main() { custom_data.duration = custom_data .playbin .query_duration(gst::Format::Time) - .expect("Could not query current duration.") as - gst::ClockTime; + .expect("Could not query current duration.") + as gst::ClockTime; } // Print current position and total duration print!("\rPosition {} / {}", position, custom_data.duration); io::stdout().flush().unwrap(); - if custom_data.seek_enabled && !custom_data.seek_done && - position > 10 * gst::SECOND + if custom_data.seek_enabled && !custom_data.seek_done + && position > 10 * gst::SECOND { println!("\nReached 10s, performing seek..."); custom_data diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index ef443e232..64b482f04 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -122,18 +122,17 @@ mod tutorial5 { 1.0 as f64, ); let pipeline = playbin.clone(); - let slider_update_signal_id = slider - .connect_value_changed(move |slider| { - let pipeline = &pipeline; - let value = slider.get_value() as u64; - if let Err(_) = pipeline.seek_simple( - gst::Format::Time, - gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT, - ((value * gst::SECOND) as i64), - ) { - eprintln!("Seeking to {} failed", value); - } - }); + let slider_update_signal_id = slider.connect_value_changed(move |slider| { + let pipeline = &pipeline; + let value = slider.get_value() as u64; + if let Err(_) = pipeline.seek_simple( + gst::Format::Time, + gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT, + ((value * gst::SECOND) as i64), + ) { + eprintln!("Seeking to {} failed", value); + } + }); slider.set_draw_value(false); let pipeline = playbin.clone(); diff --git a/tutorials/src/bin/basic-tutorial-7.rs b/tutorials/src/bin/basic-tutorial-7.rs index cc7b3e5ed..45d23508a 100644 --- a/tutorials/src/bin/basic-tutorial-7.rs +++ b/tutorials/src/bin/basic-tutorial-7.rs @@ -12,12 +12,12 @@ fn main() { let tee = gst::ElementFactory::make("tee", "tee").unwrap(); let audio_queue = gst::ElementFactory::make("queue", "audio_queue").unwrap(); let audio_convert = gst::ElementFactory::make("audioconvert", "audio_convert").unwrap(); - let audio_resample = gst::ElementFactory::make ("audioresample", "audio_resample").unwrap(); + let audio_resample = gst::ElementFactory::make("audioresample", "audio_resample").unwrap(); let audio_sink = gst::ElementFactory::make("autoaudiosink", "audio_sink").unwrap(); let video_queue = gst::ElementFactory::make("queue", "video_queue").unwrap(); let visual = gst::ElementFactory::make("wavescope", "visual").unwrap(); let video_convert = gst::ElementFactory::make("videoconvert", "video_convert").unwrap(); - let video_sink = gst::ElementFactory::make ("autovideosink", "video_sink").unwrap(); + let video_sink = gst::ElementFactory::make("autovideosink", "video_sink").unwrap(); let pipeline = gst::Pipeline::new("test-pipeline"); @@ -25,21 +25,43 @@ fn main() { visual.set_property_from_str("shader", "none"); visual.set_property_from_str("style", "lines"); - pipeline.add_many(&[&audio_source, &tee, &audio_queue, &audio_convert, - &audio_resample, &audio_sink, &video_queue, &visual, - &video_convert, &video_sink]).unwrap(); + pipeline + .add_many(&[ + &audio_source, + &tee, + &audio_queue, + &audio_convert, + &audio_resample, + &audio_sink, + &video_queue, + &visual, + &video_convert, + &video_sink, + ]) + .unwrap(); gst::Element::link_many(&[&audio_source, &tee]).unwrap(); - gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap(); + gst::Element::link_many(&[ + &audio_queue, + &audio_convert, + &audio_resample, + &audio_sink, + ]).unwrap(); gst::Element::link_many(&[&video_queue, &visual, &video_convert, &video_sink]).unwrap(); let tee_audio_pad = tee.get_request_pad("src_%u").unwrap(); - println!("Obtained request pad {} for audio branch", tee_audio_pad.get_name()); + println!( + "Obtained request pad {} for audio branch", + tee_audio_pad.get_name() + ); let queue_audio_pad = audio_queue.get_static_pad("sink").unwrap(); tee_audio_pad.link(&queue_audio_pad); let tee_video_pad = tee.get_request_pad("src_%u").unwrap(); - println!("Obtained request pad {} for video branch", tee_video_pad.get_name()); + println!( + "Obtained request pad {} for video branch", + tee_video_pad.get_name() + ); let queue_video_pad = video_queue.get_static_pad("sink").unwrap(); tee_video_pad.link(&queue_video_pad);