Run everything through rustfmt again

This commit is contained in:
Sebastian Dröge 2017-12-20 19:30:14 +02:00
parent f439f14ec3
commit e0dc84c10a
33 changed files with 291 additions and 303 deletions

View file

@ -173,16 +173,14 @@ fn example_main() -> Result<(), Error> {
})
.map(Result::Err)
.expect("error-details message without actual error"),
_ => Err(
ErrorMessage {
_ => 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(),
),
}.into()),
}?;
}
#[cfg(not(feature = "v1_10"))]

View file

@ -186,7 +186,6 @@ impl AppSrc {
}
}
pub fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) {
unsafe {
let mut min = mem::uninitialized();

View file

@ -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 {
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(

View file

@ -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)
}
}

View file

@ -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 {
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 _,

View file

@ -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 {

View file

@ -83,7 +83,6 @@ impl Player {
}
}
pub fn connect_seek_done<F: Fn(&Player, gst::ClockTime) + Send + 'static>(
&self,
f: F,

View file

@ -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)
}
}
}

View file

@ -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)]

View file

@ -334,7 +334,6 @@ mod tests {
assert!(frame.info() == &info);
}
#[test]
fn test_map_write() {
gst::init().unwrap();

View file

@ -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),
)))
}
}

View file

@ -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)
}
}
}

View file

@ -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)
}
}
}

View file

@ -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(),
))
}
}
}

View file

@ -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,
))
}
}

View file

@ -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())
}
}

View file

@ -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(
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(
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(
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,8 +1352,7 @@ impl<'a> SeekBuilder<'a> {
}
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_seek(
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_seek(
s.rate,
s.start.get_format().to_glib(),
s.flags.to_glib(),
@ -1368,8 +1360,7 @@ impl<'a> SeekBuilder<'a> {
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(
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> {

View file

@ -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)
}

View file

@ -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;

View file

@ -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(
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,8 +1583,7 @@ impl<'a> StepDoneBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_step_done(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_done(
src,
s.amount.get_format().to_glib(),
s.amount.get_value() as u64,
@ -1595,8 +1592,7 @@ impl<'a> StepDoneBuilder<'a> {
s.intermediate.to_glib(),
s.duration.get_value() as u64,
s.eos.to_glib(),
)
});
));
}
pub struct ClockProvideBuilder<'a> {
@ -1618,9 +1614,11 @@ impl<'a> ClockProvideBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_clock_provide(src, s.clock.to_glib_none().0, s.ready.to_glib())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_provide(
src,
s.clock.to_glib_none().0,
s.ready.to_glib()
));
}
pub struct ClockLostBuilder<'a> {
@ -1640,9 +1638,10 @@ impl<'a> ClockLostBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_clock_lost(src, s.clock.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_clock_lost(
src,
s.clock.to_glib_none().0
));
}
pub struct NewClockBuilder<'a> {
@ -1662,9 +1661,10 @@ impl<'a> NewClockBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_new_clock(src, s.clock.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_new_clock(
src,
s.clock.to_glib_none().0
));
}
pub struct StructureChangeBuilder<'a> {
@ -1688,14 +1688,12 @@ impl<'a> StructureChangeBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_structure_change(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_structure_change(
src,
s.type_.to_glib(),
s.owner.to_glib_none().0,
s.busy.to_glib(),
)
});
));
}
pub struct StreamStatusBuilder<'a> {
@ -1756,9 +1754,10 @@ impl<'a> ApplicationBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_application(src, s.structure.take().unwrap().into_ptr())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_application(
src,
s.structure.take().unwrap().into_ptr()
));
}
pub struct ElementBuilder<'a> {
@ -1778,9 +1777,10 @@ impl<'a> ElementBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_element(src, s.structure.take().unwrap().into_ptr())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_element(
src,
s.structure.take().unwrap().into_ptr()
));
}
pub struct SegmentStartBuilder<'a> {
@ -1800,13 +1800,11 @@ impl<'a> SegmentStartBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_segment_start(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_start(
src,
s.position.get_format().to_glib(),
s.position.get_value(),
)
});
));
}
pub struct SegmentDoneBuilder<'a> {
@ -1826,13 +1824,11 @@ impl<'a> SegmentDoneBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_segment_done(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_segment_done(
src,
s.position.get_format().to_glib(),
s.position.get_value(),
)
});
));
}
pub struct DurationChangedBuilder<'a> {
@ -1906,9 +1902,10 @@ impl<'a> AsyncDoneBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_async_done(src, s.running_time.to_glib())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_async_done(
src,
s.running_time.to_glib()
));
}
pub struct RequestStateBuilder<'a> {
@ -1928,9 +1925,10 @@ impl<'a> RequestStateBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_request_state(src, s.state.to_glib())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_request_state(
src,
s.state.to_glib()
));
}
pub struct StepStartBuilder<'a> {
@ -1964,8 +1962,7 @@ impl<'a> StepStartBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_step_start(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_step_start(
src,
s.active.to_glib(),
s.amount.get_format().to_glib(),
@ -1973,8 +1970,7 @@ impl<'a> StepStartBuilder<'a> {
s.rate,
s.flush.to_glib(),
s.intermediate.to_glib(),
)
});
));
}
pub struct QosBuilder<'a> {
@ -2074,14 +2070,12 @@ impl<'a> ProgressBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_progress(
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_progress(
src,
s.type_.to_glib(),
s.code.to_glib_none().0,
s.text.to_glib_none().0,
)
});
));
}
pub struct TocBuilder<'a> {
@ -2103,9 +2097,11 @@ impl<'a> TocBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &Self, src| {
ffi::gst_message_new_toc(src, s.toc.to_glib_none().0, s.updated.to_glib())
});
message_builder_generic_impl!(|s: &Self, src| ffi::gst_message_new_toc(
src,
s.toc.to_glib_none().0,
s.updated.to_glib()
));
}
pub struct ResetTimeBuilder<'a> {
@ -2125,9 +2121,10 @@ impl<'a> ResetTimeBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_reset_time(src, s.running_time.to_glib())
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_reset_time(
src,
s.running_time.to_glib()
));
}
pub struct StreamStartBuilder<'a> {
@ -2180,9 +2177,10 @@ impl<'a> NeedContextBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_need_context(src, s.context_type.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_need_context(
src,
s.context_type.to_glib_none().0
));
}
pub struct HaveContextBuilder<'a> {
@ -2225,9 +2223,10 @@ impl<'a> DeviceAddedBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_device_added(src, s.device.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_device_added(
src,
s.device.to_glib_none().0
));
}
pub struct DeviceRemovedBuilder<'a> {
@ -2247,9 +2246,10 @@ impl<'a> DeviceRemovedBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_device_removed(src, s.device.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_device_removed(
src,
s.device.to_glib_none().0
));
}
#[cfg(any(feature = "v1_10", feature = "dox"))]
@ -2313,9 +2313,10 @@ impl<'a> StreamCollectionBuilder<'a> {
}
}
message_builder_generic_impl!(|s: &mut Self, src| {
ffi::gst_message_new_stream_collection(src, s.collection.to_glib_none().0)
});
message_builder_generic_impl!(|s: &mut Self, src| ffi::gst_message_new_stream_collection(
src,
s.collection.to_glib_none().0
));
}
#[cfg(any(feature = "v1_10", feature = "dox"))]

