Run everything through latest rustfmt-nightly

This commit is contained in:
Sebastian Dröge 2017-09-14 21:46:40 +03:00
parent 74ac0f9cdb
commit 35aeaa1395
13 changed files with 66 additions and 54 deletions

View file

@ -118,7 +118,6 @@ fn create_ui(app: &gtk::Application) {
process::exit(-1);
}
}
});
vbox.pack_start(&video_window, true, true, 0);

View file

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

View file

@ -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 {
() => (

View file

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

View file

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

View file

@ -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<P: IsA<gst::Element>>(
@ -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<P: IsA<gst::Element>>(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 _)
}
}
}

View file

@ -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 {
() => (

View file

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

View file

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

View file

@ -2186,7 +2186,8 @@ pub struct RedirectBuilder<'a> {
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
#[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> {

View file

@ -162,7 +162,7 @@ impl<T: MiniObject + PartialEq> PartialEq for GstRc<T> {
}
}
impl<T: MiniObject + Eq> Eq for GstRc<T> { }
impl<T: MiniObject + Eq> Eq for GstRc<T> {}
impl<T: MiniObject + fmt::Debug> fmt::Debug for GstRc<T> {
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<T>
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstType> for GstRc<T> {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
type Storage = (
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
Option<Vec<*mut T::GstType>>,
);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*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<T>]) -> *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<T> {
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType>
for GstRc<T> {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
type Storage = (Vec<Stash<'a, *mut T::GstType, GstRc<T>>>, Option<Vec<*mut T::GstType>>);
type Storage = (
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
Option<Vec<*mut T::GstType>>,
);
fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*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<T: MiniObject + 'static> FromGlibPtrBorrow<*mut T::GstType> for GstRc<T> {
}
}
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec<Self> {
if num == 0 || ptr.is_null() {
return Vec::new();
@ -376,7 +387,8 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut
}
}
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_as_vec(ptr: *mut *mut T::GstType) -> Vec<Self> {
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, c_ptr_array_len(ptr))
}
@ -390,7 +402,8 @@ impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *m
}
}
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType>
for GstRc<T> {
unsafe fn from_glib_none_num_as_vec(ptr: *const *mut T::GstType, num: usize) -> Vec<Self> {
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num)
}
@ -406,7 +419,9 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mu
}
}
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
impl<
T: MiniObject + 'static,
> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec<Self> {
FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _)
}

View file

@ -145,11 +145,21 @@ impl<O: IsA<Pad>> 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<Buffer, FlowReturn> {

View file

@ -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<String> {