Run everything through latest rustfmt-nightly

This commit is contained in:
Sebastian Dröge 2017-10-17 12:06:51 +03:00
parent 9a6713b901
commit e1d134c4be
31 changed files with 184 additions and 150 deletions

View file

@ -11,10 +11,10 @@ extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer as gst;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_app_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_base as gst_base;
extern crate gstreamer_base_sys as gst_base_ffi;
extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;

View file

@ -264,8 +264,8 @@ impl glib::value::SetValue for AudioFormatInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -275,8 +275,8 @@ impl glib::value::SetValueOptional for AudioFormatInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstAudioFormatInfo>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -281,9 +281,8 @@ impl glib::types::StaticType for AudioInfo {
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for AudioInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<AudioInfo>::from_glib_none(
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo,
)
Option::<AudioInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
as *mut ffi::GstAudioInfo)
}
}
@ -292,8 +291,8 @@ impl glib::value::SetValue for AudioInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -303,8 +302,8 @@ impl glib::value::SetValueOptional for AudioInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstAudioInfo>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -32,9 +32,7 @@ glib_wrapper! {
impl FlowCombiner {
pub fn new() -> FlowCombiner {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_flow_combiner_new())
}
unsafe { from_glib_full(ffi::gst_flow_combiner_new()) }
}
pub fn add_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
@ -63,13 +61,24 @@ impl FlowCombiner {
pub fn update_flow(&self, fret: gst::FlowReturn) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_flow_combiner_update_flow(self.to_glib_none().0, fret.to_glib()))
from_glib(ffi::gst_flow_combiner_update_flow(
self.to_glib_none().0,
fret.to_glib(),
))
}
}
pub fn update_pad_flow<P: IsA<gst::Pad>>(&self, pad: &P, fret: gst::FlowReturn) -> gst::FlowReturn {
pub fn update_pad_flow<P: IsA<gst::Pad>>(
&self,
pad: &P,
fret: gst::FlowReturn,
) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_flow_combiner_update_pad_flow(self.to_glib_none().0, pad.to_glib_none().0, fret.to_glib()))
from_glib(ffi::gst_flow_combiner_update_pad_flow(
self.to_glib_none().0,
pad.to_glib_none().0,
fret.to_glib(),
))
}
}
}

View file

@ -20,8 +20,8 @@ impl PlayerGMainContextSignalDispatcher {
let application_context = application_context.to_glib_none();
unsafe {
from_glib_full(
ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0) as
*mut ffi::GstPlayerGMainContextSignalDispatcher,
ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0)
as *mut ffi::GstPlayerGMainContextSignalDispatcher,
)
}
}

View file

@ -60,8 +60,8 @@ impl<
O: IsA<PlayerVideoOverlayVideoRenderer> + IsA<glib::object::Object>,
> PlayerVideoOverlayVideoRendererExtManual for O {
unsafe fn get_window_handle(&self) -> uintptr_t {
ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0) as
uintptr_t
ffi::gst_player_video_overlay_video_renderer_get_window_handle(self.to_glib_none().0)
as uintptr_t
}
unsafe fn set_window_handle(&self, window_handle: uintptr_t) {

View file

@ -248,8 +248,8 @@ impl VideoFrame<Writable> {
info.to_glib_none().0 as *mut _,
buffer.to_glib_none().0,
mem::transmute(
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() |
gst_ffi::GST_MAP_WRITE.bits(),
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits()
| gst_ffi::GST_MAP_WRITE.bits(),
),
));
@ -277,8 +277,8 @@ impl VideoFrame<Writable> {
buffer.to_glib_none().0,
id,
mem::transmute(
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits() |
gst_ffi::GST_MAP_WRITE.bits(),
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF.bits() | gst_ffi::GST_MAP_READ.bits()
| gst_ffi::GST_MAP_WRITE.bits(),
),
));

View file

