Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/text
diff options
context:
space:
mode:
authorFrançois Laignel <fengalin@free.fr>2022-10-17 20:48:43 +0300
committerFrançois Laignel <fengalin@mailo.com>2022-10-18 13:36:59 +0300
commit8011eadfd2137b4c21fa8e6dfffe6891cb2be406 (patch)
tree1db00e75b8cc26362bda0cfc86fd424b27482440 /text
parente66378d2544f9e39acfac18143cfac4afa8ae7ac (diff)
Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
Diffstat (limited to 'text')
-rw-r--r--text/json/tests/json.rs10
-rw-r--r--text/regex/tests/regex.rs6
-rw-r--r--text/wrap/src/gsttextwrap/imp.rs3
-rw-r--r--text/wrap/tests/textwrap.rs10
4 files changed, 15 insertions, 14 deletions
diff --git a/text/json/tests/json.rs b/text/json/tests/json.rs
index 1bfe702a0..759649b61 100644
--- a/text/json/tests/json.rs
+++ b/text/json/tests/json.rs
@@ -8,6 +8,8 @@
#![allow(clippy::single_match)]
+use gst::prelude::*;
+
fn init() {
use std::sync::Once;
static INIT: Once = Once::new();
@@ -31,8 +33,8 @@ fn test_enc() {
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
};
@@ -47,7 +49,7 @@ fn test_enc() {
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");
assert_eq!(
std::str::from_utf8(map.as_ref()),
@@ -93,6 +95,6 @@ fn test_parse() {
let buf = h.pull().expect("Couldn't pull buffer");
let map = buf.map_readable().expect("Couldn't map buffer readable");
assert_eq!(buf.pts(), Some(gst::ClockTime::ZERO));
- assert_eq!(buf.duration(), Some(2 * gst::ClockTime::SECOND));
+ assert_eq!(buf.duration(), Some(2.seconds()));
assert_eq!(std::str::from_utf8(map.as_ref()), Ok("{\"foo\":42}"));
}
diff --git a/text/regex/tests/regex.rs b/text/regex/tests/regex.rs
index e9c2d04ad..25871c4b3 100644
--- a/text/regex/tests/regex.rs
+++ b/text/regex/tests/regex.rs
@@ -46,8 +46,8 @@ fn test_replace_all() {
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
};
@@ -56,7 +56,7 @@ fn test_replace_all() {
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");
diff --git a/text/wrap/src/gsttextwrap/imp.rs b/text/wrap/src/gsttextwrap/imp.rs
index c1aab864e..a6bfaa62f 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 a385f89e9..9adf1cc4f 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
};