Run everything through latest rustfmt-nightly

This commit is contained in:
Sebastian Dröge 2017-09-10 14:55:29 +03:00
parent 85b335fd89
commit b4cb81cd56
14 changed files with 75 additions and 58 deletions

View file

@ -114,7 +114,6 @@ fn create_ui(app: &gtk::Application) {
process::exit(-1); process::exit(-1);
} }
} }
}); });
vbox.pack_start(&video_window, true, true, 0); 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 glib_sys as glib_ffi;
extern crate gobject_sys as gobject_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 as gst;
extern crate gstreamer_app_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;

View file

@ -6,17 +6,17 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
extern crate array_init;
#[macro_use] #[macro_use]
extern crate bitflags; 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] #[macro_use]
extern crate glib; 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 { macro_rules! callback_guard {
() => ( () => (

View file

@ -8,9 +8,9 @@
extern crate glib_sys as glib_ffi; extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_base_sys as ffi;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_base_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;

View file

@ -10,8 +10,8 @@ extern crate libc;
extern crate glib_sys as glib_ffi; extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_player_sys as ffi;
extern crate gstreamer as gst; extern crate gstreamer as gst;
extern crate gstreamer_player_sys as ffi;
#[macro_use] #[macro_use]
extern crate glib; extern crate glib;

View file

@ -31,7 +31,6 @@ impl Player {
let signal_dispatcher = signal_dispatcher.to_glib_none(); let signal_dispatcher = signal_dispatcher.to_glib_none();
unsafe { from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) } unsafe { from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) }
} }
} }
pub fn set_config(&self, config: gst::Structure) -> bool { pub fn set_config(&self, config: gst::Structure) -> bool {

View file

@ -12,12 +12,17 @@ use glib;
use glib::translate::*; use glib::translate::*;
impl PlayerGMainContextSignalDispatcher { impl PlayerGMainContextSignalDispatcher {
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(application_context: P) -> PlayerGMainContextSignalDispatcher { pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(
application_context: P,
) -> PlayerGMainContextSignalDispatcher {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let application_context = application_context.into(); let application_context = application_context.into();
let application_context = application_context.to_glib_none(); let application_context = application_context.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as *mut ffi::GstPlayerGMainContextSignalDispatcher) from_glib_full(
ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as
*mut ffi::GstPlayerGMainContextSignalDispatcher,
)
} }
} }
} }

View file

@ -21,9 +21,9 @@ impl PlayerVideoOverlayVideoRenderer {
pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer { pub unsafe fn new(window_handle: uintptr_t) -> PlayerVideoOverlayVideoRenderer {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
from_glib_full(ffi::gst_player_video_overlay_video_renderer_new( from_glib_full(
window_handle as *mut _, ffi::gst_player_video_overlay_video_renderer_new(window_handle as *mut _) as *mut _,
) as *mut _) )
} }
pub unsafe fn new_with_handle_and_sink<P: IsA<gst::Element>>( 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( from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
window_handle as *mut _, window_handle as *mut _,
video_sink.to_glib_none().0, video_sink.to_glib_none().0,
) as ) as *mut _)
*mut _)
} }
pub fn new_with_sink<P: IsA<gst::Element>>(video_sink: &P) -> PlayerVideoOverlayVideoRenderer { 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( from_glib_full(ffi::gst_player_video_overlay_video_renderer_new_with_sink(
ptr::null_mut(), ptr::null_mut(),
video_sink.to_glib_none().0, video_sink.to_glib_none().0,
) as ) as *mut _)
*mut _)
} }
} }
} }

View file

