Commit 492c3d65 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Run everything through rustfmt again

parent fca0287d
......@@ -9,9 +9,9 @@ extern crate glib;
extern crate byte_slice_cast;
use byte_slice_cast::*;
use std::error::Error as StdError;
use std::i16;
use std::i32;
use std::error::Error as StdError;
extern crate failure;
use failure::Error;
......
......@@ -3,8 +3,8 @@ extern crate gstreamer as gst;
extern crate gstreamer_pbutils as pbutils;
use pbutils::prelude::*;
use pbutils::DiscovererStreamInfo;
use pbutils::DiscovererInfo;
use pbutils::DiscovererStreamInfo;
extern crate glib;
......
......@@ -10,14 +10,14 @@ extern crate gstreamer_rtsp as gst_rtsp;
extern crate gstreamer_rtsp_server as gst_rtsp_server;
extern crate gstreamer_rtsp_server_sys as ffi;
use failure::Error;
use std::env;
use std::ptr;
use failure::Error;
use glib::translate::*;
use gst_rtsp::*;
use gst_rtsp_server::prelude::*;
use gst_rtsp_server::*;
use gst_rtsp::*;
#[path = "../examples-common.rs"]
mod examples_common;
......
......@@ -8,11 +8,11 @@
use AppSink;
use ffi;
use gst_ffi;
use glib::translate::*;
use gst;
use glib::source::CallbackGuard;
use glib::translate::*;
use glib_ffi::gpointer;
use gst;
use gst_ffi;
use std::ptr;
pub struct AppSinkCallbacks {
......
......@@ -8,12 +8,12 @@
use AppSrc;
use ffi;
use glib::translate::*;
use gst;
use glib::source::CallbackGuard;
use glib::translate::*;
use glib_ffi::{gboolean, gpointer};
use std::ptr;
use gst;
use std::mem;
use std::ptr;
pub struct AppSrcCallbacks {
need_data: Option<Box<Fn(&AppSrc, u32) + Send + Sync + 'static>>,
......
......@@ -20,14 +20,13 @@ extern crate gstreamer_sys as gst_ffi;
extern crate glib;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! skip_assert_initialized {
() => (
)
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......@@ -39,10 +38,10 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
mod auto;
pub use auto::*;
mod app_src;
mod app_sink;
pub use app_src::*;
mod app_src;
pub use app_sink::*;
pub use app_src::*;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
......
......@@ -6,15 +6,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use AudioChannelPosition;
use ffi;
use std::mem;
use gst;
use gst::MiniObject;
use glib;
use glib::translate::{from_glib, ToGlib};
use gst;
use gst::MiniObject;
use array_init;
......
......@@ -10,11 +10,11 @@ use ffi;
use glib_ffi;
use gobject_ffi;
use gst;
use gst::prelude::*;
use glib;
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrNone, ToGlib,
ToGlibPtr, ToGlibPtrMut};
use gst;
use gst::prelude::*;
use std::mem;
use std::ptr;
......
......@@ -6,22 +6,40 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use AudioStreamAlign;
use ffi;
use gst;
use glib::translate::*;
use gst;
use std::mem;
impl AudioStreamAlign {
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn process(&mut self, discont: bool, timestamp: gst::ClockTime, n_samples: u32) -> (bool, gst::ClockTime, gst::ClockTime, u64) {
pub fn process(
&mut self,
discont: bool,
timestamp: gst::ClockTime,
n_samples: u32,
) -> (bool, gst::ClockTime, gst::ClockTime, u64) {
unsafe {
let mut out_timestamp = mem::uninitialized();
let mut out_duration = mem::uninitialized();
let mut out_sample_position = mem::uninitialized();
let ret = from_glib(ffi::gst_audio_stream_align_process(self.to_glib_none_mut().0, discont.to_glib(), timestamp.to_glib(), n_samples, &mut out_timestamp, &mut out_duration, &mut out_sample_position));
(ret, from_glib(out_timestamp), from_glib(out_duration), out_sample_position)
let ret = from_glib(ffi::gst_audio_stream_align_process(
self.to_glib_none_mut().0,
discont.to_glib(),
timestamp.to_glib(),
n_samples,
&mut out_timestamp,
&mut out_duration,
&mut out_sample_position,
));
(
ret,
from_glib(out_timestamp),
from_glib(out_duration),
out_sample_position,
)
}
}
}
......@@ -19,22 +19,21 @@ extern crate gstreamer_audio_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
)
};
}
macro_rules! skip_assert_initialized {
() => (
)
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......
......@@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use Adapter;
use ffi;
use glib::translate::*;
use gst;
use Adapter;
use std::io;
impl Adapter {
......
......@@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use BaseSink;
use ffi;
use glib::IsA;
use glib::translate::*;
use gst;
use BaseSink;
pub trait BaseSinkExtManual {
fn get_segment(&self) -> gst::Segment;
......
......@@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use BaseSrc;
use ffi;
use glib::IsA;
use glib::translate::*;
use gst;
use BaseSrc;
pub trait BaseSrcExtManual {
fn get_segment(&self) -> gst::Segment;
......
......@@ -6,11 +6,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use BaseTransform;
use ffi;
use glib::IsA;
use glib::translate::*;
use gst;
use BaseTransform;
pub trait BaseTransformExtManual {
fn get_segment(&self) -> gst::Segment;
......
......@@ -16,17 +16,17 @@ extern crate gstreamer_sys as gst_ffi;
extern crate glib;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
)
};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......@@ -36,8 +36,8 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto;
pub use auto::*;
pub use auto::functions::*;
pub use auto::*;
pub mod functions;
pub use functions::*;
......@@ -45,8 +45,8 @@ pub use functions::*;
mod adapter;
mod flow_combiner;
pub use flow_combiner::*;
mod base_src;
mod base_sink;
mod base_src;
mod base_transform;
// Re-export all the traits in a prelude module, so that applications
......@@ -56,8 +56,8 @@ pub mod prelude {
pub use gst::prelude::*;
pub use auto::traits::*;
pub use base_src::BaseSrcExtManual;
pub use base_sink::BaseSinkExtManual;
pub use base_src::BaseSrcExtManual;
pub use base_transform::BaseTransformExtManual;
}
......
......@@ -16,17 +16,17 @@ extern crate gstreamer_sys as gst_ffi;
extern crate glib;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
)
};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......
......@@ -6,27 +6,42 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use NetClientClock;
use ffi;
use gst;
use glib::object::Downcast;
use glib::translate::*;
use gst;
impl NetClientClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NetClientClock {
pub fn new<'a, P: Into<Option<&'a str>>>(
name: P,
remote_address: &str,
remote_port: i32,
base_time: gst::ClockTime,
) -> NetClientClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) {
unsafe {
gst::Clock::from_glib_full(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_full(ffi::gst_net_client_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
} else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe {
gst::Clock::from_glib_none(ffi::gst_net_client_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_none(ffi::gst_net_client_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
}
}
......
......@@ -6,27 +6,42 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use NtpClock;
use ffi;
use gst;
use glib::object::Downcast;
use glib::translate::*;
use gst;
impl NtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(
name: P,
remote_address: &str,
remote_port: i32,
base_time: gst::ClockTime,
) -> NtpClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) {
unsafe {
gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
} else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe {
gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
}
}
......
......@@ -6,27 +6,42 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use PtpClock;
use ffi;
use gst;
use glib::object::Downcast;
use glib::translate::*;
use gst;
impl PtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> PtpClock {
pub fn new<'a, P: Into<Option<&'a str>>>(
name: P,
remote_address: &str,
remote_port: i32,
base_time: gst::ClockTime,
) -> PtpClock {
assert_initialized_main_thread!();
let name = name.into();
let name = name.to_glib_none();
let (major, minor, _, _) = gst::version();
if (major, minor) > (1, 12) {
unsafe {
gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_full(ffi::gst_ntp_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
} else {
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
unsafe {
gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(name.0, remote_address.to_glib_none().0, remote_port, base_time.to_glib())).downcast_unchecked()
gst::Clock::from_glib_none(ffi::gst_ntp_clock_new(
name.0,
remote_address.to_glib_none().0,
remote_port,
base_time.to_glib(),
)).downcast_unchecked()
}
}
}
......
......@@ -11,19 +11,19 @@ use gst;
use auto::Discoverer;
use glib::Value;
use glib::IsA;
use glib::signal::connect;
use glib::Value;
use glib::object::Downcast;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib::object::Downcast;
use ffi;
use glib_ffi;
use gobject_ffi;
use std::mem::transmute;
use std::boxed::Box as Box_;
use std::mem::transmute;
impl Discoverer {
pub fn set_property_timeout(&self, timeout: gst::ClockTime) {
......
......@@ -9,9 +9,9 @@
use DiscovererVideoInfo;
use gst;
use ffi;
use glib::translate::*;
use gst;
impl DiscovererVideoInfo {
pub fn get_framerate(&self) -> gst::Fraction {
......
......@@ -23,25 +23,24 @@ extern crate gstreamer_sys as gst_ffi;
static PBUTILS_INIT: Once = ONCE_INIT;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
::PBUTILS_INIT.call_once(|| {
unsafe{::ffi::gst_pb_utils_init()};
unsafe { ::ffi::gst_pb_utils_init() };
});
)
};
}
macro_rules! skip_assert_initialized {
() => (
)
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......
......@@ -7,9 +7,9 @@
// except according to those terms.
use ffi;
use gst_ffi;
use glib::translate::*;
use gst;
use gst_ffi;
use std::mem;
use std::ops;
......
......@@ -19,19 +19,17 @@ extern crate gstreamer_video as gst_video;
extern crate glib;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! skip_assert_initialized {
() => (
)
() => {};
}
macro_rules! assert_initialized_main_thread {
() => (
)
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......@@ -45,14 +43,14 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
mod auto;
pub use auto::*;
mod player;
mod config;
mod player;
pub use config::*;
mod player_video_info;
mod player_video_overlay_video_renderer;
mod player_g_main_context_signal_dispatcher;
mod player_video_overlay_video_renderer;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
......
......@@ -10,11 +10,11 @@ use Player;
use PlayerSignalDispatcher;
use PlayerVideoRenderer;
use ffi;
use glib_ffi;
use glib;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gst;
use std::boxed::Box as Box_;
use std::mem::transmute;
......
......@@ -6,10 +6,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use PlayerVideoInfo;
use ffi;
use glib::translate::*;
use gst;
use PlayerVideoInfo;
use std::mem;
impl PlayerVideoInfo {
......
......@@ -28,22 +28,21 @@ extern crate gstreamer_rtsp_sys as gst_rtsp_ffi;
extern crate gstreamer_sys as gst_ffi;
macro_rules! callback_guard {
() => (
() => {
let _guard = ::glib::CallbackGuard::new();
)
};
}
macro_rules! assert_initialized_main_thread {
() => (
if unsafe {::gst_ffi::gst_is_initialized()} != ::glib_ffi::GTRUE {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
)
};
}
macro_rules! skip_assert_initialized {
() => (
)
() => {};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
......@@ -55,37 +54,81 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
mod auto;
pub use auto::*;
mod r_t_s_p_server;
mod r_t_s_p_address_pool;
mod r_t_s_p_auth;
mod r_t_s_p_client;
mod r_t_s_p_session_pool;
mod r_t_s_p_context;
mod r_t_s_p_auth;
mod r_t_s_p_token;
mod r_t_s_p_media_factory;
mod r_t_s_p_server;
mod r_t_s_p_session_pool;
mod r_t_s_p_token;
pub use r_t_s_p_server::RTSPServerExtManual;
pub use r_t_s_p_address_pool::RTSPAddressPoolExtManual;
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
pub use r_t_s_p_auth::RTSPAuthExtManual;
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_media_factory::RTSPMediaFactoryExtManual;
pub use r_t_s_p_server::RTSPServerExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
pub use r_t_s_p_context::*;
pub use r_t_s_p_token::*;
lazy_static! {
pub static ref RTSP_ADDRESS_POOL_ANY_IPV4: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV4).to_str().unwrap()};
pub static ref RTSP_ADDRESS_POOL_ANY_IPV6: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV6).to_str().unwrap()};
pub static ref RTSP_AUTH_CHECK_CONNECT: &'static str