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 /video/cdg | |
parent | e66378d2544f9e39acfac18143cfac4afa8ae7ac (diff) |
Use new format constructors
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1128
Diffstat (limited to 'video/cdg')
-rw-r--r-- | video/cdg/src/cdgparse/imp.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/video/cdg/src/cdgparse/imp.rs b/video/cdg/src/cdgparse/imp.rs index 12ea25524..4cf32b5f9 100644 --- a/video/cdg/src/cdgparse/imp.rs +++ b/video/cdg/src/cdgparse/imp.rs @@ -92,22 +92,20 @@ impl ElementImpl for CdgParse { } fn bytes_to_time(bytes: Bytes) -> gst::ClockTime { - let nb = *bytes / CDG_PACKET_SIZE as u64; - gst::ClockTime::from_nseconds( - nb.mul_div_round(*gst::ClockTime::SECOND, CDG_PACKET_PERIOD) - .unwrap(), - ) + let nb = bytes / CDG_PACKET_SIZE as u64; + nb.mul_div_round(*gst::ClockTime::SECOND, CDG_PACKET_PERIOD) + .unwrap() + .nseconds() } fn time_to_bytes(time: gst::ClockTime) -> Bytes { - Bytes::from_u64( - time.nseconds() - .mul_div_round( - CDG_PACKET_PERIOD * CDG_PACKET_SIZE as u64, - *gst::ClockTime::SECOND, - ) - .unwrap(), - ) + time.nseconds() + .mul_div_round( + CDG_PACKET_PERIOD * CDG_PACKET_SIZE as u64, + *gst::ClockTime::SECOND, + ) + .unwrap() + .bytes() } impl BaseParseImpl for CdgParse { @@ -191,7 +189,7 @@ impl BaseParseImpl for CdgParse { } }; - let pts = bytes_to_time(Bytes::from_u64(frame.offset())); + let pts = bytes_to_time(frame.offset().bytes()); let buffer = frame.buffer_mut().unwrap(); buffer.set_pts(pts); |