@ -596,9 +596,8 @@ impl glib::types::StaticType for VideoInfo {
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for VideoInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<VideoInfo>::from_glib_none(
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo,
)
Option::<VideoInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
as *mut ffi::GstVideoInfo)
}
}
@ -607,8 +606,8 @@ impl glib::value::SetValue for VideoInfo {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -618,8 +617,8 @@ impl glib::value::SetValueOptional for VideoInfo {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstVideoInfo>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -11,7 +11,7 @@ use Element;
use glib;
use glib::IsA;
use glib::translate::{from_glib, from_glib_full, ToGlibPtr, ToGlib};
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
use ffi;
@ -60,37 +60,30 @@ impl<O: IsA<Bin>> BinExtManual for O {
fn iterate_all_by_interface(&self, iface: glib::types::Type) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_all_by_interface(self.to_glib_none().0, iface.to_glib()))
from_glib_full(ffi::gst_bin_iterate_all_by_interface(
self.to_glib_none().0,
iface.to_glib(),
))
}
}
fn iterate_elements(&self) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_elements(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_bin_iterate_elements(self.to_glib_none().0)) }
}
fn iterate_recurse(&self) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_recurse(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_bin_iterate_recurse(self.to_glib_none().0)) }
}
fn iterate_sinks(&self) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_sinks(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_bin_iterate_sinks(self.to_glib_none().0)) }
}
fn iterate_sorted(&self) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_sorted(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_bin_iterate_sorted(self.to_glib_none().0)) }
}
fn iterate_sources(&self) -> ::Iterator<Element> {
unsafe {
from_glib_full(ffi::gst_bin_iterate_sources(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.to_glib_none().0)) }
}
}

View file

