From 492c3d656cbdf3619e4be09b374ac4a7cf552013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 1 Apr 2018 11:30:03 +0300 Subject: [PATCH] Run everything through rustfmt again --- examples/src/bin/appsink.rs | 2 +- examples/src/bin/discoverer.rs | 2 +- examples/src/bin/rtsp-server-record.rs | 4 +- gstreamer-app/src/app_sink.rs | 6 +- gstreamer-app/src/app_src.rs | 6 +- gstreamer-app/src/lib.rs | 11 +- gstreamer-audio/src/audio_channel_position.rs | 6 +- gstreamer-audio/src/audio_info.rs | 4 +- gstreamer-audio/src/audio_stream_align.rs | 28 +- gstreamer-audio/src/lib.rs | 13 +- gstreamer-base/src/adapter.rs | 2 +- gstreamer-base/src/base_sink.rs | 2 +- gstreamer-base/src/base_src.rs | 2 +- gstreamer-base/src/base_transform.rs | 2 +- gstreamer-base/src/lib.rs | 16 +- gstreamer-net/src/lib.rs | 10 +- gstreamer-net/src/net_client_clock.rs | 25 +- gstreamer-net/src/ntp_clock.rs | 25 +- gstreamer-net/src/ptp_clock.rs | 25 +- gstreamer-pbutils/src/discoverer.rs | 10 +- .../src/discoverer_video_info.rs | 2 +- gstreamer-pbutils/src/lib.rs | 15 +- gstreamer-player/src/config.rs | 2 +- gstreamer-player/src/lib.rs | 14 +- gstreamer-player/src/player.rs | 2 +- gstreamer-player/src/player_video_info.rs | 2 +- gstreamer-rtsp-server/src/lib.rs | 103 +++-- gstreamer-rtsp-server/src/r_t_s_p_client.rs | 2 +- .../src/r_t_s_p_media_factory.rs | 9 +- gstreamer-rtsp-server/src/r_t_s_p_server.rs | 2 +- .../src/r_t_s_p_session_pool.rs | 8 +- gstreamer-rtsp-server/src/r_t_s_p_token.rs | 26 +- gstreamer-rtsp/src/lib.rs | 9 +- gstreamer-sdp/src/lib.rs | 3 +- gstreamer-video/src/functions.rs | 8 +- gstreamer-video/src/lib.rs | 13 +- gstreamer-video/src/video_event.rs | 10 +- gstreamer-video/src/video_frame.rs | 10 +- gstreamer-video/src/video_info.rs | 6 +- gstreamer-video/src/video_overlay.rs | 2 +- gstreamer/src/buffer.rs | 20 +- gstreamer/src/buffer_pool.rs | 2 +- gstreamer/src/bufferlist.rs | 2 +- gstreamer/src/bus.rs | 16 +- gstreamer/src/caps.rs | 6 +- gstreamer/src/child_proxy.rs | 2 +- gstreamer/src/clock.rs | 14 +- gstreamer/src/context.rs | 4 +- gstreamer/src/element.rs | 62 ++- gstreamer/src/enums.rs | 6 +- gstreamer/src/event.rs | 10 +- gstreamer/src/format.rs | 2 +- gstreamer/src/functions.rs | 4 +- gstreamer/src/ghost_pad.rs | 8 +- gstreamer/src/iterator.rs | 18 +- gstreamer/src/lib.rs | 77 ++-- gstreamer/src/log.rs | 4 +- gstreamer/src/message.rs | 26 +- gstreamer/src/miniobject.rs | 17 +- gstreamer/src/object.rs | 4 +- gstreamer/src/pad.rs | 28 +- gstreamer/src/pad_template.rs | 12 +- gstreamer/src/parse_context.rs | 2 +- gstreamer/src/promise.rs | 16 +- gstreamer/src/proxy_pad.rs | 10 +- gstreamer/src/query.rs | 8 +- gstreamer/src/sample.rs | 6 +- gstreamer/src/segment.rs | 8 +- gstreamer/src/static_pad_template.rs | 4 +- gstreamer/src/stream_collection.rs | 2 +- gstreamer/src/structure.rs | 14 +- gstreamer/src/tag_setter.rs | 4 +- gstreamer/src/tags.rs | 366 +++++++++++++----- gstreamer/src/toc.rs | 8 +- gstreamer/src/typefind.rs | 14 +- gstreamer/src/value.rs | 4 +- tutorials/src/bin/basic-tutorial-4.rs | 4 +- tutorials/src/bin/basic-tutorial-5.rs | 2 +- tutorials/src/bin/basic-tutorial-6.rs | 2 +- 79 files changed, 797 insertions(+), 470 deletions(-) diff --git a/examples/src/bin/appsink.rs b/examples/src/bin/appsink.rs index 5b91eb4de..ed32a1758 100644 --- a/examples/src/bin/appsink.rs +++ b/examples/src/bin/appsink.rs @@ -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; diff --git a/examples/src/bin/discoverer.rs b/examples/src/bin/discoverer.rs index 7b9f10b7f..8a5aa39a5 100644 --- a/examples/src/bin/discoverer.rs +++ b/examples/src/bin/discoverer.rs @@ -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; diff --git a/examples/src/bin/rtsp-server-record.rs b/examples/src/bin/rtsp-server-record.rs index 75932871d..d95b17076 100644 --- a/examples/src/bin/rtsp-server-record.rs +++ b/examples/src/bin/rtsp-server-record.rs @@ -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; diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index 0e5ff59b4..7c08efad9 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -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 { diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index ffa383aae..b0f7fefd1 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -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>, diff --git a/gstreamer-app/src/lib.rs b/gstreamer-app/src/lib.rs index 2d2c060f5..f7878cb6b 100644 --- a/gstreamer-app/src/lib.rs +++ b/gstreamer-app/src/lib.rs @@ -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 diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 310b45d04..5c05a7424 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -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; diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 6a03a80ac..6b3224532 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -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; diff --git a/gstreamer-audio/src/audio_stream_align.rs b/gstreamer-audio/src/audio_stream_align.rs index 3307c5d23..42ee4fead 100644 --- a/gstreamer-audio/src/audio_stream_align.rs +++ b/gstreamer-audio/src/audio_stream_align.rs @@ -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, + ) } } } diff --git a/gstreamer-audio/src/lib.rs b/gstreamer-audio/src/lib.rs index 37eb54972..4c000da2a 100644 --- a/gstreamer-audio/src/lib.rs +++ b/gstreamer-audio/src/lib.rs @@ -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}; diff --git a/gstreamer-base/src/adapter.rs b/gstreamer-base/src/adapter.rs index 687ccc984..47e5d88a1 100644 --- a/gstreamer-base/src/adapter.rs +++ b/gstreamer-base/src/adapter.rs @@ -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 { diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 661e5fb2d..07863445a 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -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; diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 17640cefc..462eaedec 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -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; diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index 361f7dc39..6d08de1b7 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -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; diff --git a/gstreamer-base/src/lib.rs b/gstreamer-base/src/lib.rs index 8cd32f656..a0c37ff06 100644 --- a/gstreamer-base/src/lib.rs +++ b/gstreamer-base/src/lib.rs @@ -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; } diff --git a/gstreamer-net/src/lib.rs b/gstreamer-net/src/lib.rs index fd6d360ca..3c6db4b37 100644 --- a/gstreamer-net/src/lib.rs +++ b/gstreamer-net/src/lib.rs @@ -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}; diff --git a/gstreamer-net/src/net_client_clock.rs b/gstreamer-net/src/net_client_clock.rs index 5ab56560e..fbe9d6b26 100644 --- a/gstreamer-net/src/net_client_clock.rs +++ b/gstreamer-net/src/net_client_clock.rs @@ -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>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NetClientClock { + pub fn new<'a, P: Into>>( + 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() } } } diff --git a/gstreamer-net/src/ntp_clock.rs b/gstreamer-net/src/ntp_clock.rs index 9094ff940..0a225e551 100644 --- a/gstreamer-net/src/ntp_clock.rs +++ b/gstreamer-net/src/ntp_clock.rs @@ -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>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> NtpClock { + pub fn new<'a, P: Into>>( + 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() } } } diff --git a/gstreamer-net/src/ptp_clock.rs b/gstreamer-net/src/ptp_clock.rs index 1c25b8604..390db0980 100644 --- a/gstreamer-net/src/ptp_clock.rs +++ b/gstreamer-net/src/ptp_clock.rs @@ -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>>(name: P, remote_address: &str, remote_port: i32, base_time: gst::ClockTime) -> PtpClock { + pub fn new<'a, P: Into>>( + 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() } } } diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index 223211fbd..9132d936f 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -11,19 +11,19 @@ use gst; use auto::Discoverer; -use glib::Value; use glib::IsA; -use glib::signal::connect; -use glib::signal::SignalHandlerId; -use glib::translate::*; +use glib::Value; use glib::object::Downcast; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; 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) { diff --git a/gstreamer-pbutils/src/discoverer_video_info.rs b/gstreamer-pbutils/src/discoverer_video_info.rs index 90a1f28ea..27b54fe8d 100644 --- a/gstreamer-pbutils/src/discoverer_video_info.rs +++ b/gstreamer-pbutils/src/discoverer_video_info.rs @@ -9,9 +9,9 @@ use DiscovererVideoInfo; -use gst; use ffi; use glib::translate::*; +use gst; impl DiscovererVideoInfo { pub fn get_framerate(&self) -> gst::Fraction { diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index b8907cef6..b0b12d603 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -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}; diff --git a/gstreamer-player/src/config.rs b/gstreamer-player/src/config.rs index a71e59584..94e2e5e5f 100644 --- a/gstreamer-player/src/config.rs +++ b/gstreamer-player/src/config.rs @@ -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; diff --git a/gstreamer-player/src/lib.rs b/gstreamer-player/src/lib.rs index 027b87ee3..e4e93263f 100644 --- a/gstreamer-player/src/lib.rs +++ b/gstreamer-player/src/lib.rs @@ -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 diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index 8ac8d155f..eeb75bed7 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -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; diff --git a/gstreamer-player/src/player_video_info.rs b/gstreamer-player/src/player_video_info.rs index 55fbf86c9..0111fb81b 100644 --- a/gstreamer-player/src/player_video_info.rs +++ b/gstreamer-player/src/player_video_info.rs @@ -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 { diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 46cfe71dd..2e73cee92 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -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_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_client; +mod r_t_s_p_context; 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 = unsafe{CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_CONNECT).to_str().unwrap()}; - pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS).to_str().unwrap()}; - pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT).to_str().unwrap()}; - pub static ref RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS).to_str().unwrap()}; - pub static ref RTSP_AUTH_CHECK_URL: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_URL).to_str().unwrap()}; - pub static ref RTSP_PERM_MEDIA_FACTORY_ACCESS: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS).to_str().unwrap()}; - pub static ref RTSP_PERM_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT).to_str().unwrap()}; - pub static ref RTSP_TOKEN_MEDIA_FACTORY_ROLE: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE).to_str().unwrap()}; - pub static ref RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe{CStr::from_ptr(ffi::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS).to_str().unwrap()}; + 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 = unsafe { + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_CONNECT) + .to_str() + .unwrap() + }; + pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS) + .to_str() + .unwrap() + }; + pub static ref RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT) + .to_str() + .unwrap() + }; + pub static ref RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS) + .to_str() + .unwrap() + }; + pub static ref RTSP_AUTH_CHECK_URL: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_URL) + .to_str() + .unwrap() + }; + pub static ref RTSP_PERM_MEDIA_FACTORY_ACCESS: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS) + .to_str() + .unwrap() + }; + pub static ref RTSP_PERM_MEDIA_FACTORY_CONSTRUCT: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT) + .to_str() + .unwrap() + }; + pub static ref RTSP_TOKEN_MEDIA_FACTORY_ROLE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE) + .to_str() + .unwrap() + }; + pub static ref RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: &'static str = unsafe { + CStr::from_ptr(ffi::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS) + .to_str() + .unwrap() + }; } // Re-export all the traits in a prelude module, so that applications @@ -96,11 +139,11 @@ pub mod prelude { pub use auto::traits::*; - 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_token::GstRcRTSPTokenExt; + 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_token::GstRcRTSPTokenExt; } diff --git a/gstreamer-rtsp-server/src/r_t_s_p_client.rs b/gstreamer-rtsp-server/src/r_t_s_p_client.rs index d2b14403a..8a3b8ffd8 100644 --- a/gstreamer-rtsp-server/src/r_t_s_p_client.rs +++ b/gstreamer-rtsp-server/src/r_t_s_p_client.rs @@ -2,8 +2,8 @@ use RTSPClient; use ffi; use glib; use glib::object::IsA; -use glib::translate::*; use glib::source::SourceId; +use glib::translate::*; pub trait RTSPClientExtManual { fn attach<'a, P: Into>>(&self, context: P) -> SourceId; diff --git a/gstreamer-rtsp-server/src/r_t_s_p_media_factory.rs b/gstreamer-rtsp-server/src/r_t_s_p_media_factory.rs index ff09dd79a..115dce027 100644 --- a/gstreamer-rtsp-server/src/r_t_s_p_media_factory.rs +++ b/gstreamer-rtsp-server/src/r_t_s_p_media_factory.rs @@ -8,11 +8,11 @@ use RTSPMediaFactory; +#[cfg(any(feature = "v1_14", feature = "dox"))] +use ffi; use glib::IsA; #[cfg(any(feature = "v1_14", feature = "dox"))] use gst; -#[cfg(any(feature = "v1_14", feature = "dox"))] -use ffi; pub trait RTSPMediaFactoryExtManual { #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -23,7 +23,10 @@ impl> RTSPMediaFactoryExtManual for O { #[cfg(any(feature = "v1_14", feature = "dox"))] fn add_role_from_structure(&self, structure: &gst::StructureRef) { unsafe { - ffi::gst_rtsp_media_factory_add_role_from_structure(self.to_glib_none().0, structure.as_mut_ptr()); + ffi::gst_rtsp_media_factory_add_role_from_structure( + self.to_glib_none().0, + structure.as_mut_ptr(), + ); } } } diff --git a/gstreamer-rtsp-server/src/r_t_s_p_server.rs b/gstreamer-rtsp-server/src/r_t_s_p_server.rs index 340eefe46..ed0dcb989 100644 --- a/gstreamer-rtsp-server/src/r_t_s_p_server.rs +++ b/gstreamer-rtsp-server/src/r_t_s_p_server.rs @@ -2,8 +2,8 @@ use RTSPServer; use ffi; use glib; use glib::object::IsA; -use glib::translate::*; use glib::source::SourceId; +use glib::translate::*; pub trait RTSPServerExtManual { fn attach<'a, P: Into>>(&self, context: P) -> SourceId; diff --git a/gstreamer-rtsp-server/src/r_t_s_p_session_pool.rs b/gstreamer-rtsp-server/src/r_t_s_p_session_pool.rs index 806b0a7c9..ffdf2a223 100644 --- a/gstreamer-rtsp-server/src/r_t_s_p_session_pool.rs +++ b/gstreamer-rtsp-server/src/r_t_s_p_session_pool.rs @@ -1,13 +1,13 @@ -use std::cell::RefCell; -use std::mem::transmute; use RTSPSessionPool; use ffi; use glib; -use glib_ffi; use glib::object::IsA; -use glib::translate::*; use glib::source::{CallbackGuard, Continue, Priority}; +use glib::translate::*; +use glib_ffi; use glib_ffi::{gboolean, gpointer}; +use std::cell::RefCell; +use std::mem::transmute; unsafe extern "C" fn trampoline_watch( pool: *mut ffi::GstRTSPSessionPool, diff --git a/gstreamer-rtsp-server/src/r_t_s_p_token.rs b/gstreamer-rtsp-server/src/r_t_s_p_token.rs index dab31097a..0c73c975f 100644 --- a/gstreamer-rtsp-server/src/r_t_s_p_token.rs +++ b/gstreamer-rtsp-server/src/r_t_s_p_token.rs @@ -1,12 +1,12 @@ use ffi; -use gst_ffi; -use gst; use glib; use glib::StaticType; -use glib::value::ToSendValue; use glib::translate::*; +use glib::value::ToSendValue; +use gst; +use gst_ffi; -use gst::miniobject::{MiniObject, GstRc}; +use gst::miniobject::{GstRc, MiniObject}; pub trait GstRcRTSPTokenExt { fn new_empty() -> Self; @@ -44,19 +44,23 @@ impl GstRcRTSPTokenExt for GstRc { impl RTSPTokenRef { pub fn get_string(&self, field: &str) -> Option { unsafe { - from_glib_none(ffi::gst_rtsp_token_get_string(self.as_mut_ptr(), field.to_glib_none().0)) + from_glib_none(ffi::gst_rtsp_token_get_string( + self.as_mut_ptr(), + field.to_glib_none().0, + )) } } pub fn get_structure(&self) -> Option { - unsafe { - from_glib_none(ffi::gst_rtsp_token_get_structure(self.as_mut_ptr())) - } + unsafe { from_glib_none(ffi::gst_rtsp_token_get_structure(self.as_mut_ptr())) } } pub fn is_allowed(&self, field: &str) -> bool { unsafe { - from_glib(ffi::gst_rtsp_token_is_allowed(self.as_mut_ptr(), field.to_glib_none().0)) + from_glib(ffi::gst_rtsp_token_is_allowed( + self.as_mut_ptr(), + field.to_glib_none().0, + )) } } @@ -76,7 +80,9 @@ impl ToOwned for RTSPTokenRef { type Owned = GstRc; fn to_owned(&self) -> GstRc { - unsafe { from_glib_full(gst_ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) } + unsafe { + from_glib_full(gst_ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) + } } } diff --git a/gstreamer-rtsp/src/lib.rs b/gstreamer-rtsp/src/lib.rs index 10834e75c..85b593c9c 100644 --- a/gstreamer-rtsp/src/lib.rs +++ b/gstreamer-rtsp/src/lib.rs @@ -21,16 +21,15 @@ extern crate gstreamer_sdp_sys as gst_sdp_ffi; extern crate gstreamer_sys as gst_ffi; 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}; diff --git a/gstreamer-sdp/src/lib.rs b/gstreamer-sdp/src/lib.rs index 3242a0af3..e2bce2a8b 100644 --- a/gstreamer-sdp/src/lib.rs +++ b/gstreamer-sdp/src/lib.rs @@ -17,8 +17,7 @@ extern crate gstreamer_sdp_sys as ffi; extern crate gstreamer_sys as gst_ffi; macro_rules! skip_assert_initialized { - () => ( - ) + () => {}; } pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value}; diff --git a/gstreamer-video/src/functions.rs b/gstreamer-video/src/functions.rs index 6d9fcd1e3..a08bdd42c 100644 --- a/gstreamer-video/src/functions.rs +++ b/gstreamer-video/src/functions.rs @@ -7,15 +7,15 @@ // except according to those terms. use ffi; -use gst_ffi; use glib_ffi; +use gst_ffi; -use gst; use glib; use glib::translate::{from_glib_full, ToGlib, ToGlibPtr}; +use gst; -use std::ptr; use std::mem; +use std::ptr; pub fn convert_sample( sample: &gst::Sample, @@ -89,8 +89,8 @@ pub fn convert_sample_async( #[cfg(test)] mod tests { use super::*; - use gst; use glib; + use gst; use std::sync::{Arc, Mutex}; #[test] diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index 9234dc1c1..09320ed70 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -21,22 +21,21 @@ extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_video_sys as ffi; 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 { - () => ( - ) + () => {}; } macro_rules! callback_guard { - () => ( + () => { let _guard = ::glib::CallbackGuard::new(); - ) + }; } pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value}; diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index 72b7c9d5d..81d280124 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -9,10 +9,10 @@ use ffi; use gst_ffi; +use glib::ToSendValue; +use glib::translate::{from_glib, from_glib_full, ToGlib}; use gst; use gst::MiniObject; -use glib::translate::{from_glib, from_glib_full, ToGlib}; -use glib::ToSendValue; use std::mem; pub fn is_force_key_unit_event(event: &gst::EventRef) -> bool { @@ -138,15 +138,15 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> { } } - event_builder_generic_impl!(|s: &mut Self| { - ffi::gst_video_event_new_downstream_force_key_unit( + event_builder_generic_impl!( + |s: &mut Self| ffi::gst_video_event_new_downstream_force_key_unit( s.timestamp.to_glib(), s.stream_time.to_glib(), s.running_time.to_glib(), s.all_headers.to_glib(), s.count, ) - }); + ); } #[derive(Clone, PartialEq, Eq, Debug)] diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index d3eccdcc2..1ce695051 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -9,16 +9,16 @@ use ffi; use gst_ffi; -use gst; -use gst::miniobject::MiniObject; use glib; use glib::translate::{from_glib, ToGlibPtr}; +use gst; +use gst::miniobject::MiniObject; -use std::mem; -use std::ptr; use std::marker::PhantomData; -use std::slice; +use std::mem; use std::ops; +use std::ptr; +use std::slice; pub struct Readable; pub struct Writable; diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 7aaa48c5c..d69694992 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -10,16 +10,16 @@ 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, FromGlib, FromGlibPtrNone, ToGlib, ToGlibPtr, ToGlibPtrMut}; +use gst; +use gst::prelude::*; +use std::fmt; use std::mem; use std::ptr; use std::str; -use std::fmt; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum VideoColorRange { diff --git a/gstreamer-video/src/video_overlay.rs b/gstreamer-video/src/video_overlay.rs index fb1035a69..6ec4181c9 100644 --- a/gstreamer-video/src/video_overlay.rs +++ b/gstreamer-video/src/video_overlay.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; use VideoOverlay; +use ffi; use libc::uintptr_t; use glib::IsA; diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index 895fdd2c7..998012aff 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -6,23 +6,23 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ptr; -use std::mem; use std::fmt; -use std::slice; +use std::marker::PhantomData; +use std::mem; use std::ops; +use std::ptr; +use std::slice; use std::u64; use std::usize; -use std::marker::PhantomData; -use miniobject::*; use BufferFlags; use ClockTime; +use miniobject::*; -use glib; -use glib_ffi; use ffi; +use glib; use glib::translate::{from_glib, from_glib_full, ToGlib}; +use glib_ffi; pub struct Readable; pub struct Writable; @@ -573,8 +573,10 @@ impl Eq for MappedBuffer {} unsafe impl Send for MappedBuffer {} lazy_static! { - pub static ref BUFFER_COPY_METADATA: ::BufferCopyFlags = ::BufferCopyFlags::FLAGS | ::BufferCopyFlags::TIMESTAMPS | ::BufferCopyFlags::META; - pub static ref BUFFER_COPY_ALL: ::BufferCopyFlags = *BUFFER_COPY_METADATA | ::BufferCopyFlags::MEMORY; + pub static ref BUFFER_COPY_METADATA: ::BufferCopyFlags = + ::BufferCopyFlags::FLAGS | ::BufferCopyFlags::TIMESTAMPS | ::BufferCopyFlags::META; + pub static ref BUFFER_COPY_ALL: ::BufferCopyFlags = + *BUFFER_COPY_METADATA | ::BufferCopyFlags::MEMORY; } #[cfg(test)] diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 6d4661fc3..81c402ec9 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -16,8 +16,8 @@ use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibP use ffi; use std::mem; -use std::ptr; use std::ops; +use std::ptr; #[derive(Debug, PartialEq, Eq)] pub struct BufferPoolConfig(Structure); diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index e92e34de0..6d8f1649e 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -12,9 +12,9 @@ use glib::StaticType; use glib::translate::{from_glib, from_glib_full}; use std::fmt; -use miniobject::*; use Buffer; use BufferRef; +use miniobject::*; pub type BufferList = GstRc; pub struct BufferListRef(ffi::GstBufferList); diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 1a3848fb4..66e2c5bc7 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -6,14 +6,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cell::RefCell; -use std::mem::transmute; use ffi; use glib; -use glib::translate::*; use glib::source::{CallbackGuard, Continue, Priority, SourceId}; +use glib::translate::*; use glib_ffi; use glib_ffi::{gboolean, gpointer}; +use std::cell::RefCell; +use std::mem::transmute; use std::ptr; use Bus; @@ -142,12 +142,12 @@ impl Bus { #[cfg(any(feature = "futures", feature = "dox"))] mod futures { - use std::sync::{Arc, Mutex}; - use futures; - use futures::{Async, Poll}; - use futures::task::Task; - use futures::stream::Stream; use super::*; + use futures; + use futures::stream::Stream; + use futures::task::Task; + use futures::{Async, Poll}; + use std::sync::{Arc, Mutex}; pub struct BusStream(Bus, Arc>>); diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index e04da52ca..4f88770c2 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use miniobject::*; use std::fmt; use std::str; -use miniobject::*; use structure::*; use CapsIntersectMode; -use glib; use ffi; +use glib; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; use glib::value::ToSendValue; @@ -392,8 +392,8 @@ impl Builder { #[cfg(test)] mod tests { use super::*; - use Fraction; use Array; + use Fraction; #[test] fn test_simple() { diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index a45e233bb..c643f2e94 100644 --- a/gstreamer/src/child_proxy.rs +++ b/gstreamer/src/child_proxy.rs @@ -6,12 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use ChildProxy; use ffi; use glib; use glib::object::IsA; use glib::translate::*; use std::ptr; -use ChildProxy; pub trait ChildProxyExtManual { fn get_child_property(&self, name: &str) -> Option; diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 3510c660c..9daa7a3d1 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -7,21 +7,21 @@ // except according to those terms. use Clock; +use ClockReturn; use ClockTime; use ClockTimeDiff; -use ClockReturn; -use std::mem; -use std::cmp; -use std::ptr; -use std::mem::transmute; use ffi; use glib; use glib::IsA; -use glib::translate::*; use glib::source::CallbackGuard; +use glib::translate::*; use glib_ffi; use glib_ffi::{gboolean, gpointer}; use libc::c_void; +use std::cmp; +use std::mem; +use std::mem::transmute; +use std::ptr; glib_wrapper! { pub struct ClockId(Shared); @@ -241,8 +241,8 @@ impl + IsA> ClockExtManual for O { #[cfg(test)] mod tests { - use super::*; use super::super::*; + use super::*; use std::sync::mpsc::channel; #[test] diff --git a/gstreamer/src/context.rs b/gstreamer/src/context.rs index cc4501365..444763696 100644 --- a/gstreamer/src/context.rs +++ b/gstreamer/src/context.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt; use std::ffi::CStr; +use std::fmt; use ffi; @@ -15,8 +15,8 @@ use glib; use glib::StaticType; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr}; -use miniobject::*; use StructureRef; +use miniobject::*; pub type Context = GstRc; pub struct ContextRef(ffi::GstContext); diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index c4f5d8c6c..11973c2a4 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -8,22 +8,22 @@ use Element; -use glib; -use glib::IsA; -use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, - FromGlibPtrContainer, ToGlib, ToGlibPtr}; -#[cfg(any(feature = "v1_10", feature = "dox"))] -use glib::translate::FromGlibPtrBorrow; -#[cfg(any(feature = "v1_10", feature = "dox"))] -use glib::object::Downcast; -use QueryRef; use Event; +use Format; +use FormattedValue; +use GenericFormattedValue; use Pad; use PadTemplate; -use Format; -use GenericFormattedValue; -use FormattedValue; +use QueryRef; use SpecificFormattedValue; +use glib; +use glib::IsA; +#[cfg(any(feature = "v1_10", feature = "dox"))] +use glib::object::Downcast; +#[cfg(any(feature = "v1_10", feature = "dox"))] +use glib::translate::FromGlibPtrBorrow; +use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrContainer, + ToGlib, ToGlibPtr}; use miniobject::MiniObject; use std::ffi::CStr; @@ -611,13 +611,37 @@ impl> ElementExtManual for O { } } -lazy_static!{ - pub static ref ELEMENT_METADATA_AUTHOR: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_AUTHOR).to_str().unwrap() }; - pub static ref ELEMENT_METADATA_DESCRIPTION: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DESCRIPTION).to_str().unwrap() }; - pub static ref ELEMENT_METADATA_DOC_URI: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DOC_URI).to_str().unwrap() }; - pub static ref ELEMENT_METADATA_ICON_NAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_ICON_NAME).to_str().unwrap() }; - pub static ref ELEMENT_METADATA_KLASS: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_KLASS).to_str().unwrap() }; - pub static ref ELEMENT_METADATA_LONGNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_ELEMENT_METADATA_LONGNAME).to_str().unwrap() }; +lazy_static! { + pub static ref ELEMENT_METADATA_AUTHOR: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_AUTHOR) + .to_str() + .unwrap() + }; + pub static ref ELEMENT_METADATA_DESCRIPTION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DESCRIPTION) + .to_str() + .unwrap() + }; + pub static ref ELEMENT_METADATA_DOC_URI: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_DOC_URI) + .to_str() + .unwrap() + }; + pub static ref ELEMENT_METADATA_ICON_NAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_ICON_NAME) + .to_str() + .unwrap() + }; + pub static ref ELEMENT_METADATA_KLASS: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_KLASS) + .to_str() + .unwrap() + }; + pub static ref ELEMENT_METADATA_LONGNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_ELEMENT_METADATA_LONGNAME) + .to_str() + .unwrap() + }; } #[macro_export] diff --git a/gstreamer/src/enums.rs b/gstreamer/src/enums.rs index 4ab4b35d7..dd6275f4d 100644 --- a/gstreamer/src/enums.rs +++ b/gstreamer/src/enums.rs @@ -6,13 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use StateChangeReturn; +use ClockReturn; use FlowReturn; use PadLinkReturn; -use ClockReturn; +use StateChangeReturn; +use std::cmp; use std::error::Error; use std::fmt; -use std::cmp; use glib::translate::ToGlib; diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index ddaf66090..f711446d4 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -6,21 +6,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use GenericFormattedValue; use ffi; use miniobject::*; use structure::*; -use GenericFormattedValue; -use std::ptr; -use std::mem; use std::cmp; -use std::fmt; use std::ffi::CStr; +use std::fmt; +use std::mem; use std::ops::Deref; +use std::ptr; use glib; -use glib::value::ToSendValue; use glib::translate::{from_glib, from_glib_full, FromGlib, ToGlib, ToGlibPtr}; +use glib::value::ToSendValue; #[cfg(any(feature = "v1_10", feature = "dox"))] use glib::translate::FromGlibPtrContainer; diff --git a/gstreamer/src/format.rs b/gstreamer/src/format.rs index 3ff18fcc2..e8f81b866 100644 --- a/gstreamer/src/format.rs +++ b/gstreamer/src/format.rs @@ -8,8 +8,8 @@ use ClockTime; use Format; -use std::ops; use muldiv::MulDiv; +use std::ops; #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] pub enum GenericFormattedValue { diff --git a/gstreamer/src/functions.rs b/gstreamer/src/functions.rs index f07a0ea4f..477a8c29c 100644 --- a/gstreamer/src/functions.rs +++ b/gstreamer/src/functions.rs @@ -10,10 +10,10 @@ use ffi; use glib::translate::*; use std::ptr; -use ParseContext; -use ParseFlags; use Element; use Error; +use ParseContext; +use ParseFlags; pub fn parse_bin_from_description_full<'a, P: Into>>( bin_description: &str, diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index a2f2fb635..55fe887d0 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -6,11 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Pad; -use PadTemplate; -use Object; -use PadMode; use GhostPad; +use Object; +use Pad; +use PadMode; +use PadTemplate; use ffi; use glib::object::Downcast; use glib::object::IsA; diff --git a/gstreamer/src/iterator.rs b/gstreamer/src/iterator.rs index c55feb26f..a529cb0e8 100644 --- a/gstreamer/src/iterator.rs +++ b/gstreamer/src/iterator.rs @@ -7,22 +7,22 @@ // except according to those terms. use ffi; +use glib; +use glib::StaticType; +use glib::Value; use glib::translate::*; +use glib::value::{FromValueOptional, ToValue}; use glib_ffi; use glib_ffi::{gconstpointer, gpointer}; use gobject_ffi; +use std::error::Error; +use std::ffi::CString; +use std::fmt; +use std::iter::Iterator as StdIterator; +use std::marker::PhantomData; use std::mem; use std::ptr; -use glib; -use glib::Value; -use glib::StaticType; -use glib::value::{FromValueOptional, ToValue}; use std::sync::Arc; -use std::ffi::CString; -use std::marker::PhantomData; -use std::iter::Iterator as StdIterator; -use std::fmt; -use std::error::Error; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum IteratorError { diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 80bbb9850..e09ed5afe 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -33,22 +33,21 @@ extern crate muldiv; use glib::translate::{from_glib, from_glib_full}; macro_rules! callback_guard { - () => ( + () => { let _guard = ::glib::CallbackGuard::new(); - ) + }; } macro_rules! assert_initialized_main_thread { - () => ( - if unsafe {::ffi::gst_is_initialized()} != ::glib_ffi::GTRUE { + () => { + if unsafe { ::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}; @@ -59,8 +58,8 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue #[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] #[cfg_attr(feature = "cargo-clippy", allow(type_complexity))] mod auto; -pub use auto::*; pub use auto::functions::*; +pub use auto::*; #[macro_use] mod log; @@ -102,9 +101,9 @@ mod promise; #[cfg(any(feature = "v1_14", feature = "dox"))] pub use promise::*; -mod element; mod bin; mod bus; +mod element; // OS dependent Bus extensions (also import the other plateform mod for doc) #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -120,24 +119,24 @@ cfg_if! { } } -mod pad; -mod object; -mod gobject; -mod proxy_pad; -mod ghost_pad; mod child_proxy; -mod tag_setter; -mod iterator; -mod device_provider; -mod parse_context; -mod enums; mod clock_time; mod date_time; -pub use object::GstObjectExtManual; -pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId}; +mod device_provider; +mod enums; +mod ghost_pad; +mod gobject; +mod iterator; +mod object; +mod pad; +mod parse_context; +mod proxy_pad; +mod tag_setter; +pub use bin::BinExtManual; 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 element::{ElementExtManual, ElementMessageType, NotifyWatchId}; +pub use object::GstObjectExtManual; // OS dependent Bus extensions (also import the other plateform trait for doc) #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -153,18 +152,18 @@ cfg_if! { } } -pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo}; -pub use gobject::GObjectExtManualGst; -pub use child_proxy::ChildProxyExtManual; -pub use tag_setter::TagSetterExtManual; pub use self::iterator::{Iterator, IteratorError, IteratorImpl}; -pub use device_provider::DeviceProviderExtManual; -pub use parse_context::ParseContext; #[cfg(any(feature = "futures", feature = "dox"))] pub use bus::BusStream; +pub use child_proxy::ChildProxyExtManual; +pub use clock_time::ClockTime; +pub use device_provider::DeviceProviderExtManual; pub use enums::{ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess, StateChangeError, StateChangeSuccess}; -pub use clock_time::ClockTime; +pub use gobject::GObjectExtManualGst; +pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo}; +pub use parse_context::ParseContext; +pub use tag_setter::TagSetterExtManual; mod plugin; #[cfg(any(feature = "v1_10", feature = "dox"))] @@ -236,8 +235,8 @@ pub mod prelude { pub use auto::traits::*; - pub use element::ElementExtManual; pub use bin::BinExtManual; + pub use element::ElementExtManual; // OS dependent Bus extensions (also import the other plateform trait for doc) #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -253,18 +252,18 @@ pub mod prelude { } } - pub use pad::PadExtManual; - pub use object::GstObjectExtManual; - pub use gobject::GObjectExtManualGst; - pub use child_proxy::ChildProxyExtManual; - pub use tag_setter::TagSetterExtManual; - pub use device_provider::DeviceProviderExtManual; - pub use clock::ClockExtManual; - pub use value::GstValueExt; pub use buffer_pool::BufferPoolExtManual; + pub use child_proxy::ChildProxyExtManual; + pub use clock::ClockExtManual; + pub use device_provider::DeviceProviderExtManual; + pub use gobject::GObjectExtManualGst; + pub use object::GstObjectExtManual; + pub use pad::PadExtManual; + pub use tag_setter::TagSetterExtManual; + pub use value::GstValueExt; - pub use tags::Tag; pub use miniobject::MiniObject; + pub use tags::Tag; pub use muldiv::MulDiv; diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index 13e2b3da5..e34713f34 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -9,11 +9,11 @@ use libc::c_char; use std::ffi::CStr; use std::fmt; -use std::ptr; use std::mem; +use std::ptr; -use gobject_ffi; use ffi; +use gobject_ffi; use glib::IsA; use glib::translate::{from_glib, ToGlib, ToGlibPtr}; diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 4f72328f2..4c0c74ed2 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -6,27 +6,27 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; +use GenericFormattedValue; +use GroupId; +use GstObjectExt; use Object; +use Seqnum; +use TagList; +use ffi; use miniobject::*; use structure::*; -use TagList; -use GstObjectExt; -use Seqnum; -use GroupId; -use GenericFormattedValue; -use std::ptr; -use std::mem; -use std::fmt; use std::ffi::CStr; +use std::fmt; +use std::mem; use std::ops::Deref; +use std::ptr; use glib; use glib::Cast; use glib::IsA; -use glib::value::ToSendValue; use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlib, ToGlibPtr}; +use glib::value::ToSendValue; #[repr(C)] pub struct MessageRef(ffi::GstMessage); @@ -1193,10 +1193,12 @@ impl<'a> MessageBuilder<'a> { #[cfg(any(feature = "v1_14", feature = "dox"))] fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self { Self { - other_fields: self.other_fields.iter().cloned() + other_fields: self.other_fields + .iter() + .cloned() .chain(other_fields.iter().cloned()) .collect(), - .. self + ..self } } } diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 5f933547e..c816feb8c 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -6,20 +6,20 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::{borrow, fmt, ops}; +use std::marker::PhantomData; use std::mem; use std::ptr; -use std::marker::PhantomData; +use std::{borrow, fmt, ops}; use ffi; -use glib_ffi::gpointer; -use glib_ffi; -use gobject_ffi; +use glib; use glib::translate::{c_ptr_array_len, from_glib, from_glib_full, from_glib_none, FromGlibContainerAsVec, FromGlibPtrArrayContainerAsVec, FromGlibPtrBorrow, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut, ToGlibContainerFromSlice, ToGlibPtr, ToGlibPtrMut}; -use glib; +use glib_ffi; +use glib_ffi::gpointer; +use gobject_ffi; pub struct GstRc { obj: ptr::NonNull, @@ -422,9 +422,8 @@ impl FromGlibContainerAsVec<*mut T::GstType, *const *mu } } -impl< - T: MiniObject + 'static, -> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc +impl + 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/object.rs b/gstreamer/src/object.rs index bb7dfc105..8548e1e09 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -8,9 +8,9 @@ use glib; use glib::IsA; -use glib::translate::ToGlibPtr; -use glib::signal::SignalHandlerId; use glib::object::{Downcast, ObjectExt}; +use glib::signal::SignalHandlerId; +use glib::translate::ToGlibPtr; use gobject_ffi; diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 74b7428a5..73be6fc5f 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -6,35 +6,35 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use Pad; -use PadProbeType; -use PadProbeReturn; use Buffer; use BufferList; -use Format; -use GenericFormattedValue; -use FormattedValue; -use SpecificFormattedValue; +use Event; use FlowReturn; +use Format; +use FormattedValue; +use GenericFormattedValue; +use Pad; +use PadProbeReturn; +use PadProbeType; use Query; use QueryRef; -use Event; +use SpecificFormattedValue; use StaticPadTemplate; use miniobject::MiniObject; +use std::cell::RefCell; +use std::mem; use std::mem::transmute; use std::ptr; -use std::mem; -use std::cell::RefCell; use glib; -use glib::{IsA, StaticType}; +use glib::Object; +use glib::source::CallbackGuard; use glib::translate::{from_glib, from_glib_borrow, from_glib_full, from_glib_none, mut_override, FromGlib, ToGlib, ToGlibPtr}; -use glib::source::CallbackGuard; +use glib::{IsA, StaticType}; use glib_ffi; use glib_ffi::gpointer; -use glib::Object; use libc; @@ -1164,8 +1164,8 @@ fn into_raw_pad_task(func: F) -> gpointer { mod tests { use super::*; use prelude::*; - use std::sync::{Arc, Mutex}; use std::sync::mpsc::channel; + use std::sync::{Arc, Mutex}; #[test] fn test_event_chain_functions() { diff --git a/gstreamer/src/pad_template.rs b/gstreamer/src/pad_template.rs index 2fdccdefb..f3e04fc9b 100644 --- a/gstreamer/src/pad_template.rs +++ b/gstreamer/src/pad_template.rs @@ -19,10 +19,18 @@ use glib; impl PadTemplate { #[cfg(any(feature = "v1_14", feature = "dox"))] - pub fn new_from_static_pad_template_with_gtype(pad_template: &StaticPadTemplate, pad_type: glib::types::Type) -> PadTemplate { + pub fn new_from_static_pad_template_with_gtype( + pad_template: &StaticPadTemplate, + pad_type: glib::types::Type, + ) -> PadTemplate { assert_initialized_main_thread!(); unsafe { - from_glib_none(ffi::gst_pad_template_new_from_static_pad_template_with_gtype(mut_override(pad_template.to_glib_none().0), pad_type.to_glib())) + from_glib_none( + ffi::gst_pad_template_new_from_static_pad_template_with_gtype( + mut_override(pad_template.to_glib_none().0), + pad_type.to_glib(), + ), + ) } } } diff --git a/gstreamer/src/parse_context.rs b/gstreamer/src/parse_context.rs index f1f908934..7a4b7ccf4 100644 --- a/gstreamer/src/parse_context.rs +++ b/gstreamer/src/parse_context.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use glib::translate::*; use ffi; +use glib::translate::*; use glib_ffi; use gobject_ffi; diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index 5bd03f6d1..62c115dee 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -6,15 +6,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use StructureRef; +use PromiseResult; use Structure; +use StructureRef; use ffi; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::mem; use std::ptr; -use PromiseResult; glib_wrapper! { pub struct Promise(Shared); @@ -30,14 +30,14 @@ impl Promise { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn new() -> Promise { assert_initialized_main_thread!(); - unsafe { - from_glib_full(ffi::gst_promise_new()) - } + unsafe { from_glib_full(ffi::gst_promise_new()) } } #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn new_with_change_func(func: F) -> Promise - where F: FnOnce(&Promise) + Send + 'static { + where + F: FnOnce(&Promise) + Send + 'static, + { let user_data: Box>> = Box::new(Some(Box::new(func))); unsafe extern "C" fn trampoline( @@ -103,9 +103,7 @@ impl Promise { #[cfg(any(feature = "v1_14", feature = "dox"))] pub fn wait(&self) -> PromiseResult { - unsafe { - from_glib(ffi::gst_promise_wait(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::gst_promise_wait(self.to_glib_none().0)) } } } diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index 52a1a9bfa..ba5a91b98 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -6,13 +6,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ptr; -use Pad; -use ProxyPad; -use Object; -use FlowReturn; use Buffer; use BufferList; +use FlowReturn; +use Object; +use Pad; +use ProxyPad; +use std::ptr; use glib::IsA; use glib::translate::{from_glib, from_glib_full, ToGlibPtr}; diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index 65b43905a..26263997e 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -6,16 +6,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use GenericFormattedValue; use ffi; use miniobject::*; use structure::*; -use GenericFormattedValue; -use std::ptr; -use std::mem; -use std::fmt; use std::ffi::CStr; +use std::fmt; +use std::mem; use std::ops::{Deref, DerefMut}; +use std::ptr; use glib; use glib::translate::*; diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index 5d33f3372..634f9fde8 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::ptr; use std::fmt; +use std::ptr; use ffi; @@ -15,14 +15,14 @@ use glib; use glib::StaticType; use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlibPtr}; -use miniobject::*; use Buffer; use BufferList; use Caps; +use FormattedSegment; use FormattedValue; use Segment; -use FormattedSegment; use StructureRef; +use miniobject::*; pub type Sample = GstRc; pub struct SampleRef(ffi::GstSample); diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 66c102121..c26897ab1 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -7,19 +7,19 @@ // except according to those terms. use Format; -use GenericFormattedValue; use FormattedValue; +use GenericFormattedValue; use SeekFlags; use SeekType; use ffi; +use glib; use glib::translate::*; use glib_ffi; use gobject_ffi; -use glib; -use std::mem; -use std::ptr; use std::fmt; use std::marker::PhantomData; +use std::mem; +use std::ptr; pub type Segment = FormattedSegment; #[repr(C)] diff --git a/gstreamer/src/static_pad_template.rs b/gstreamer/src/static_pad_template.rs index f439e0dfc..486e6ef57 100644 --- a/gstreamer/src/static_pad_template.rs +++ b/gstreamer/src/static_pad_template.rs @@ -6,16 +6,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use PadTemplate; use Caps; +use PadTemplate; use ffi; use glib_ffi; use gobject_ffi; -use std::ffi::CStr; use glib; use glib::translate::{from_glib, from_glib_full, FromGlibPtrNone, ToGlibPtr, ToGlibPtrMut}; +use std::ffi::CStr; use std::ptr; diff --git a/gstreamer/src/stream_collection.rs b/gstreamer/src/stream_collection.rs index 584bdda95..6c0d3c6e3 100644 --- a/gstreamer/src/stream_collection.rs +++ b/gstreamer/src/stream_collection.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use StreamCollection; use Stream; +use StreamCollection; pub struct Iter<'a> { collection: &'a StreamCollection, diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 1cc85c7e2..0050a7eef 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -6,22 +6,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt; -use std::ptr; -use std::mem; -use std::str; -use std::ffi::CStr; -use std::ops::{Deref, DerefMut}; use std::borrow::{Borrow, BorrowMut, ToOwned}; +use std::ffi::CStr; +use std::fmt; use std::marker::PhantomData; +use std::mem; +use std::ops::{Deref, DerefMut}; +use std::ptr; +use std::str; use Fraction; +use ffi; use glib; use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut, ToGlib, ToGlibPtr, ToGlibPtrMut}; use glib::value::{FromValueOptional, SendValue, ToSendValue}; -use ffi; use glib_ffi::gpointer; use gobject_ffi; diff --git a/gstreamer/src/tag_setter.rs b/gstreamer/src/tag_setter.rs index 8eaeeed6c..93ef95801 100644 --- a/gstreamer/src/tag_setter.rs +++ b/gstreamer/src/tag_setter.rs @@ -6,9 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use TagSetter; use TagMergeMode; +use TagSetter; +use ffi; use glib::object::IsA; use glib::translate::*; use glib::value::ToSendValue; diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index d6c61aab0..b9a1c6c0f 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -6,21 +6,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::fmt; -use std::mem; -use std::marker::PhantomData; use std::ffi::CStr; +use std::fmt; +use std::marker::PhantomData; +use std::mem; use ffi; use glib; use glib::StaticType; -use glib::value::{FromValueOptional, SetValue, ToSendValue, TypedValue, Value}; use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr, ToGlibPtrMut}; +use glib::value::{FromValueOptional, SetValue, ToSendValue, TypedValue, Value}; use miniobject::*; -use TagMergeMode; use Sample; +use TagMergeMode; pub trait Tag<'a> { type TagType: FromValueOptional<'a> + SetValue + Send; @@ -146,92 +146,280 @@ impl_tag!(InterpretedBy, &'a str, *TAG_INTERPRETED_BY); impl_tag!(MidiBaseNote, &'a str, *TAG_MIDI_BASE_NOTE); impl_tag!(PrivateData, Sample, *TAG_PRIVATE_DATA); -lazy_static!{ - static ref TAG_TITLE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TITLE).to_str().unwrap() }; - static ref TAG_TITLE_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TITLE_SORTNAME).to_str().unwrap() }; - static ref TAG_ARTIST: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ARTIST).to_str().unwrap() }; - static ref TAG_ARTIST_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ARTIST_SORTNAME).to_str().unwrap() }; - static ref TAG_ALBUM: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM).to_str().unwrap() }; - static ref TAG_ALBUM_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_SORTNAME).to_str().unwrap() }; - static ref TAG_ALBUM_ARTIST: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_ARTIST).to_str().unwrap() }; - static ref TAG_ALBUM_ARTIST_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_ARTIST_SORTNAME).to_str().unwrap() }; +lazy_static! { + static ref TAG_TITLE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_TITLE).to_str().unwrap() }; + static ref TAG_TITLE_SORTNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_TITLE_SORTNAME) + .to_str() + .unwrap() + }; + static ref TAG_ARTIST: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ARTIST).to_str().unwrap() }; + static ref TAG_ARTIST_SORTNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ARTIST_SORTNAME) + .to_str() + .unwrap() + }; + static ref TAG_ALBUM: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM).to_str().unwrap() }; + static ref TAG_ALBUM_SORTNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ALBUM_SORTNAME) + .to_str() + .unwrap() + }; + static ref TAG_ALBUM_ARTIST: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_ARTIST).to_str().unwrap() }; + static ref TAG_ALBUM_ARTIST_SORTNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ALBUM_ARTIST_SORTNAME) + .to_str() + .unwrap() + }; static ref TAG_DATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DATE).to_str().unwrap() }; - static ref TAG_DATE_TIME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DATE_TIME).to_str().unwrap() }; - static ref TAG_GENRE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GENRE).to_str().unwrap() }; - static ref TAG_COMMENT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_COMMENT).to_str().unwrap() }; - static ref TAG_EXTENDED_COMMENT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_EXTENDED_COMMENT).to_str().unwrap() }; - static ref TAG_TRACK_NUMBER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_NUMBER).to_str().unwrap() }; - static ref TAG_TRACK_COUNT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_COUNT).to_str().unwrap() }; - static ref TAG_ALBUM_VOLUME_NUMBER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_VOLUME_NUMBER).to_str().unwrap() }; - static ref TAG_ALBUM_VOLUME_COUNT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_VOLUME_COUNT).to_str().unwrap() }; - static ref TAG_LOCATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LOCATION).to_str().unwrap() }; - static ref TAG_HOMEPAGE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_HOMEPAGE).to_str().unwrap() }; - static ref TAG_DESCRIPTION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DESCRIPTION).to_str().unwrap() }; - static ref TAG_VERSION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_VERSION).to_str().unwrap() }; + static ref TAG_DATE_TIME: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_DATE_TIME).to_str().unwrap() }; + static ref TAG_GENRE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_GENRE).to_str().unwrap() }; + static ref TAG_COMMENT: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_COMMENT).to_str().unwrap() }; + static ref TAG_EXTENDED_COMMENT: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_EXTENDED_COMMENT) + .to_str() + .unwrap() + }; + static ref TAG_TRACK_NUMBER: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_NUMBER).to_str().unwrap() }; + static ref TAG_TRACK_COUNT: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_COUNT).to_str().unwrap() }; + static ref TAG_ALBUM_VOLUME_NUMBER: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ALBUM_VOLUME_NUMBER) + .to_str() + .unwrap() + }; + static ref TAG_ALBUM_VOLUME_COUNT: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ALBUM_VOLUME_COUNT) + .to_str() + .unwrap() + }; + static ref TAG_LOCATION: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LOCATION).to_str().unwrap() }; + static ref TAG_HOMEPAGE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_HOMEPAGE).to_str().unwrap() }; + static ref TAG_DESCRIPTION: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_DESCRIPTION).to_str().unwrap() }; + static ref TAG_VERSION: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_VERSION).to_str().unwrap() }; static ref TAG_ISRC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ISRC).to_str().unwrap() }; - static ref TAG_ORGANIZATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ORGANIZATION).to_str().unwrap() }; - static ref TAG_COPYRIGHT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_COPYRIGHT).to_str().unwrap() }; - static ref TAG_COPYRIGHT_URI: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_COPYRIGHT_URI).to_str().unwrap() }; - static ref TAG_ENCODED_BY: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODED_BY).to_str().unwrap() }; - static ref TAG_COMPOSER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_COMPOSER).to_str().unwrap() }; - static ref TAG_CONDUCTOR: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_CONDUCTOR).to_str().unwrap() }; - static ref TAG_CONTACT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_CONTACT).to_str().unwrap() }; - static ref TAG_LICENSE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LICENSE).to_str().unwrap() }; - static ref TAG_LICENSE_URI: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LICENSE_URI).to_str().unwrap() }; - static ref TAG_PERFORMER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_PERFORMER).to_str().unwrap() }; - static ref TAG_DURATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DURATION).to_str().unwrap() }; - static ref TAG_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_CODEC).to_str().unwrap() }; - static ref TAG_VIDEO_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_VIDEO_CODEC).to_str().unwrap() }; - static ref TAG_AUDIO_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_AUDIO_CODEC).to_str().unwrap() }; - static ref TAG_SUBTITLE_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SUBTITLE_CODEC).to_str().unwrap() }; - static ref TAG_CONTAINER_FORMAT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_CONTAINER_FORMAT).to_str().unwrap() }; - static ref TAG_BITRATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_BITRATE).to_str().unwrap() }; - static ref TAG_NOMINAL_BITRATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_NOMINAL_BITRATE).to_str().unwrap() }; - static ref TAG_MINIMUM_BITRATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_MINIMUM_BITRATE).to_str().unwrap() }; - static ref TAG_MAXIMUM_BITRATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_MAXIMUM_BITRATE).to_str().unwrap() }; - static ref TAG_SERIAL: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SERIAL).to_str().unwrap() }; - static ref TAG_ENCODER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODER).to_str().unwrap() }; - static ref TAG_ENCODER_VERSION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODER_VERSION).to_str().unwrap() }; - static ref TAG_TRACK_GAIN: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_GAIN).to_str().unwrap() }; - static ref TAG_TRACK_PEAK: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_PEAK).to_str().unwrap() }; - static ref TAG_ALBUM_GAIN: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_GAIN).to_str().unwrap() }; - static ref TAG_ALBUM_PEAK: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_PEAK).to_str().unwrap() }; - static ref TAG_REFERENCE_LEVEL: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_REFERENCE_LEVEL).to_str().unwrap() }; - static ref TAG_LANGUAGE_CODE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LANGUAGE_CODE).to_str().unwrap() }; - static ref TAG_LANGUAGE_NAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LANGUAGE_NAME).to_str().unwrap() }; - static ref TAG_IMAGE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_IMAGE).to_str().unwrap() }; - static ref TAG_PREVIEW_IMAGE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_PREVIEW_IMAGE).to_str().unwrap() }; - static ref TAG_ATTACHMENT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ATTACHMENT).to_str().unwrap() }; - static ref TAG_BEATS_PER_MINUTE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_BEATS_PER_MINUTE).to_str().unwrap() }; - static ref TAG_KEYWORDS: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_KEYWORDS).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_NAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_NAME).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_LATITUDE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_LATITUDE).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_LONGITUDE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_LONGITUDE).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_ELEVATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_ELEVATION).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_CITY: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_CITY).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_COUNTRY: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_COUNTRY).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_SUBLOCATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_SUBLOCATION).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_HORIZONTAL_ERROR: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_MOVEMENT_DIRECTION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_MOVEMENT_SPEED: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_MOVEMENT_SPEED).to_str().unwrap() }; - static ref TAG_GEO_LOCATION_CAPTURE_DIRECTION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION).to_str().unwrap() }; - static ref TAG_SHOW_NAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_NAME).to_str().unwrap() }; - static ref TAG_SHOW_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_SORTNAME).to_str().unwrap() }; - static ref TAG_SHOW_EPISODE_NUMBER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_EPISODE_NUMBER).to_str().unwrap() }; - static ref TAG_SHOW_SEASON_NUMBER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_SEASON_NUMBER).to_str().unwrap() }; - static ref TAG_LYRICS: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LYRICS).to_str().unwrap() }; - static ref TAG_COMPOSER_SORTNAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_COMPOSER_SORTNAME).to_str().unwrap() }; - static ref TAG_GROUPING: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_GROUPING).to_str().unwrap() }; - static ref TAG_USER_RATING: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_USER_RATING).to_str().unwrap() }; - static ref TAG_DEVICE_MANUFACTURER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DEVICE_MANUFACTURER).to_str().unwrap() }; - static ref TAG_DEVICE_MODEL: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DEVICE_MODEL).to_str().unwrap() }; - static ref TAG_APPLICATION_NAME: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_APPLICATION_NAME).to_str().unwrap() }; - static ref TAG_APPLICATION_DATA: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_APPLICATION_DATA).to_str().unwrap() }; - static ref TAG_IMAGE_ORIENTATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_IMAGE_ORIENTATION).to_str().unwrap() }; - static ref TAG_PUBLISHER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_PUBLISHER).to_str().unwrap() }; - static ref TAG_INTERPRETED_BY: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_INTERPRETED_BY).to_str().unwrap() }; - static ref TAG_MIDI_BASE_NOTE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_MIDI_BASE_NOTE).to_str().unwrap() }; - static ref TAG_PRIVATE_DATA: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_PRIVATE_DATA).to_str().unwrap() }; + static ref TAG_ORGANIZATION: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ORGANIZATION).to_str().unwrap() }; + static ref TAG_COPYRIGHT: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_COPYRIGHT).to_str().unwrap() }; + static ref TAG_COPYRIGHT_URI: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_COPYRIGHT_URI).to_str().unwrap() }; + static ref TAG_ENCODED_BY: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODED_BY).to_str().unwrap() }; + static ref TAG_COMPOSER: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_COMPOSER).to_str().unwrap() }; + static ref TAG_CONDUCTOR: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_CONDUCTOR).to_str().unwrap() }; + static ref TAG_CONTACT: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_CONTACT).to_str().unwrap() }; + static ref TAG_LICENSE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LICENSE).to_str().unwrap() }; + static ref TAG_LICENSE_URI: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LICENSE_URI).to_str().unwrap() }; + static ref TAG_PERFORMER: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_PERFORMER).to_str().unwrap() }; + static ref TAG_DURATION: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_DURATION).to_str().unwrap() }; + static ref TAG_CODEC: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_CODEC).to_str().unwrap() }; + static ref TAG_VIDEO_CODEC: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_VIDEO_CODEC).to_str().unwrap() }; + static ref TAG_AUDIO_CODEC: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_AUDIO_CODEC).to_str().unwrap() }; + static ref TAG_SUBTITLE_CODEC: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_SUBTITLE_CODEC) + .to_str() + .unwrap() + }; + static ref TAG_CONTAINER_FORMAT: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_CONTAINER_FORMAT) + .to_str() + .unwrap() + }; + static ref TAG_BITRATE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_BITRATE).to_str().unwrap() }; + static ref TAG_NOMINAL_BITRATE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_NOMINAL_BITRATE) + .to_str() + .unwrap() + }; + static ref TAG_MINIMUM_BITRATE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_MINIMUM_BITRATE) + .to_str() + .unwrap() + }; + static ref TAG_MAXIMUM_BITRATE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_MAXIMUM_BITRATE) + .to_str() + .unwrap() + }; + static ref TAG_SERIAL: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_SERIAL).to_str().unwrap() }; + static ref TAG_ENCODER: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODER).to_str().unwrap() }; + static ref TAG_ENCODER_VERSION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_ENCODER_VERSION) + .to_str() + .unwrap() + }; + static ref TAG_TRACK_GAIN: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_GAIN).to_str().unwrap() }; + static ref TAG_TRACK_PEAK: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_TRACK_PEAK).to_str().unwrap() }; + static ref TAG_ALBUM_GAIN: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_GAIN).to_str().unwrap() }; + static ref TAG_ALBUM_PEAK: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_PEAK).to_str().unwrap() }; + static ref TAG_REFERENCE_LEVEL: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_REFERENCE_LEVEL) + .to_str() + .unwrap() + }; + static ref TAG_LANGUAGE_CODE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LANGUAGE_CODE).to_str().unwrap() }; + static ref TAG_LANGUAGE_NAME: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LANGUAGE_NAME).to_str().unwrap() }; + static ref TAG_IMAGE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_IMAGE).to_str().unwrap() }; + static ref TAG_PREVIEW_IMAGE: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_PREVIEW_IMAGE).to_str().unwrap() }; + static ref TAG_ATTACHMENT: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_ATTACHMENT).to_str().unwrap() }; + static ref TAG_BEATS_PER_MINUTE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_BEATS_PER_MINUTE) + .to_str() + .unwrap() + }; + static ref TAG_KEYWORDS: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_KEYWORDS).to_str().unwrap() }; + static ref TAG_GEO_LOCATION_NAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_NAME) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_LATITUDE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_LATITUDE) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_LONGITUDE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_LONGITUDE) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_ELEVATION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_ELEVATION) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_CITY: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_CITY) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_COUNTRY: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_COUNTRY) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_SUBLOCATION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_SUBLOCATION) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_HORIZONTAL_ERROR: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_MOVEMENT_DIRECTION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_MOVEMENT_SPEED: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_MOVEMENT_SPEED) + .to_str() + .unwrap() + }; + static ref TAG_GEO_LOCATION_CAPTURE_DIRECTION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION) + .to_str() + .unwrap() + }; + static ref TAG_SHOW_NAME: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_NAME).to_str().unwrap() }; + static ref TAG_SHOW_SORTNAME: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_SHOW_SORTNAME).to_str().unwrap() }; + static ref TAG_SHOW_EPISODE_NUMBER: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_SHOW_EPISODE_NUMBER) + .to_str() + .unwrap() + }; + static ref TAG_SHOW_SEASON_NUMBER: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_SHOW_SEASON_NUMBER) + .to_str() + .unwrap() + }; + static ref TAG_LYRICS: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_LYRICS).to_str().unwrap() }; + static ref TAG_COMPOSER_SORTNAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_COMPOSER_SORTNAME) + .to_str() + .unwrap() + }; + static ref TAG_GROUPING: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_GROUPING).to_str().unwrap() }; + static ref TAG_USER_RATING: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_USER_RATING).to_str().unwrap() }; + static ref TAG_DEVICE_MANUFACTURER: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_DEVICE_MANUFACTURER) + .to_str() + .unwrap() + }; + static ref TAG_DEVICE_MODEL: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_DEVICE_MODEL).to_str().unwrap() }; + static ref TAG_APPLICATION_NAME: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_APPLICATION_NAME) + .to_str() + .unwrap() + }; + static ref TAG_APPLICATION_DATA: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_APPLICATION_DATA) + .to_str() + .unwrap() + }; + static ref TAG_IMAGE_ORIENTATION: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_IMAGE_ORIENTATION) + .to_str() + .unwrap() + }; + static ref TAG_PUBLISHER: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_PUBLISHER).to_str().unwrap() }; + static ref TAG_INTERPRETED_BY: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_INTERPRETED_BY) + .to_str() + .unwrap() + }; + static ref TAG_MIDI_BASE_NOTE: &'static str = unsafe { + CStr::from_ptr(ffi::GST_TAG_MIDI_BASE_NOTE) + .to_str() + .unwrap() + }; + static ref TAG_PRIVATE_DATA: &'static str = + unsafe { CStr::from_ptr(ffi::GST_TAG_PRIVATE_DATA).to_str().unwrap() }; } pub type TagList = GstRc; diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 65103daf0..930d26f82 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -16,12 +16,12 @@ use glib; use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib, ToGlibPtr}; -use miniobject::*; -use TocEntryType; -use TocScope; -use TocLoopType; use TagList; use TagMergeMode; +use TocEntryType; +use TocLoopType; +use TocScope; +use miniobject::*; pub type Toc = GstRc; pub struct TocRef(ffi::GstToc); diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 30bb853b3..aa330bd3d 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -6,18 +6,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ffi; -use Plugin; -use TypeFindProbability; -use TypeFindFactory; use Caps; +use Plugin; +use TypeFindFactory; +use TypeFindProbability; +use ffi; +use glib::translate::*; +use glib_ffi; +use std::marker::PhantomData; use std::mem; use std::ptr; use std::slice; -use std::marker::PhantomData; -use glib_ffi; -use glib::translate::*; #[repr(C)] pub struct TypeFind<'a>(ffi::GstTypeFind, PhantomData<&'a ()>); diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index bbd16422f..7c7d3218a 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -7,15 +7,15 @@ // except according to those terms. use num_rational::Rational32; +use std::borrow::{Borrow, Cow}; use std::fmt; use std::ops; -use std::borrow::{Borrow, Cow}; use std::slice; use glib; -use glib::value::{FromValue, FromValueOptional, SetValue, ToSendValue, Value}; use glib::translate::{from_glib, from_glib_full, FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut, Uninitialized}; +use glib::value::{FromValue, FromValueOptional, SetValue, ToSendValue, Value}; use ffi; use glib_ffi; diff --git a/tutorials/src/bin/basic-tutorial-4.rs b/tutorials/src/bin/basic-tutorial-4.rs index 0d96517c0..477304417 100644 --- a/tutorials/src/bin/basic-tutorial-4.rs +++ b/tutorials/src/bin/basic-tutorial-4.rs @@ -1,8 +1,8 @@ extern crate gstreamer as gst; +use gst::MessageView; +use gst::prelude::*; use std::io; use std::io::Write; -use gst::prelude::*; -use gst::MessageView; #[path = "../tutorials-common.rs"] mod tutorials_common; diff --git a/tutorials/src/bin/basic-tutorial-5.rs b/tutorials/src/bin/basic-tutorial-5.rs index 496507085..27e8cc1f7 100644 --- a/tutorials/src/bin/basic-tutorial-5.rs +++ b/tutorials/src/bin/basic-tutorial-5.rs @@ -1,7 +1,7 @@ #[cfg(feature = "tutorial5")] mod tutorial5 { - use std::process; use std::os::raw::c_void; + use std::process; extern crate glib; use self::glib::translate::*; diff --git a/tutorials/src/bin/basic-tutorial-6.rs b/tutorials/src/bin/basic-tutorial-6.rs index 271a5bab7..05703add9 100644 --- a/tutorials/src/bin/basic-tutorial-6.rs +++ b/tutorials/src/bin/basic-tutorial-6.rs @@ -1,6 +1,6 @@ extern crate gstreamer as gst; -use gst::prelude::*; use gst::MessageView; +use gst::prelude::*; #[path = "../tutorials-common.rs"] mod tutorials_common;