From 2d17d46c5087741f9d98645e9185098571371c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Mon, 18 Jul 2022 22:27:29 +0200 Subject: [PATCH] gst: use Signed where applicable --- gstreamer/src/segment.rs | 42 +++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index fc970ef27..ad600ecd6 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -199,23 +199,21 @@ impl FormattedSegment { pub fn position_from_running_time_full( &self, running_time: impl CompatibleFormattedValue, - ) -> (i32, T::FullRange) { + ) -> ::Signed { let running_time = running_time .try_into_checked_explicit(self.format()) .unwrap(); unsafe { let mut position = mem::MaybeUninit::uninit(); - let ret = ffi::gst_segment_position_from_running_time_full( + let sign = ffi::gst_segment_position_from_running_time_full( &self.0, self.format().into_glib(), running_time.into_raw_value() as u64, position.as_mut_ptr(), ); - ( - ret, - T::FullRange::from_raw(self.format(), position.assume_init() as i64), - ) + + T::FullRange::from_raw(self.format(), position.assume_init() as i64).into_signed(sign) } } @@ -244,23 +242,21 @@ impl FormattedSegment { pub fn position_from_stream_time_full( &self, stream_time: impl CompatibleFormattedValue, - ) -> (i32, T::FullRange) { + ) -> ::Signed { let stream_time = stream_time .try_into_checked_explicit(self.format()) .unwrap(); unsafe { let mut position = mem::MaybeUninit::uninit(); - let ret = ffi::gst_segment_position_from_stream_time_full( + let sign = ffi::gst_segment_position_from_stream_time_full( &self.0, self.format().into_glib(), stream_time.into_raw_value() as u64, position.as_mut_ptr(), ); - ( - ret, - T::FullRange::from_raw(self.format(), position.assume_init() as i64), - ) + + T::FullRange::from_raw(self.format(), position.assume_init() as i64).into_signed(sign) } } @@ -305,21 +301,20 @@ impl FormattedSegment { pub fn to_running_time_full( &self, position: impl CompatibleFormattedValue, - ) -> (i32, T::FullRange) { + ) -> ::Signed { let position = position.try_into_checked_explicit(self.format()).unwrap(); unsafe { let mut running_time = mem::MaybeUninit::uninit(); - let ret = ffi::gst_segment_to_running_time_full( + let sign = ffi::gst_segment_to_running_time_full( &self.0, self.format().into_glib(), position.into_raw_value() as u64, running_time.as_mut_ptr(), ); - ( - ret, - T::FullRange::from_raw(self.format(), running_time.assume_init() as i64), - ) + + T::FullRange::from_raw(self.format(), running_time.assume_init() as i64) + .into_signed(sign) } } @@ -343,21 +338,20 @@ impl FormattedSegment { pub fn to_stream_time_full( &self, position: impl CompatibleFormattedValue, - ) -> (i32, T::FullRange) { + ) -> ::Signed { let position = position.try_into_checked_explicit(self.format()).unwrap(); unsafe { let mut stream_time = mem::MaybeUninit::uninit(); - let ret = ffi::gst_segment_to_stream_time_full( + let sign = ffi::gst_segment_to_stream_time_full( &self.0, self.format().into_glib(), position.into_raw_value() as u64, stream_time.as_mut_ptr(), ); - ( - ret, - T::FullRange::from_raw(self.format(), stream_time.assume_init() as i64), - ) + + T::FullRange::from_raw(self.format(), stream_time.assume_init() as i64) + .into_signed(sign) } }