@ -334,8 +334,8 @@ impl ToOwned for BufferRef {
fn to_owned(&self) -> GstRc<BufferRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -88,8 +88,8 @@ impl ToOwned for BufferListRef {
fn to_owned(&self) -> GstRc<BufferListRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -357,8 +357,8 @@ impl ToOwned for CapsRef {
fn to_owned(&self) -> GstRc<CapsRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -81,8 +81,8 @@ impl ToOwned for ContextRef {
fn to_owned(&self) -> GstRc<ContextRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -23,8 +23,8 @@ pub trait DeviceProviderExtManual {
impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O {
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstDeviceProviderClass;
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class
as *mut ffi::GstDeviceProviderClass;
let ptr = ffi::gst_device_provider_class_get_metadata(klass, key.to_glib_none().0);

View file

@ -10,7 +10,7 @@ use Element;
use glib;
use glib::IsA;
use glib::translate::{from_glib, from_glib_none, from_glib_full, FromGlibPtrContainer, ToGlibPtr};
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlibPtr};
use QueryRef;
use Event;
use Pad;
@ -115,8 +115,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstElementClass;
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class
as *mut ffi::GstElementClass;
let ptr = ffi::gst_element_class_get_metadata(klass, key.to_glib_none().0);
@ -130,8 +130,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
fn get_pad_template(&self, name: &str) -> Option<PadTemplate> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstElementClass;
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class
as *mut ffi::GstElementClass;
from_glib_none(ffi::gst_element_class_get_pad_template(
klass,
@ -142,8 +142,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
fn get_pad_template_list(&self) -> Vec<PadTemplate> {
unsafe {
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class as
*mut ffi::GstElementClass;
let klass = (*(self.to_glib_none().0 as *mut gobject_ffi::GTypeInstance)).g_class
as *mut ffi::GstElementClass;
FromGlibPtrContainer::from_glib_none(
ffi::gst_element_class_get_pad_template_list(klass),
@ -217,21 +217,15 @@ impl<O: IsA<Element>> ElementExtManual for O {
}
fn iterate_pads(&self) -> ::Iterator<Pad> {
unsafe {
from_glib_full(ffi::gst_element_iterate_pads(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_element_iterate_pads(self.to_glib_none().0)) }
}
fn iterate_sink_pads(&self) -> ::Iterator<Pad> {
unsafe {
from_glib_full(ffi::gst_element_iterate_sink_pads(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_element_iterate_sink_pads(self.to_glib_none().0)) }
}
fn iterate_src_pads(&self) -> ::Iterator<Pad> {
unsafe {
from_glib_full(ffi::gst_element_iterate_src_pads(self.to_glib_none().0))
}
unsafe { from_glib_full(ffi::gst_element_iterate_src_pads(self.to_glib_none().0)) }
}
}

View file

@ -498,8 +498,8 @@ impl<T: 'static> glib::value::SetValue for Iterator<T> {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -509,8 +509,8 @@ impl<T: 'static> glib::value::SetValueOptional for Iterator<T> {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstIterator>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -2315,8 +2315,7 @@ pub struct RedirectBuilder<'a> {
tag_list: Option<&'a TagList>,
entry_struct: Option<Structure>,
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
entries:
Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
entries: Option<&'a [(&'a str, Option<&'a TagList>, Option<&'a Structure>)]>,
}
#[cfg(feature = "v1_10")]
impl<'a> RedirectBuilder<'a> {

View file

@ -67,8 +67,8 @@ impl<T: MiniObject> GstRc<T> {
}
self.obj = T::from_mut_ptr(
ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject) as
*mut T::GstType,
ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject)
as *mut T::GstType,
);
assert!(self.is_writable());
@ -194,8 +194,8 @@ where
fn copy(&self) -> GstRc<Self> {
unsafe {
GstRc::from_glib_full(
ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject) as
*const Self::GstType,
ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject)
as *const Self::GstType,
)
}
}
@ -261,8 +261,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let v_ptr = unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as
*mut *mut T::GstType;
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1)
as *mut *mut T::GstType;
for (i, s) in v.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.0);
@ -277,8 +277,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
fn to_glib_full_from_slice(t: &[GstRc<T>]) -> *mut *mut T::GstType {
skip_assert_initialized!();
unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1) as
*mut *mut T::GstType;
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut T::GstType>() * t.len() + 1)
as *mut *mut T::GstType;
for (i, s) in t.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.to_glib_full());

View file

@ -25,7 +25,7 @@ use std::cell::RefCell;
use glib;
use glib::{IsA, StaticType};
use glib::translate::{mut_override, from_glib, from_glib_borrow, from_glib_full, from_glib_none,
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_ffi;
@ -40,7 +40,10 @@ impl Pad {
pub fn new_from_static_template(templ: &StaticPadTemplate, name: &str) -> Pad {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::gst_pad_new_from_static_template(mut_override(templ.to_glib_none().0), name.to_glib_none().0))
from_glib_none(ffi::gst_pad_new_from_static_template(
mut_override(templ.to_glib_none().0),
name.to_glib_none().0,
))
}
}
}

View file

@ -78,12 +78,23 @@ impl ProxyPad {
}
}
pub fn iterate_internal_links_default<'a, P: IsA<Pad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>(pad: &P, parent: R) -> Option<::Iterator<Pad>> {
pub fn iterate_internal_links_default<
'a,
P: IsA<Pad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P,
parent: R,
) -> Option<::Iterator<Pad>> {
skip_assert_initialized!();
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(pad.to_glib_none().0, parent.0))
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(
pad.to_glib_none().0,
parent.0,
))
}
}
}

View file

