mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 21:05:15 +00:00
Run everything through rustfmt again
This commit is contained in:
parent
97ad0c0bc2
commit
20f1666bc9
2 changed files with 10 additions and 9 deletions
|
@ -158,9 +158,13 @@ impl AudioEcho {
|
||||||
Box::new(imp)
|
Box::new(imp)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process<F: Float + ToPrimitive + FromPrimitive>(data: &mut [F], state: &mut State, settings: &Settings) {
|
fn process<F: Float + ToPrimitive + FromPrimitive>(
|
||||||
let delay_frames = (settings.delay as usize) * (state.info.channels() as usize) * (state.info.rate() as usize) /
|
data: &mut [F],
|
||||||
(gst::SECOND as usize);
|
state: &mut State,
|
||||||
|
settings: &Settings,
|
||||||
|
) {
|
||||||
|
let delay_frames = (settings.delay as usize) * (state.info.channels() as usize) *
|
||||||
|
(state.info.rate() as usize) / (gst::SECOND as usize);
|
||||||
|
|
||||||
for (i, (o, e)) in data.iter_mut().zip(state.buffer.iter(delay_frames)) {
|
for (i, (o, e)) in data.iter_mut().zip(state.buffer.iter(delay_frames)) {
|
||||||
let inp = (*i).to_f64().unwrap();
|
let inp = (*i).to_f64().unwrap();
|
||||||
|
@ -228,7 +232,6 @@ impl ObjectImpl<RsBaseTransform> for AudioEcho {
|
||||||
impl ElementImpl<RsBaseTransform> for AudioEcho {}
|
impl ElementImpl<RsBaseTransform> for AudioEcho {}
|
||||||
|
|
||||||
impl BaseTransformImpl<RsBaseTransform> for AudioEcho {
|
impl BaseTransformImpl<RsBaseTransform> for AudioEcho {
|
||||||
|
|
||||||
fn transform_ip(&self, _element: &RsBaseTransform, buf: &gst::Buffer) -> gst::FlowReturn {
|
fn transform_ip(&self, _element: &RsBaseTransform, buf: &gst::Buffer) -> gst::FlowReturn {
|
||||||
let mut settings = *self.settings.lock().unwrap();
|
let mut settings = *self.settings.lock().unwrap();
|
||||||
settings.delay = cmp::min(settings.max_delay, settings.delay);
|
settings.delay = cmp::min(settings.max_delay, settings.delay);
|
||||||
|
@ -248,11 +251,11 @@ impl BaseTransformImpl<RsBaseTransform> for AudioEcho {
|
||||||
gst_audio::AUDIO_FORMAT_F64 => {
|
gst_audio::AUDIO_FORMAT_F64 => {
|
||||||
let mut data = map.as_mut_slice().as_mut_slice_of::<f64>().unwrap();
|
let mut data = map.as_mut_slice().as_mut_slice_of::<f64>().unwrap();
|
||||||
Self::process(data, state, &settings);
|
Self::process(data, state, &settings);
|
||||||
},
|
}
|
||||||
gst_audio::AUDIO_FORMAT_F32 => {
|
gst_audio::AUDIO_FORMAT_F32 => {
|
||||||
let mut data = map.as_mut_slice().as_mut_slice_of::<f32>().unwrap();
|
let mut data = map.as_mut_slice().as_mut_slice_of::<f32>().unwrap();
|
||||||
Self::process(data, state, &settings);
|
Self::process(data, state, &settings);
|
||||||
},
|
}
|
||||||
_ => return gst::FlowReturn::NotNegotiated,
|
_ => return gst::FlowReturn::NotNegotiated,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,7 @@ pub unsafe trait BaseSink
|
||||||
let parent_klass = (*klass).get_parent_class() as *const gst_base_ffi::GstBaseSinkClass;
|
let parent_klass = (*klass).get_parent_class() as *const gst_base_ffi::GstBaseSinkClass;
|
||||||
(*parent_klass)
|
(*parent_klass)
|
||||||
.event
|
.event
|
||||||
.map(|f| {
|
.map(|f| from_glib(f(self.to_glib_none().0, event.into_ptr())))
|
||||||
from_glib(f(self.to_glib_none().0, event.into_ptr()))
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue