mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-11 03:35:26 +00:00
Run everything through latest rustfmt
This commit is contained in:
parent
bdfc95e6e8
commit
dcb3683232
14 changed files with 55 additions and 70 deletions
|
@ -161,7 +161,8 @@ impl AudioEcho {
|
|||
state: &mut State,
|
||||
settings: &Settings,
|
||||
) {
|
||||
let delay_frames = (settings.delay as usize) * (state.info.channels() as usize)
|
||||
let delay_frames = (settings.delay as usize)
|
||||
* (state.info.channels() as usize)
|
||||
* (state.info.rate() as usize) / (gst::SECOND_VAL as usize);
|
||||
|
||||
for (i, (o, e)) in data.iter_mut().zip(state.buffer.iter(delay_frames)) {
|
||||
|
|
|
@ -83,7 +83,9 @@ struct AudioFormat {
|
|||
// Ignores bitrate
|
||||
impl PartialEq for AudioFormat {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.format.eq(&other.format) && self.rate.eq(&other.rate) && self.width.eq(&other.width)
|
||||
self.format.eq(&other.format)
|
||||
&& self.rate.eq(&other.rate)
|
||||
&& self.width.eq(&other.width)
|
||||
&& self.channels.eq(&other.channels)
|
||||
&& self.aac_sequence_header.eq(&other.aac_sequence_header)
|
||||
}
|
||||
|
@ -372,7 +374,8 @@ impl VideoFormat {
|
|||
// Ignores bitrate
|
||||
impl PartialEq for VideoFormat {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.format.eq(&other.format) && self.width.eq(&other.width)
|
||||
self.format.eq(&other.format)
|
||||
&& self.width.eq(&other.width)
|
||||
&& self.height.eq(&other.height)
|
||||
&& self.pixel_aspect_ratio.eq(&other.pixel_aspect_ratio)
|
||||
&& self.framerate.eq(&other.framerate)
|
||||
|
@ -515,7 +518,8 @@ impl FlvDemux {
|
|||
|
||||
self.adapter.flush(15).unwrap();
|
||||
|
||||
let buffer = self.adapter
|
||||
let buffer = self
|
||||
.adapter
|
||||
.get_buffer(tag_header.data_size as usize)
|
||||
.unwrap();
|
||||
let map = buffer.map_readable().unwrap();
|
||||
|
@ -669,7 +673,8 @@ impl FlvDemux {
|
|||
match header.packet_type {
|
||||
flavors::AACPacketType::SequenceHeader => {
|
||||
self.adapter.flush(15 + 1 + 1).unwrap();
|
||||
let buffer = self.adapter
|
||||
let buffer = self
|
||||
.adapter
|
||||
.get_buffer((tag_header.data_size - 1 - 1) as usize)
|
||||
.unwrap();
|
||||
gst_debug!(
|
||||
|
@ -724,7 +729,8 @@ impl FlvDemux {
|
|||
self.adapter.flush(offset as usize).unwrap();
|
||||
}
|
||||
|
||||
let mut buffer = self.adapter
|
||||
let mut buffer = self
|
||||
.adapter
|
||||
.get_buffer((tag_header.data_size - 1 - offset) as usize)
|
||||
.unwrap();
|
||||
|
||||
|
@ -845,7 +851,8 @@ impl FlvDemux {
|
|||
match header.packet_type {
|
||||
flavors::AVCPacketType::SequenceHeader => {
|
||||
self.adapter.flush(15 + 1 + 4).unwrap();
|
||||
let buffer = self.adapter
|
||||
let buffer = self
|
||||
.adapter
|
||||
.get_buffer((tag_header.data_size - 1 - 4) as usize)
|
||||
.unwrap();
|
||||
gst_debug!(
|
||||
|
@ -910,7 +917,8 @@ impl FlvDemux {
|
|||
self.adapter.flush(offset as usize).unwrap();
|
||||
}
|
||||
|
||||
let mut buffer = self.adapter
|
||||
let mut buffer = self
|
||||
.adapter
|
||||
.get_buffer((tag_header.data_size - 1 - offset) as usize)
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use reqwest::header::{AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec,
|
||||
Range, RangeUnit};
|
||||
use reqwest::header::{
|
||||
AcceptRanges, ByteRangeSpec, ContentLength, ContentRange, ContentRangeSpec, Range, RangeUnit,
|
||||
};
|
||||
use reqwest::{Client, Response};
|
||||
use std::io::Read;
|
||||
use std::u64;
|
||||
|
|
|
@ -338,11 +338,7 @@ impl Demuxer {
|
|||
mode: gst::PadMode,
|
||||
active: bool,
|
||||
) -> bool {
|
||||
let element = parent
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.downcast_ref::<Element>()
|
||||
.unwrap();
|
||||
let element = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap();
|
||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||
|
||||
if active {
|
||||
|
@ -375,11 +371,7 @@ impl Demuxer {
|
|||
parent: &Option<gst::Object>,
|
||||
buffer: gst::Buffer,
|
||||
) -> gst::FlowReturn {
|
||||
let element = parent
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.downcast_ref::<Element>()
|
||||
.unwrap();
|
||||
let element = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap();
|
||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||
|
||||
let mut res = {
|
||||
|
@ -472,11 +464,7 @@ impl Demuxer {
|
|||
fn sink_event(pad: &gst::Pad, parent: &Option<gst::Object>, event: gst::Event) -> bool {
|
||||
use gst::EventView;
|
||||
|
||||
let element = parent
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.downcast_ref::<Element>()
|
||||
.unwrap();
|
||||
let element = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap();
|
||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||
|
||||
match event.view() {
|
||||
|
@ -487,12 +475,7 @@ impl Demuxer {
|
|||
match demuxer_impl.end_of_stream(element) {
|
||||
Ok(_) => (),
|
||||
Err(ref msg) => {
|
||||
gst_error!(
|
||||
demuxer.cat,
|
||||
obj: element,
|
||||
"Failed end of stream: {:?}",
|
||||
msg
|
||||
);
|
||||
gst_error!(demuxer.cat, obj: element, "Failed end of stream: {:?}", msg);
|
||||
element.post_error_message(msg);
|
||||
}
|
||||
}
|
||||
|
@ -506,11 +489,7 @@ impl Demuxer {
|
|||
fn src_query(pad: &gst::Pad, parent: &Option<gst::Object>, query: &mut gst::QueryRef) -> bool {
|
||||
use gst::QueryView;
|
||||
|
||||
let element = parent
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.downcast_ref::<Element>()
|
||||
.unwrap();
|
||||
let element = parent.as_ref().unwrap().downcast_ref::<Element>().unwrap();
|
||||
let demuxer = element.get_impl().downcast_ref::<Demuxer>().unwrap();
|
||||
|
||||
match query.view_mut() {
|
||||
|
|
|
@ -19,8 +19,8 @@ use gobject_subclass::object::*;
|
|||
|
||||
use gst_plugin::base_sink::*;
|
||||
use gst_plugin::element::*;
|
||||
use gst_plugin::uri_handler::*;
|
||||
use gst_plugin::error::*;
|
||||
use gst_plugin::uri_handler::*;
|
||||
|
||||
pub use gst_plugin::base_sink::BaseSink;
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ use gobject_subclass::object::*;
|
|||
|
||||
use gst_plugin::base_src::*;
|
||||
use gst_plugin::element::*;
|
||||
use gst_plugin::uri_handler::*;
|
||||
use gst_plugin::error::*;
|
||||
use gst_plugin::uri_handler::*;
|
||||
|
||||
pub use gst_plugin::base_src::BaseSrc;
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ use gst::prelude::*;
|
|||
extern crate gtk;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::env;
|
||||
use std::cell::RefCell;
|
||||
use std::env;
|
||||
|
||||
fn create_pipeline() -> (
|
||||
gst::Pipeline,
|
||||
|
|
|
@ -611,7 +611,8 @@ impl ToggleRecord {
|
|||
// stop position that we're EOS now
|
||||
// If we're before the start position (we were starting before EOS),
|
||||
// drop the buffer
|
||||
if rec_state.last_recording_stop.is_none() || rec_state.last_recording_start.is_none()
|
||||
if rec_state.last_recording_stop.is_none()
|
||||
|| rec_state.last_recording_start.is_none()
|
||||
|| current_running_time_end > rec_state.last_recording_stop
|
||||
{
|
||||
gst_debug!(
|
||||
|
@ -982,7 +983,9 @@ impl ToggleRecord {
|
|||
// If a serialized event and coming after Segment and a new Segment is pending,
|
||||
// queue up and send at a later time (buffer/gap) after we sent the Segment
|
||||
let type_ = event.get_type();
|
||||
if forward && type_ != gst::EventType::Eos && type_.is_serialized()
|
||||
if forward
|
||||
&& type_ != gst::EventType::Eos
|
||||
&& type_.is_serialized()
|
||||
&& type_.partial_cmp(&gst::EventType::Segment) == Some(cmp::Ordering::Greater)
|
||||
{
|
||||
let mut state = stream.state.lock().unwrap();
|
||||
|
@ -1111,12 +1114,14 @@ impl ToggleRecord {
|
|||
|
||||
let (flags, min, max, align) = new_query.get_result();
|
||||
q.set(flags, min, max, align);
|
||||
q.add_scheduling_modes(&new_query
|
||||
.get_scheduling_modes()
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter(|m| m != &gst::PadMode::Pull)
|
||||
.collect::<Vec<_>>());
|
||||
q.add_scheduling_modes(
|
||||
&new_query
|
||||
.get_scheduling_modes()
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter(|m| m != &gst::PadMode::Pull)
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
gst_log!(self.cat, obj: pad, "Returning {:?}", q.get_mut_query());
|
||||
return true;
|
||||
}
|
||||
|
@ -1240,7 +1245,8 @@ impl ElementImpl<Element> for ToggleRecord {
|
|||
|
||||
match transition {
|
||||
gst::StateChange::ReadyToPaused => {
|
||||
for s in self.other_streams
|
||||
for s in self
|
||||
.other_streams
|
||||
.lock()
|
||||
.unwrap()
|
||||
.0
|
||||
|
@ -1274,7 +1280,8 @@ impl ElementImpl<Element> for ToggleRecord {
|
|||
|
||||
match transition {
|
||||
gst::StateChange::PausedToReady => {
|
||||
for s in self.other_streams
|
||||
for s in self
|
||||
.other_streams
|
||||
.lock()
|
||||
.unwrap()
|
||||
.0
|
||||
|
|
|
@ -328,8 +328,7 @@ unsafe impl<T: IsA<gst::Element> + IsA<gst_base::BaseTransform> + ObjectType> Ba
|
|||
for T
|
||||
where
|
||||
T::InstanceStructType: PanicPoison,
|
||||
{
|
||||
}
|
||||
{}
|
||||
pub type BaseTransformClass = ClassStruct<BaseTransform>;
|
||||
|
||||
// FIXME: Boilerplate
|
||||
|
|
|
@ -72,11 +72,7 @@ pub trait ReadBytesExtShort: io::Read {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> ReadBytesExtShort for T
|
||||
where
|
||||
T: ReadBytesExt,
|
||||
{
|
||||
}
|
||||
impl<T> ReadBytesExtShort for T where T: ReadBytesExt {}
|
||||
|
||||
pub trait WriteBytesExtShort: WriteBytesExt {
|
||||
fn write_u16le(&mut self, n: u16) -> io::Result<()> {
|
||||
|
@ -141,8 +137,4 @@ pub trait WriteBytesExtShort: WriteBytesExt {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> WriteBytesExtShort for T
|
||||
where
|
||||
T: WriteBytesExt,
|
||||
{
|
||||
}
|
||||
impl<T> WriteBytesExtShort for T where T: WriteBytesExt {}
|
||||
|
|
|
@ -197,11 +197,9 @@ glib_wrapper! {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: IsA<gst::Element> + ObjectType> ElementBase for T
|
||||
where
|
||||
Self::InstanceStructType: PanicPoison,
|
||||
{
|
||||
}
|
||||
unsafe impl<T: IsA<gst::Element> + ObjectType> ElementBase for T where
|
||||
Self::InstanceStructType: PanicPoison
|
||||
{}
|
||||
|
||||
pub type ElementClass = ClassStruct<Element>;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use std::ptr;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
use gobject_subclass::object::*;
|
||||
use glib::wrapper::Wrapper;
|
||||
use gobject_subclass::object::*;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct ElementInstanceStruct<T: ObjectType> {
|
||||
|
|
|
@ -62,8 +62,7 @@ glib_wrapper! {
|
|||
|
||||
unsafe impl<T: IsA<gst::Element> + IsA<gst::Bin> + IsA<gst::Pipeline> + ObjectType> PipelineBase
|
||||
for T
|
||||
{
|
||||
}
|
||||
{}
|
||||
pub type PipelineClass = ClassStruct<Pipeline>;
|
||||
|
||||
// FIXME: Boilerplate
|
||||
|
|
|
@ -121,7 +121,8 @@ pub fn register_uri_handler<T: ObjectType, I: URIHandlerImplStatic<T>>(
|
|||
imp: &I,
|
||||
) {
|
||||
unsafe {
|
||||
let mut protocols: Vec<_> = imp.get_protocols()
|
||||
let mut protocols: Vec<_> = imp
|
||||
.get_protocols()
|
||||
.iter()
|
||||
.map(|s| s.to_glib_full())
|
||||
.collect();
|
||||
|
|
Loading…
Reference in a new issue