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 /text/wrap | |
parent | e66378d2544f9e39acfac18143cfac4afa8ae7ac (diff) |
Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
Diffstat (limited to 'text/wrap')
-rw-r--r-- | text/wrap/src/gsttextwrap/imp.rs | 3 | ||||
-rw-r--r-- | text/wrap/tests/textwrap.rs | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs index c1aab864..a6bfaa62 100644 --- a/text/wrap/src/gsttextwrap/imp.rs +++ b/text/wrap/src/gsttextwrap/imp.rs @@ -509,8 +509,7 @@ impl ObjectImpl for TextWrap { "accumulate-time" => { let mut settings = self.settings.lock().unwrap(); let old_accumulate_time = settings.accumulate_time; - settings.accumulate_time = - gst::ClockTime::from_nseconds(value.get().expect("type checked upstream")); + settings.accumulate_time = value.get::<u64>().unwrap().nseconds(); if settings.accumulate_time != old_accumulate_time { gst::debug!( CAT, diff --git a/text/wrap/tests/textwrap.rs b/text/wrap/tests/textwrap.rs index a385f89e..9adf1cc4 100644 --- a/text/wrap/tests/textwrap.rs +++ b/text/wrap/tests/textwrap.rs @@ -38,8 +38,8 @@ fn test_columns() { let buf = { let mut buf = gst::Buffer::from_mut_slice(Vec::from(&input[..])); let buf_ref = buf.get_mut().unwrap(); - buf_ref.set_pts(gst::ClockTime::from_seconds(0)); - buf_ref.set_duration(gst::ClockTime::from_seconds(2)); + buf_ref.set_pts(gst::ClockTime::ZERO); + buf_ref.set_duration(2.seconds()); buf }; @@ -48,7 +48,7 @@ fn test_columns() { let buf = h.pull().expect("Couldn't pull buffer"); assert_eq!(buf.pts(), Some(gst::ClockTime::ZERO)); - assert_eq!(buf.duration(), Some(2 * gst::ClockTime::SECOND)); + assert_eq!(buf.duration(), Some(2.seconds())); let map = buf.map_readable().expect("Couldn't map buffer readable"); @@ -77,8 +77,8 @@ fn test_lines() { let buf = { let mut buf = gst::Buffer::from_mut_slice(Vec::from(&input[..])); let buf_ref = buf.get_mut().unwrap(); - buf_ref.set_pts(gst::ClockTime::from_seconds(0)); - buf_ref.set_duration(gst::ClockTime::from_seconds(2)); + buf_ref.set_pts(gst::ClockTime::ZERO); + buf_ref.set_duration(2.seconds()); buf }; |