diff options
author | François Laignel <fengalin@free.fr> | 2022-10-11 13:51:00 +0300 |
---|---|---|
committer | François Laignel <fengalin@free.fr> | 2022-10-11 16:06:53 +0300 |
commit | bc5b51687dacd2a1e4dadae8c4426a253a825ddf (patch) | |
tree | a838076ee22c967a683093c4e5a3553d79dd99d8 /video | |
parent | bd14e476f16622d59a3a30d762b7f893c7c74614 (diff) |
fix formatted values constructors
In restrospect, building formatted values using operations on the
`ONE` constant doesn't seem idiomatic. This commit uses new panicking
constructors instead.
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1122
Diffstat (limited to 'video')
-rw-r--r-- | video/cdg/src/cdgparse/imp.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/video/cdg/src/cdgparse/imp.rs b/video/cdg/src/cdgparse/imp.rs index 6bcd4158..12ea2552 100644 --- a/video/cdg/src/cdgparse/imp.rs +++ b/video/cdg/src/cdgparse/imp.rs @@ -100,13 +100,14 @@ fn bytes_to_time(bytes: Bytes) -> gst::ClockTime { } fn time_to_bytes(time: gst::ClockTime) -> Bytes { - time.nseconds() - .mul_div_round( - CDG_PACKET_PERIOD * CDG_PACKET_SIZE as u64, - *gst::ClockTime::SECOND, - ) - .unwrap() - * Bytes::ONE + Bytes::from_u64( + time.nseconds() + .mul_div_round( + CDG_PACKET_PERIOD * CDG_PACKET_SIZE as u64, + *gst::ClockTime::SECOND, + ) + .unwrap(), + ) } impl BaseParseImpl for CdgParse { @@ -190,7 +191,7 @@ impl BaseParseImpl for CdgParse { } }; - let pts = bytes_to_time(frame.offset() * Bytes::ONE); + let pts = bytes_to_time(Bytes::from_u64(frame.offset())); let buffer = frame.buffer_mut().unwrap(); buffer.set_pts(pts); |