@ -89,8 +89,8 @@ impl ToOwned for SampleRef {
fn to_owned(&self) -> GstRc<SampleRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -330,8 +330,8 @@ impl Default for Segment {
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for Segment {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<Segment>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as
*mut ffi::GstSegment)
Option::<Segment>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
as *mut ffi::GstSegment)
}
}
@ -340,8 +340,8 @@ impl glib::value::SetValue for Segment {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -351,8 +351,8 @@ impl glib::value::SetValueOptional for Segment {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstSegment>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -36,9 +36,8 @@ impl glib::types::StaticType for StaticCaps {
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for StaticCaps {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<StaticCaps>::from_glib_none(
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps,
)
Option::<StaticCaps>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
as *mut ffi::GstStaticCaps)
}
}
@ -47,8 +46,8 @@ impl glib::value::SetValue for StaticCaps {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -58,8 +57,8 @@ impl glib::value::SetValueOptional for StaticCaps {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstStaticCaps>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -55,8 +55,8 @@ impl glib::types::StaticType for StaticPadTemplate {
impl<'a> glib::value::FromValueOptional<'a> for StaticPadTemplate {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<StaticPadTemplate>::from_glib_none(
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as
*mut ffi::GstStaticPadTemplate,
gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
as *mut ffi::GstStaticPadTemplate,
)
}
}
@ -66,8 +66,8 @@ impl glib::value::SetValue for StaticPadTemplate {
unsafe fn set_value(value: &mut glib::Value, this: &Self) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(this).0
as glib_ffi::gpointer,
)
}
}
@ -77,8 +77,8 @@ impl glib::value::SetValueOptional for StaticPadTemplate {
unsafe fn set_value_optional(value: &mut glib::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_boxed(
value.to_glib_none_mut().0,
glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(&this).0 as
glib_ffi::gpointer,
glib::translate::ToGlibPtr::<*const ffi::GstStaticPadTemplate>::to_glib_none(&this).0
as glib_ffi::gpointer,
)
}
}

View file

@ -103,7 +103,11 @@ impl_tag!(GeoLocationLongitute, f64, *TAG_GEO_LOCATION_LONGITUDE);
impl_tag!(GeoLocationElevation, f64, *TAG_GEO_LOCATION_ELEVATION);
impl_tag!(GeoLocationCity, &'a str, *TAG_GEO_LOCATION_CITY);
impl_tag!(GeoLocationCountry, &'a str, *TAG_GEO_LOCATION_COUNTRY);
impl_tag!(GeoLocationSublocation, &'a str, *TAG_GEO_LOCATION_SUBLOCATION);
impl_tag!(
GeoLocationSublocation,
&'a str,
*TAG_GEO_LOCATION_SUBLOCATION
);
impl_tag!(
GeoLocationHorizontalError,
f64,
@ -333,8 +337,8 @@ impl ToOwned for TagListRef {
fn to_owned(&self) -> GstRc<TagListRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -104,8 +104,8 @@ impl ToOwned for TocRef {
fn to_owned(&self) -> GstRc<TocRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}
@ -256,8 +256,8 @@ impl ToOwned for TocEntryRef {
fn to_owned(&self) -> GstRc<TocEntryRef> {
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as
*mut _)
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
as *mut _)
}
}
}

View file

@ -6,7 +6,8 @@ fn main() {
gst::init().unwrap();
// Build the pipeline
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
let uri =
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
let pipeline = gst::parse_launch(&format!("playbin uri={}", uri)).unwrap();
// Start playing

View file

@ -23,7 +23,8 @@ fn main() {
convert.link(&sink).expect("Elements could not be linked.");
// Set the URI to play
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
let uri =
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
source
.set_property("uri", &uri)
.expect("Can't set uri property on uridecodebin");

View file

@ -22,7 +22,8 @@ fn main() {
gst::ElementFactory::make("playbin", "playbin").expect("Failed to create playbin element");
// Set the URI to play
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
let uri =
"https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm";
playbin
.set_property("uri", &uri)
.expect("Can't set uri property on playbin");
@ -62,16 +63,16 @@ fn main() {
custom_data.duration = custom_data
.playbin
.query_duration(gst::Format::Time)
.expect("Could not query current duration.") as
gst::ClockTime;
.expect("Could not query current duration.")
as gst::ClockTime;
}
// Print current position and total duration
print!("\rPosition {} / {}", position, custom_data.duration);
io::stdout().flush().unwrap();
if custom_data.seek_enabled && !custom_data.seek_done &&
position > 10 * gst::SECOND
if custom_data.seek_enabled && !custom_data.seek_done
&& position > 10 * gst::SECOND
{
println!("\nReached 10s, performing seek...");
custom_data

View file

@ -122,18 +122,17 @@ mod tutorial5 {
1.0 as f64,
);
let pipeline = playbin.clone();
let slider_update_signal_id = slider
.connect_value_changed(move |slider| {
let pipeline = &pipeline;
let value = slider.get_value() as u64;
if let Err(_) = pipeline.seek_simple(
gst::Format::Time,
gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT,
((value * gst::SECOND) as i64),
) {
eprintln!("Seeking to {} failed", value);
}
});
let slider_update_signal_id = slider.connect_value_changed(move |slider| {
let pipeline = &pipeline;
let value = slider.get_value() as u64;
if let Err(_) = pipeline.seek_simple(
gst::Format::Time,
gst::SeekFlags::FLUSH | gst::SeekFlags::KEY_UNIT,
((value * gst::SECOND) as i64),
) {
eprintln!("Seeking to {} failed", value);
}
});
slider.set_draw_value(false);
let pipeline = playbin.clone();

View file

@ -12,12 +12,12 @@ fn main() {
let tee = gst::ElementFactory::make("tee", "tee").unwrap();
let audio_queue = gst::ElementFactory::make("queue", "audio_queue").unwrap();
let audio_convert = gst::ElementFactory::make("audioconvert", "audio_convert").unwrap();
let audio_resample = gst::ElementFactory::make ("audioresample", "audio_resample").unwrap();
let audio_resample = gst::ElementFactory::make("audioresample", "audio_resample").unwrap();
let audio_sink = gst::ElementFactory::make("autoaudiosink", "audio_sink").unwrap();
let video_queue = gst::ElementFactory::make("queue", "video_queue").unwrap();
let visual = gst::ElementFactory::make("wavescope", "visual").unwrap();
let video_convert = gst::ElementFactory::make("videoconvert", "video_convert").unwrap();
let video_sink = gst::ElementFactory::make ("autovideosink", "video_sink").unwrap();
let video_sink = gst::ElementFactory::make("autovideosink", "video_sink").unwrap();
let pipeline = gst::Pipeline::new("test-pipeline");
@ -25,21 +25,43 @@ fn main() {
visual.set_property_from_str("shader", "none");
visual.set_property_from_str("style", "lines");
pipeline.add_many(&[&audio_source, &tee, &audio_queue, &audio_convert,
&audio_resample, &audio_sink, &video_queue, &visual,
&video_convert, &video_sink]).unwrap();
pipeline
.add_many(&[
&audio_source,
&tee,
&audio_queue,
&audio_convert,
&audio_resample,
&audio_sink,
&video_queue,
&visual,
&video_convert,
&video_sink,
])
.unwrap();
gst::Element::link_many(&[&audio_source, &tee]).unwrap();
gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap();
gst::Element::link_many(&[
&audio_queue,
&audio_convert,
&audio_resample,
&audio_sink,
]).unwrap();
gst::Element::link_many(&[&video_queue, &visual, &video_convert, &video_sink]).unwrap();
let tee_audio_pad = tee.get_request_pad("src_%u").unwrap();
println!("Obtained request pad {} for audio branch", tee_audio_pad.get_name());
println!(
"Obtained request pad {} for audio branch",
tee_audio_pad.get_name()
);
let queue_audio_pad = audio_queue.get_static_pad("sink").unwrap();
tee_audio_pad.link(&queue_audio_pad);
let tee_video_pad = tee.get_request_pad("src_%u").unwrap();
println!("Obtained request pad {} for video branch", tee_video_pad.get_name());
println!(
"Obtained request pad {} for video branch",
tee_video_pad.get_name()
);
let queue_video_pad = video_queue.get_static_pad("sink").unwrap();
tee_video_pad.link(&queue_video_pad);