@ -10,13 +10,13 @@
extern crate bitflags; extern crate bitflags;
extern crate libc; 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] #[macro_use]
extern crate glib; 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 { macro_rules! assert_initialized_main_thread {
() => ( () => (

View file

@ -26,8 +26,7 @@ pub enum VideoColorRange {
Unknown, Unknown,
Range0255, Range0255,
Range16235, Range16235,
#[doc(hidden)] #[doc(hidden)] __Unknown(i32),
__Unknown(i32),
} }
#[doc(hidden)] #[doc(hidden)]
@ -183,8 +182,7 @@ pub struct VideoInfoBuilder<'a> {
stride: Option<&'a [i32]>, stride: Option<&'a [i32]>,
multiview_mode: Option<::VideoMultiviewMode>, multiview_mode: Option<::VideoMultiviewMode>,
multiview_flags: Option<::VideoMultiviewFlags>, multiview_flags: Option<::VideoMultiviewFlags>,
#[cfg(feature = "v1_12")] #[cfg(feature = "v1_12")] field_order: Option<::VideoFieldOrder>,
field_order: Option<::VideoFieldOrder>,
} }
impl<'a> VideoInfoBuilder<'a> { impl<'a> VideoInfoBuilder<'a> {

View file

@ -9,9 +9,9 @@
#![recursion_limit = "256"] #![recursion_limit = "256"]
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
extern crate libc;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate libc;
extern crate glib_sys as glib_ffi; extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi; extern crate gobject_sys as gobject_ffi;
@ -97,14 +97,8 @@ mod iterator;
mod device_provider; mod device_provider;
mod parse_context; mod parse_context;
pub use element::ElementExtManual; pub use element::ElementExtManual;
pub use element::{ pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
ELEMENT_METADATA_DESCRIPTION,
ELEMENT_METADATA_DOC_URI,
ELEMENT_METADATA_ICON_NAME,
ELEMENT_METADATA_KLASS,
ELEMENT_METADATA_LONGNAME,
};
pub use bin::BinExtManual; pub use bin::BinExtManual;
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID}; pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID};
pub use gobject::GObjectExtManualGst; pub use gobject::GObjectExtManualGst;
@ -126,7 +120,7 @@ pub mod toc;
pub use toc::{Toc, TocEntry, TocEntryRef, TocRef}; pub use toc::{Toc, TocEntry, TocEntryRef, TocRef};
mod clock; mod clock;
pub use clock::{ClockId, ClockExtManual}; pub use clock::{ClockExtManual, ClockId};
pub mod functions; pub mod functions;
pub use functions::*; pub use functions::*;

View file

@ -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> { impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstType> for GstRc<T> {
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] #[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) { fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*mut *mut T::GstType, Self::Storage) {
skip_assert_initialized!(); 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: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let v_ptr = unsafe { 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() { for (i, s) in v.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.0); 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 { fn to_glib_full_from_slice(t: &[GstRc<T>]) -> *mut *mut T::GstType {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { 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() { for (i, s) in t.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.to_glib_full()); 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))] #[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) { fn to_glib_none_from_slice(t: &'a [GstRc<T>]) -> (*const *mut T::GstType, Self::Storage) {
skip_assert_initialized!(); 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) (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> { unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec<Self> {
if num == 0 || ptr.is_null() { if num == 0 || ptr.is_null() {
return Vec::new(); 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> { 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)) 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> { 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) 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> { unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec<Self> {
FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _) FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _)
} }

View file

@ -21,7 +21,8 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
use glib::{IsA, StaticType}; use glib::{IsA, StaticType};
use glib::translate::{from_glib, from_glib_full, from_glib_borrow, from_glib_none, FromGlib, ToGlib, ToGlibPtr}; use glib::translate::{from_glib, from_glib_borrow, from_glib_full, from_glib_none, FromGlib,
ToGlib, ToGlibPtr};
use glib::source::CallbackGuard; use glib::source::CallbackGuard;
use glib_ffi; use glib_ffi;
use glib_ffi::gpointer; use glib_ffi::gpointer;
@ -145,11 +146,21 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
fn chain_list(&self, list: BufferList) -> FlowReturn { 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 { 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> { fn get_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowReturn> {

View file

@ -30,9 +30,7 @@ glib_wrapper! {
impl ParseContext { impl ParseContext {
pub fn new() -> Self { pub fn new() -> Self {
unsafe { unsafe { from_glib_full(ffi::gst_parse_context_new()) }
from_glib_full(ffi::gst_parse_context_new())
}
} }
pub fn get_missing_elements(&self) -> Vec<String> { pub fn get_missing_elements(&self) -> Vec<String> {