Commit e0dc84c1 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

Run everything through rustfmt again

parent f439f14e
......@@ -173,16 +173,14 @@ fn example_main() -> Result<(), Error> {
})
.map(Result::Err)
.expect("error-details message without actual error"),
_ => Err(
ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),
}.into(),
),
_ => Err(ErrorMessage {
src: msg.get_src()
.map(|s| s.get_path_string())
.unwrap_or_else(|| String::from("None")),
error: err.get_error().description().into(),
debug: err.get_debug(),
cause: err.get_error(),
}.into()),
}?;
}
#[cfg(not(feature = "v1_10"))]
......
......@@ -186,7 +186,6 @@ impl AppSrc {
}
}
pub fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) {
unsafe {
let mut min = mem::uninitialized();
......
......@@ -101,13 +101,14 @@ impl AudioChannelPosition {
}
let len = positions.len();
let mut positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(
|i| if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
positions[i].to_glib()
},
);
let mut positions_raw: [ffi::GstAudioChannelPosition; 64] =
array_init::array_init_copy(|i| {
if i >= len as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
positions[i].to_glib()
}
});
let valid: bool = unsafe {
from_glib(ffi::gst_audio_channel_positions_to_valid_order(
......
......@@ -194,7 +194,6 @@ impl AudioFormatInfo {
self.flags().contains(::AudioFormatFlags::SIGNED)
}
pub fn is_little_endian(&self) -> bool {
self.endianness() == AudioEndianness::LittleEndian
}
......@@ -253,9 +252,9 @@ impl glib::types::StaticType for AudioFormatInfo {
#[doc(hidden)]
impl<'a> glib::value::FromValueOptional<'a> for AudioFormatInfo {
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
Option::<AudioFormatInfo>::from_glib_none(
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioFormatInfo,
)
Option::<AudioFormatInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(
value.to_glib_none().0,
) as *mut ffi::GstAudioFormatInfo)
}
}
......
......@@ -42,13 +42,14 @@ impl<'a> AudioInfoBuilder<'a> {
return None;
}
let positions: [ffi::GstAudioChannelPosition; 64] = array_init::array_init_copy(
|i| if i >= self.channels as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
p[i].to_glib()
},
);
let positions: [ffi::GstAudioChannelPosition; 64] =
array_init::array_init_copy(|i| {
if i >= self.channels as usize {
ffi::GST_AUDIO_CHANNEL_POSITION_INVALID
} else {
p[i].to_glib()
}
});
let valid: bool = from_glib(ffi::gst_audio_check_valid_channel_positions(
positions.as_ptr() as *mut _,
......
......@@ -46,7 +46,9 @@ impl AsMut<gst::StructureRef> for PlayerConfig {
impl PlayerConfig {
pub fn get_position_update_interval(&self) -> u32 {
assert_initialized_main_thread!();
unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) }
unsafe {
ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0)
}
}
pub fn get_seek_accurate(&self) -> bool {
......
......@@ -83,7 +83,6 @@ impl Player {
}
}
pub fn connect_seek_done<F: Fn(&Player, gst::ClockTime) + Send + 'static>(
&self,
f: F,
......
......@@ -19,10 +19,10 @@ impl PlayerGMainContextSignalDispatcher {
let application_context = application_context.into();
let application_context = application_context.to_glib_none();
unsafe {
from_glib_full(
ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0)
as *mut ffi::GstPlayerGMainContextSignalDispatcher,
from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new(
application_context.0,
)
as *mut ffi::GstPlayerGMainContextSignalDispatcher)
}
}
}
......@@ -237,13 +237,13 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &mut Self| {
ffi::gst_video_event_new_upstream_force_key_unit(
event_builder_generic_impl!(
|s: &mut Self| ffi::gst_video_event_new_upstream_force_key_unit(
s.running_time.to_glib(),
s.all_headers.to_glib(),
s.count,
)
});
);
}
#[derive(Clone, PartialEq, Eq, Debug)]
......@@ -315,9 +315,9 @@ impl<'a> StillFrameEventBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &mut Self| {
ffi::gst_video_event_new_still_frame(s.in_still.to_glib())
});
event_builder_generic_impl!(|s: &mut Self| ffi::gst_video_event_new_still_frame(
s.in_still.to_glib()
));
}
#[derive(Clone, PartialEq, Eq, Debug)]
......
......@@ -334,7 +334,6 @@ mod tests {
assert!(frame.info() == &info);
}
#[test]
fn test_map_write() {
gst::init().unwrap();
......
......@@ -521,9 +521,9 @@ impl VideoInfo {
pub fn multiview_flags(&self) -> ::VideoMultiviewFlags {
unsafe {
let ptr = &self.0._gst_reserved as *const _ as *const u32;
from_glib(ffi::GstVideoMultiviewFlags::from_bits_truncate(
ptr::read(ptr.offset(1)),
))
from_glib(ffi::GstVideoMultiviewFlags::from_bits_truncate(ptr::read(
ptr.offset(1),
)))
}
}
......
......@@ -157,7 +157,9 @@ impl GstRc<BufferRef> {
pub fn append(buffer: Self, other: Self) -> Self {
skip_assert_initialized!();
unsafe { from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr())) }
unsafe {
from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr()))
}
}
}
......@@ -170,8 +172,9 @@ impl Default for GstRc<BufferRef> {
impl BufferRef {
pub fn map_readable(&self) -> Option<BufferMap<Readable>> {
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
let res =
unsafe { ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READ) };
let res = unsafe {
ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READ)
};
if res == glib_ffi::GTRUE {
Some(BufferMap {
buffer: self,
......@@ -437,7 +440,9 @@ impl<'a, T> BufferMap<'a, T> {
impl<'a> BufferMap<'a, Writable> {
pub fn as_mut_slice(&mut self) -> &mut [u8] {
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
unsafe {
slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size)
}
}
}
......@@ -516,7 +521,9 @@ impl<T> MappedBuffer<T> {
impl MappedBuffer<Writable> {
pub fn as_mut_slice(&mut self) -> &mut [u8] {
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
unsafe {
slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size)
}
}
}
......
......@@ -136,7 +136,9 @@ impl Bus {
}
pub fn unset_sync_handler(&self) {
unsafe { ffi::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None) }
unsafe {
ffi::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None)
}
}
}
......
......@@ -59,14 +59,16 @@ impl ContextRef {
}
pub fn get_structure(&self) -> &StructureRef {
unsafe { StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr())) }
unsafe {
StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr()))
}
}
pub fn get_mut_structure(&mut self) -> &mut StructureRef {
unsafe {
StructureRef::from_glib_borrow_mut(
ffi::gst_context_writable_structure(self.as_mut_ptr()),
)
StructureRef::from_glib_borrow_mut(ffi::gst_context_writable_structure(
self.as_mut_ptr(),
))
}
}
}
......
......@@ -224,9 +224,9 @@ impl<O: IsA<Element>> ElementExtManual for O {
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),
)
FromGlibPtrContainer::from_glib_none(ffi::gst_element_class_get_pad_template_list(
klass,
))
}
}
......
......@@ -218,7 +218,6 @@ impl Error for PadLinkError {
}
}
impl ClockReturn {
pub fn into_result(self) -> Result<ClockSuccess, ClockError> {
match self {
......@@ -299,7 +298,6 @@ impl Ord for ::TypeFindProbability {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.to_glib().cmp(&other.to_glib())
}
}
impl PartialOrd for ::Rank {
......@@ -312,5 +310,4 @@ impl Ord for ::Rank {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.to_glib().cmp(&other.to_glib())
}
}
......@@ -734,7 +734,6 @@ impl<'a> Qos<'a> {
}
}
pub struct Seek<'a>(&'a EventRef);
impl<'a> Seek<'a> {
pub fn get(
......@@ -947,9 +946,7 @@ impl<'a> FlushStopBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_flush_stop(s.reset_time.to_glib())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_flush_stop(s.reset_time.to_glib()));
}
pub struct StreamStartBuilder<'a> {
......@@ -1036,9 +1033,7 @@ impl<'a> SegmentBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_segment(s.segment.to_glib_none().0)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment(s.segment.to_glib_none().0));
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
......@@ -1060,9 +1055,9 @@ impl<'a> StreamCollectionBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_stream_collection(s.stream_collection.to_glib_none().0)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_collection(
s.stream_collection.to_glib_none().0
));
}
pub struct TagBuilder<'a> {
......@@ -1109,14 +1104,12 @@ impl<'a> BufferSizeBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_buffer_size(
s.minsize.get_format().to_glib(),
s.minsize.get_value(),
s.maxsize.get_value(),
s.async.to_glib(),
)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_buffer_size(
s.minsize.get_format().to_glib(),
s.minsize.get_value(),
s.maxsize.get_value(),
s.async.to_glib(),
));
}
pub struct SinkMessageBuilder<'a> {
......@@ -1138,9 +1131,10 @@ impl<'a> SinkMessageBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_sink_message(s.name.to_glib_none().0, s.msg.as_mut_ptr())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_sink_message(
s.name.to_glib_none().0,
s.msg.as_mut_ptr()
));
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
......@@ -1162,9 +1156,9 @@ impl<'a> StreamGroupDoneBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_stream_group_done(s.group_id.to_glib())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_group_done(
s.group_id.to_glib()
));
}
pub struct EosBuilder<'a> {
......@@ -1204,9 +1198,10 @@ impl<'a> TocBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_toc(s.toc.to_glib_none().0, s.updated.to_glib())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc(
s.toc.to_glib_none().0,
s.updated.to_glib()
));
}
pub struct ProtectionBuilder<'a> {
......@@ -1237,13 +1232,11 @@ impl<'a> ProtectionBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_protection(
s.system_id.to_glib_none().0,
s.data.as_mut_ptr(),
s.origin.to_glib_none().0,
)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_protection(
s.system_id.to_glib_none().0,
s.data.as_mut_ptr(),
s.origin.to_glib_none().0,
));
}
pub struct SegmentDoneBuilder<'a> {
......@@ -1263,9 +1256,10 @@ impl<'a> SegmentDoneBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_segment_done(s.position.get_format().to_glib(), s.position.get_value())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_segment_done(
s.position.get_format().to_glib(),
s.position.get_value()
));
}
pub struct GapBuilder<'a> {
......@@ -1287,9 +1281,10 @@ impl<'a> GapBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_gap(s.timestamp.to_glib(), s.duration.to_glib())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_gap(
s.timestamp.to_glib(),
s.duration.to_glib()
));
}
pub struct QosBuilder<'a> {
......@@ -1315,14 +1310,12 @@ impl<'a> QosBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_qos(
s.type_.to_glib(),
s.proportion,
s.diff,
s.timestamp.to_glib(),
)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_qos(
s.type_.to_glib(),
s.proportion,
s.diff,
s.timestamp.to_glib(),
));
}
pub struct SeekBuilder<'a> {
......@@ -1359,17 +1352,15 @@ impl<'a> SeekBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_seek(
s.rate,
s.start.get_format().to_glib(),
s.flags.to_glib(),
s.start_type.to_glib(),
s.start.get_value(),
s.stop_type.to_glib(),
s.stop.get_value(),
)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_seek(
s.rate,
s.start.get_format().to_glib(),
s.flags.to_glib(),
s.start_type.to_glib(),
s.start.get_value(),
s.stop_type.to_glib(),
s.stop.get_value(),
));
}
pub struct NavigationBuilder<'a> {
......@@ -1441,15 +1432,13 @@ impl<'a> StepBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_step(
s.amount.get_format().to_glib(),
s.amount.get_value() as u64,
s.rate,
s.flush.to_glib(),
s.intermediate.to_glib(),
)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_step(
s.amount.get_format().to_glib(),
s.amount.get_value() as u64,
s.rate,
s.flush.to_glib(),
s.intermediate.to_glib(),
));
}
pub struct ReconfigureBuilder<'a> {
......@@ -1487,9 +1476,7 @@ impl<'a> TocSelectBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_toc_select(s.uid.to_glib_none().0)
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_toc_select(s.uid.to_glib_none().0));
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
......@@ -1511,9 +1498,9 @@ impl<'a> SelectStreamsBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_select_streams(s.streams.to_glib_full())
});
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_select_streams(
s.streams.to_glib_full()
));
}
pub struct CustomUpstreamBuilder<'a> {
......
......@@ -153,9 +153,7 @@ impl GenericFormattedValue {
if F::get_default_format() == self.get_format()
|| F::get_default_format() == Format::Undefined
{
Ok(unsafe {
F::from_raw(self.get_format(), self.to_raw_value())
})
Ok(unsafe { F::from_raw(self.get_format(), self.to_raw_value()) })
} else {
Err(self)
}
......
......@@ -74,7 +74,7 @@ pub use caps::{Caps, CapsRef};
pub mod tags;
pub use tags::{Tag, TagList, TagListRef};
pub mod buffer;
pub use buffer::{Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_METADATA, BUFFER_COPY_ALL};
pub use buffer::{Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA};
pub mod sample;
pub use sample::{Sample, SampleRef};
pub mod bufferlist;
......
......@@ -671,7 +671,6 @@ impl<'a> StepDone<'a> {
}
}
pub struct ClockProvide<'a>(&'a MessageRef);
impl<'a> ClockProvide<'a> {
pub fn get_clock(&self) -> Option<::Clock> {
......@@ -1446,9 +1445,10 @@ impl<'a> TagBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &Self, src| {
ffi::gst_message_new_tag(src, s.tags.to_glib_full())
});
message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_tag(
src,
s.tags.to_glib_full()
));
}
pub struct BufferingBuilder<'a> {
......@@ -1522,14 +1522,12 @@ impl<'a> StateChangedBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_state_changed(
src,
s.old.to_glib(),
s.new.to_glib(),
s.pending.to_glib(),
)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_state_changed(
src,
s.old.to_glib(),
s.new.to_glib(),
s.pending.to_glib(),
));
}
pub struct StateDirtyBuilder<'a> {
......@@ -1585,18 +1583,16 @@ impl<'a> StepDoneBuilder<'a> {
}