From 35aeaa1395e97dc58c5155069c7d452271a3bd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 14 Sep 2017 21:46:40 +0300 Subject: [PATCH] Run everything through latest rustfmt-nightly --- examples/src/bin/gtkvideooverlay.rs | 1 - gstreamer-app/src/lib.rs | 4 +- gstreamer-audio/src/lib.rs | 12 +++--- gstreamer-player/src/lib.rs | 2 +- gstreamer-player/src/player.rs | 1 - .../player_video_overlay_video_renderer.rs | 12 +++--- gstreamer-video/src/lib.rs | 10 ++--- gstreamer-video/src/video_info.rs | 6 +-- gstreamer/src/lib.rs | 14 ++----- gstreamer/src/message.rs | 3 +- gstreamer/src/miniobject.rs | 37 +++++++++++++------ gstreamer/src/pad.rs | 14 ++++++- gstreamer/src/parse_context.rs | 4 +- 13 files changed, 66 insertions(+), 54 deletions(-) diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 0cb140a2e..7813c9a3d 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -118,7 +118,6 @@ fn create_ui(app: >k::Application) { process::exit(-1); } } - }); vbox.pack_start(&video_window, true, true, 0); diff --git a/gstreamer-app/src/lib.rs b/gstreamer-app/src/lib.rs index 31365a0db..2481f769d 100644 --- a/gstreamer-app/src/lib.rs +++ b/gstreamer-app/src/lib.rs @@ -10,9 +10,9 @@ extern crate libc; extern crate glib_sys as glib_ffi; extern crate gobject_sys as gobject_ffi; -extern crate gstreamer_sys as gst_ffi; -extern crate gstreamer_app_sys as ffi; extern crate gstreamer as gst; +extern crate gstreamer_app_sys as ffi; +extern crate gstreamer_sys as gst_ffi; #[macro_use] extern crate glib; diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index 8a364f9ac..d3e4357c6 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -6,17 +6,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate array_init; #[macro_use] extern crate bitflags; -extern crate array_init; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; -extern crate gstreamer_sys as gst_ffi; -extern crate gstreamer_audio_sys as ffi; -extern crate gstreamer as gst; #[macro_use] extern crate glib; +extern crate glib_sys as glib_ffi; +extern crate gobject_sys as gobject_ffi; +extern crate gstreamer as gst; +extern crate gstreamer_audio_sys as ffi; +extern crate gstreamer_sys as gst_ffi; macro_rules! callback_guard { () => ( diff --git a/gstreamer-player/src/lib.rs b/gstreamer-player/src/lib.rs index a64e1bf7a..c50e3decd 100644 --- a/gstreamer-player/src/lib.rs +++ b/gstreamer-player/src/lib.rs @@ -10,8 +10,8 @@ extern crate libc; extern crate glib_sys as glib_ffi; extern crate gobject_sys as gobject_ffi; -extern crate gstreamer_player_sys as ffi; extern crate gstreamer as gst; +extern crate gstreamer_player_sys as ffi; #[macro_use] extern crate glib; diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index b398021a1..1de123ed6 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -30,7 +30,6 @@ impl Player { // https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/gst-libs/gst/player/gstplayer.c?id=634cd87c76f58b5e1383715bafd5614db825c7d1 unsafe { from_glib_none(ffi::gst_player_new(video_renderer, signal_dispatcher)) } } - } pub fn set_config(&self, config: gst::Structure) -> bool { diff --git a/gstreamer-player/src/player_video_overlay_video_renderer.rs b/gstreamer-player/src/player_video_overlay_video_renderer.rs index 1e7e69cba..a85819ccc 100644 --- a/gstreamer-player/src/player_video_overlay_video_renderer.rs +++ b/gstreamer-player/src/player_video_overlay_video_renderer.rs @@ -21,9 +21,9 @@ impl PlayerVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer { assert_initialized_main_thread!(); - from_glib_full(ffi::gst_player_video_overlay_video_renderer_new( - window_handle as *mut _, - ) as *mut _) + from_glib_full( + ffi::gst_player_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _, + ) } pub unsafe fn new_with_handle_and_sink>( @@ -35,8 +35,7 @@ impl PlayerVideoOverlayVideoRenderer { from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( window_handle as *mut _, video_sink.to_glib_none().0, - ) as - *mut _) + ) as *mut _) } pub fn new_with_sink>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer { @@ -46,8 +45,7 @@ impl PlayerVideoOverlayVideoRenderer { from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink( ptr::null_mut(), video_sink.to_glib_none().0, - ) as - *mut _) + ) as *mut _) } } } diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index e94cedfc8..eac705e80 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -10,13 +10,13 @@ extern crate bitflags; extern crate libc; -extern crate glib_sys as glib_ffi; -extern crate gobject_sys as gobject_ffi; -extern crate gstreamer_sys as gst_ffi; -extern crate gstreamer_video_sys as ffi; -extern crate gstreamer as gst; #[macro_use] extern crate glib; +extern crate glib_sys as glib_ffi; +extern crate gobject_sys as gobject_ffi; +extern crate gstreamer as gst; +extern crate gstreamer_sys as gst_ffi; +extern crate gstreamer_video_sys as ffi; macro_rules! assert_initialized_main_thread { () => ( diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 2fc514731..5bbf66789 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -26,8 +26,7 @@ pub enum VideoColorRange { Unknown, Range0255, Range16235, - #[doc(hidden)] - __Unknown(i32), + #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] @@ -183,8 +182,7 @@ pub struct VideoInfoBuilder<'a> { stride: Option<&'a [i32]>, multiview_mode: Option<::VideoMultiviewMode>, multiview_flags: Option<::VideoMultiviewFlags>, - #[cfg(feature = "v1_12")] - field_order: Option<::VideoFieldOrder>, + #[cfg(feature = "v1_12")] field_order: Option<::VideoFieldOrder>, } impl<'a> VideoInfoBuilder<'a> { diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 2e26844f2..04c54f6f3 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -9,9 +9,9 @@ #![recursion_limit = "256"] #[macro_use] extern crate bitflags; -extern crate libc; #[macro_use] extern crate lazy_static; +extern crate libc; extern crate glib_sys as glib_ffi; extern crate gobject_sys as gobject_ffi; @@ -93,14 +93,8 @@ mod iterator; mod device_provider; mod parse_context; pub use element::ElementExtManual; -pub use element::{ - ELEMENT_METADATA_AUTHOR, - ELEMENT_METADATA_DESCRIPTION, - ELEMENT_METADATA_DOC_URI, - ELEMENT_METADATA_ICON_NAME, - ELEMENT_METADATA_KLASS, - ELEMENT_METADATA_LONGNAME, -}; +pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI, + ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME}; pub use bin::BinExtManual; pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID}; pub use gobject::GObjectExtManualGst; @@ -122,7 +116,7 @@ pub mod toc; pub use toc::{Toc, TocEntry, TocEntryRef, TocRef}; mod clock; -pub use clock::{ClockId, ClockExtManual}; +pub use clock::{ClockExtManual, ClockId}; pub mod functions; pub use functions::*; diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index ee5e29edf..48ecdd37b 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -2186,7 +2186,8 @@ 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 a751e2d70..931fd7469 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -162,7 +162,7 @@ impl PartialEq for GstRc { } } -impl Eq for GstRc { } +impl Eq for GstRc {} impl fmt::Debug for GstRc { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -242,7 +242,10 @@ impl<'a, T: MiniObject + 'static> ToGlibPtrMut<'a, *mut T::GstType> for GstRc impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstType> for GstRc { #[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] - type Storage = (Vec>>, Option>); + type Storage = ( + Vec>>, + Option>, + ); fn to_glib_none_from_slice(t: &'a [GstRc]) -> (*mut *mut T::GstType, Self::Storage) { skip_assert_initialized!(); @@ -258,7 +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); @@ -273,7 +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()); @@ -284,13 +289,18 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT } } -impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType> for GstRc { +impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType> + for GstRc { #[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] - type Storage = (Vec>>, Option>); + type Storage = ( + Vec>>, + Option>, + ); fn to_glib_none_from_slice(t: &'a [GstRc]) -> (*const *mut T::GstType, Self::Storage) { skip_assert_initialized!(); - let (ptr, stash) = ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t); + let (ptr, stash) = + ToGlibContainerFromSlice::<'a, *mut *mut T::GstType>::to_glib_none_from_slice(t); (ptr as *const *mut T::GstType, stash) } @@ -343,7 +353,8 @@ impl FromGlibPtrBorrow<*mut T::GstType> for GstRc { } } -impl FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc { +impl FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType> + for GstRc { unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec { if num == 0 || ptr.is_null() { return Vec::new(); @@ -376,7 +387,8 @@ impl FromGlibContainerAsVec<*mut T::GstType, *mut *mut } } -impl FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc { +impl FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType> + for GstRc { unsafe fn from_glib_none_as_vec(ptr: *mut *mut T::GstType) -> Vec { FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, c_ptr_array_len(ptr)) } @@ -390,7 +402,8 @@ impl FromGlibPtrArrayContainerAsVec<*mut T::GstType, *m } } -impl FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc { +impl FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType> + for GstRc { unsafe fn from_glib_none_num_as_vec(ptr: *const *mut T::GstType, num: usize) -> Vec { FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num) } @@ -406,7 +419,9 @@ impl FromGlibContainerAsVec<*mut T::GstType, *const *mu } } -impl FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc { +impl< + T: MiniObject + 'static, +> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc { unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec { FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _) } diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index f4a6829b1..4492d1a74 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -145,11 +145,21 @@ impl> PadExtManual for O { } fn chain_list(&self, list: BufferList) -> FlowReturn { - unsafe { from_glib(ffi::gst_pad_chain_list(self.to_glib_none().0, list.into_ptr())) } + unsafe { + from_glib(ffi::gst_pad_chain_list( + self.to_glib_none().0, + list.into_ptr(), + )) + } } fn push_list(&self, list: BufferList) -> FlowReturn { - unsafe { from_glib(ffi::gst_pad_push_list(self.to_glib_none().0, list.into_ptr())) } + unsafe { + from_glib(ffi::gst_pad_push_list( + self.to_glib_none().0, + list.into_ptr(), + )) + } } fn get_range(&self, offset: u64, size: u32) -> Result { diff --git a/gstreamer/src/parse_context.rs b/gstreamer/src/parse_context.rs index 3f36e31e3..f1f908934 100644 --- a/gstreamer/src/parse_context.rs +++ b/gstreamer/src/parse_context.rs @@ -30,9 +30,7 @@ glib_wrapper! { impl ParseContext { pub fn new() -> Self { - unsafe { - from_glib_full(ffi::gst_parse_context_new()) - } + unsafe { from_glib_full(ffi::gst_parse_context_new()) } } pub fn get_missing_elements(&self) -> Vec {