forked from mirrors/gstreamer-rs
Run everything through latest rustfmt-nightly
This commit is contained in:
parent
85b335fd89
commit
b4cb81cd56
14 changed files with 75 additions and 58 deletions
|
@ -114,7 +114,6 @@ fn create_ui(app: >k::Application) {
|
|||
process::exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
vbox.pack_start(&video_window, true, true, 0);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
() => (
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
extern crate glib_sys as glib_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_base_sys as ffi;
|
||||
extern crate gstreamer_sys as gst_ffi;
|
||||
|
||||
#[macro_use]
|
||||
extern crate glib;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -31,7 +31,6 @@ impl Player {
|
|||
let signal_dispatcher = signal_dispatcher.to_glib_none();
|
||||
unsafe { from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn set_config(&self, config: gst::Structure) -> bool {
|
||||
|
|
|
@ -12,12 +12,17 @@ use glib;
|
|||
use glib::translate::*;
|
||||
|
||||
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!();
|
||||
let application_context = application_context.into();
|
||||
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)
|
||||
from_glib_full(
|
||||
ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as
|
||||
*mut ffi::GstPlayerGMainContextSignalDispatcher,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
() => (
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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;
|
||||
|
@ -97,14 +97,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;
|
||||
|
@ -126,7 +120,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::*;
|
||||
|
|
|
@ -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 _)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ use std::mem::transmute;
|
|||
use std::ptr;
|
||||
|
||||
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_ffi;
|
||||
use glib_ffi::gpointer;
|
||||
|
@ -145,11 +146,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> {
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue