diff options
author | François Laignel <fengalin@free.fr> | 2022-10-17 20:48:43 +0300 |
---|---|---|
committer | François Laignel <fengalin@mailo.com> | 2022-10-18 13:36:59 +0300 |
commit | 8011eadfd2137b4c21fa8e6dfffe6891cb2be406 (patch) | |
tree | 1db00e75b8cc26362bda0cfc86fd424b27482440 /audio | |
parent | e66378d2544f9e39acfac18143cfac4afa8ae7ac (diff) |
Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audiofx/src/audioecho/imp.rs | 6 | ||||
-rw-r--r-- | audio/audiofx/src/audioloudnorm/imp.rs | 12 | ||||
-rw-r--r-- | audio/audiofx/src/audiornnoise/imp.rs | 4 | ||||
-rw-r--r-- | audio/audiofx/src/ebur128level/imp.rs | 5 | ||||
-rw-r--r-- | audio/audiofx/tests/audioloudnorm.rs | 2 |
5 files changed, 11 insertions, 18 deletions
diff --git a/audio/audiofx/src/audioecho/imp.rs b/audio/audiofx/src/audioecho/imp.rs index 8659cce9a..05e070093 100644 --- a/audio/audiofx/src/audioecho/imp.rs +++ b/audio/audiofx/src/audioecho/imp.rs @@ -137,14 +137,12 @@ impl ObjectImpl for AudioEcho { "max-delay" => { let mut settings = self.settings.lock().unwrap(); if self.state.lock().unwrap().is_none() { - settings.max_delay = - gst::ClockTime::from_nseconds(value.get().expect("type checked upstream")); + settings.max_delay = value.get::<u64>().unwrap().nseconds(); } } "delay" => { let mut settings = self.settings.lock().unwrap(); - settings.delay = - gst::ClockTime::from_nseconds(value.get().expect("type checked upstream")); + settings.delay = value.get::<u64>().unwrap().nseconds(); } "intensity" => { let mut settings = self.settings.lock().unwrap(); diff --git a/audio/audiofx/src/audioloudnorm/imp.rs b/audio/audiofx/src/audioloudnorm/imp.rs index 6bbc1c1e7..b55e70134 100644 --- a/audio/audiofx/src/audioloudnorm/imp.rs +++ b/audio/audiofx/src/audioloudnorm/imp.rs @@ -632,9 +632,7 @@ impl State { // PTS is 2.9s seconds before the input PTS as we buffer 3s of samples and just // outputted here the first 100ms of that. - let pts = pts - .into() - .map(|pts| pts + 100 * gst::ClockTime::MSECOND - 3 * gst::ClockTime::SECOND); + let pts = pts.into().map(|pts| pts + 100.mseconds() - 3.seconds()); Ok((outbuf, pts)) } @@ -766,9 +764,7 @@ impl State { // PTS is 2.9s seconds before the input PTS as we buffer 3s of samples and just // outputted here the first 100ms of that. - let pts = pts - .into() - .map(|pts| pts + 100 * gst::ClockTime::MSECOND - 3 * gst::ClockTime::SECOND); + let pts = pts.into().map(|pts| pts + 100.mseconds() - 3.seconds()); Ok((outbuf, pts)) } @@ -1674,8 +1670,8 @@ impl AudioLoudNorm { let (live, min_latency, max_latency) = peer_query.result(); q.set( live, - min_latency + 3 * gst::ClockTime::SECOND, - max_latency.opt_add(3 * gst::ClockTime::SECOND), + min_latency + 3.seconds(), + max_latency.opt_add(3.seconds()), ); true } else { diff --git a/audio/audiofx/src/audiornnoise/imp.rs b/audio/audiofx/src/audiornnoise/imp.rs index 321bf40a7..07b5b348d 100644 --- a/audio/audiofx/src/audiornnoise/imp.rs +++ b/audio/audiofx/src/audiornnoise/imp.rs @@ -340,8 +340,8 @@ impl BaseTransformImpl for AudioRNNoise { max.display(), ); - min += gst::ClockTime::from_seconds((FRAME_SIZE / 48000) as u64); - max = max.opt_add(gst::ClockTime::from_seconds((FRAME_SIZE / 48000) as u64)); + min += ((FRAME_SIZE / 48000) as u64).seconds(); + max = max.opt_add(((FRAME_SIZE / 48000) as u64).seconds()); q.set(live, min, max); return true; } diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index dd0135bff..1271bfb40 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -195,8 +195,7 @@ impl ObjectImpl for EbuR128Level { settings.post_messages = post_messages; } "interval" => { - let interval = - gst::ClockTime::from_nseconds(value.get().expect("type checked upstream")); + let interval = value.get::<u64>().unwrap().nseconds(); gst::info!( CAT, imp: self, @@ -455,7 +454,7 @@ impl BaseTransformImpl for EbuR128Level { gst::FlowError::Error })?; - state.interval_frames_remaining -= gst::ClockTime::from_nseconds(to_process); + state.interval_frames_remaining -= to_process.nseconds(); state.num_frames += to_process; // The timestamp we report in messages is always the timestamp until which measurements diff --git a/audio/audiofx/tests/audioloudnorm.rs b/audio/audiofx/tests/audioloudnorm.rs index e3999211b..3540c9f90 100644 --- a/audio/audiofx/tests/audioloudnorm.rs +++ b/audio/audiofx/tests/audioloudnorm.rs @@ -151,7 +151,7 @@ fn run_test( num_samples += data.len() / channels as usize; r128.add_frames_f64(data).unwrap(); - expected_ts += gst::ClockTime::from_seconds(data.len() as u64 / channels as u64) / 192_000; + expected_ts += (data.len() as u64 / channels as u64).seconds() / 192_000; } assert_eq!( |