View file

@ -66,10 +66,9 @@ impl<T: MiniObject> GstRc<T> {
return &mut *self.obj;
}
self.obj = T::from_mut_ptr(
ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject)
as *mut T::GstType,
);
self.obj = T::from_mut_ptr(ffi::gst_mini_object_make_writable(self.as_mut_ptr()
as *mut ffi::GstMiniObject)
as *mut T::GstType);
assert!(self.is_writable());
&mut *self.obj
@ -86,9 +85,8 @@ impl<T: MiniObject> GstRc<T> {
pub fn is_writable(&self) -> bool {
unsafe {
from_glib(ffi::gst_mini_object_is_writable(
self.as_ptr() as *const ffi::GstMiniObject,
))
from_glib(ffi::gst_mini_object_is_writable(self.as_ptr()
as *const ffi::GstMiniObject))
}
}
@ -193,10 +191,9 @@ 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,
)
GstRc::from_glib_full(ffi::gst_mini_object_copy(self.as_ptr()
as *const ffi::GstMiniObject)
as *const Self::GstType)
}
}
}

View file

@ -874,24 +874,24 @@ unsafe extern "C" fn trampoline_pad_probe(
let data = (*info).data as *const ffi::GstMiniObject;
if (*data).type_ == Buffer::static_type().to_glib() {
data_type = Some(Buffer::static_type());
Some(PadProbeData::Buffer(
from_glib_none(data as *const ffi::GstBuffer),
))
Some(PadProbeData::Buffer(from_glib_none(
data as *const ffi::GstBuffer,
)))
} else if (*data).type_ == BufferList::static_type().to_glib() {
data_type = Some(BufferList::static_type());
Some(PadProbeData::BufferList(
from_glib_none(data as *const ffi::GstBufferList),
))
Some(PadProbeData::BufferList(from_glib_none(
data as *const ffi::GstBufferList,
)))
} else if (*data).type_ == Query::static_type().to_glib() {
data_type = Some(Query::static_type());
Some(PadProbeData::Query(
QueryRef::from_mut_ptr(data as *mut ffi::GstQuery),
))
Some(PadProbeData::Query(QueryRef::from_mut_ptr(
data as *mut ffi::GstQuery,
)))
} else if (*data).type_ == Event::static_type().to_glib() {
data_type = Some(Event::static_type());
Some(PadProbeData::Event(
from_glib_none(data as *const ffi::GstEvent),
))
Some(PadProbeData::Event(from_glib_none(
data as *const ffi::GstEvent,
)))
} else {
Some(PadProbeData::Unknown)
}
@ -1195,9 +1195,7 @@ mod tests {
assert!(pad.send_event(::Event::new_stream_start("test").build()));
let segment = ::FormattedSegment::<::ClockTime>::new();
assert!(pad.send_event(
::Event::new_segment(segment.as_ref()).build()
));
assert!(pad.send_event(::Event::new_segment(segment.as_ref()).build()));
assert_eq!(pad.chain(::Buffer::new()), ::FlowReturn::Ok);

View file

@ -142,15 +142,21 @@ impl QueryRef {
}
pub fn is_downstream(&self) -> bool {
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_DOWNSTREAM.bits()) != 0 }
unsafe {
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_DOWNSTREAM.bits()) != 0
}
}
pub fn is_upstream(&self) -> bool {
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_UPSTREAM.bits()) != 0 }
unsafe {
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_UPSTREAM.bits()) != 0
}
}
pub fn is_serialized(&self) -> bool {
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_SERIALIZED.bits()) != 0 }
unsafe {
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_SERIALIZED.bits()) != 0
}
}
pub fn view(&self) -> QueryView<&Self> {

View file

@ -54,10 +54,9 @@ impl glib::types::StaticType for StaticPadTemplate {
#[doc(hidden)]
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,
)
Option::<StaticPadTemplate>::from_glib_none(gobject_ffi::g_value_get_boxed(
value.to_glib_none().0,
) as *mut ffi::GstStaticPadTemplate)
}
}

View file

@ -37,7 +37,9 @@ impl Structure {
pub fn new_empty(name: &str) -> Structure {
assert_initialized_main_thread!();
Structure(
unsafe { ffi::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef },
unsafe {
ffi::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef
},
PhantomData,
)
}

View file

@ -306,7 +306,9 @@ impl TagListRef {
}
pub fn get_size<'a, T: Tag<'a>>(&'a self) -> u32 {
unsafe { ffi::gst_tag_list_get_tag_size(self.as_ptr(), T::tag_name().to_glib_none().0) }
unsafe {
ffi::gst_tag_list_get_tag_size(self.as_ptr(), T::tag_name().to_glib_none().0)
}
}
pub fn iter_tag<'a, T: Tag<'a>>(&'a self) -> TagIterator<'a, T> {
@ -318,7 +320,9 @@ impl TagListRef {
}
pub fn insert(&mut self, other: &TagListRef, mode: TagMergeMode) {
unsafe { ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib()) }
unsafe {
ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib())
}
}
pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList {

View file

@ -42,11 +42,15 @@ impl TocRef {
}
pub fn find_entry(&self, uid: &str) -> Option<TocEntry> {
unsafe { from_glib_none(ffi::gst_toc_find_entry(self.as_ptr(), uid.to_glib_none().0)) }
unsafe {
from_glib_none(ffi::gst_toc_find_entry(self.as_ptr(), uid.to_glib_none().0))
}
}
pub fn get_entries(&self) -> Vec<TocEntry> {
unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_toc_get_entries(self.as_ptr())) }
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_toc_get_entries(self.as_ptr()))
}
}
pub fn append_entry(&mut self, entry: TocEntry) {

View file

@ -248,9 +248,7 @@ mod tests {
.cloned()
.find(|f| {
f.get_caps()
.map(|c| {
c.get_structure(0).unwrap().get_name() == "application/xml"
})
.map(|c| c.get_structure(0).unwrap().get_name() == "application/xml")
.unwrap_or(false)
})
.unwrap();

View file

@ -59,7 +59,6 @@ fn tutorial_main() {
);
}
fn main() {
// tutorials_common::run is only required to set up the application environment on macOS
// (but not necessary in normal Cocoa applications where this is set up automatically)

View file

@ -123,8 +123,7 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::GstRc<gst::MessageRef
println!(
"Pipeline state changed from {:?} to {:?}",
old_state,
new_state
old_state, new_state
);
custom_data.playing = new_state == gst::State::Playing;

View file

@ -53,9 +53,10 @@ mod tutorial5 {
}
if let Some(bitrate) = tags.get::<gst::tags::Bitrate>() {
textbuf.insert_at_cursor(
&format!(" bitrate: {} \n", bitrate.get().unwrap()),
);
textbuf.insert_at_cursor(&format!(
" bitrate: {} \n",
bitrate.get().unwrap()
));
}
}
},

View file

@ -44,12 +44,7 @@ fn tutorial_main() {
.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();

View file

@ -90,12 +90,8 @@ fn main() {
.unwrap();
gst::Element::link_many(&[&appsrc, &tee]).unwrap();
gst::Element::link_many(&[
&audio_queue,
&audio_convert1,
&audio_resample,
&audio_sink,
]).unwrap();
gst::Element::link_many(&[&audio_queue, &audio_convert1, &audio_resample, &audio_sink])
.unwrap();
gst::Element::link_many(&[
&video_queue,
&audio_convert2,
@ -234,8 +230,6 @@ fn main() {
gst::FlowReturn::Ok
});
pipeline
.set_state(gst::State::Playing)
.into_result()