mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-05 09:10:22 +00:00
gst: use Signed where applicable
This commit is contained in:
parent
414222aa99
commit
2d17d46c50
1 changed files with 18 additions and 24 deletions
|
@ -199,23 +199,21 @@ impl<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
pub fn position_from_running_time_full(
|
pub fn position_from_running_time_full(
|
||||||
&self,
|
&self,
|
||||||
running_time: impl CompatibleFormattedValue<T>,
|
running_time: impl CompatibleFormattedValue<T>,
|
||||||
) -> (i32, T::FullRange) {
|
) -> <T::FullRange as FormattedValue>::Signed {
|
||||||
let running_time = running_time
|
let running_time = running_time
|
||||||
.try_into_checked_explicit(self.format())
|
.try_into_checked_explicit(self.format())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut position = mem::MaybeUninit::uninit();
|
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.0,
|
||||||
self.format().into_glib(),
|
self.format().into_glib(),
|
||||||
running_time.into_raw_value() as u64,
|
running_time.into_raw_value() as u64,
|
||||||
position.as_mut_ptr(),
|
position.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(
|
|
||||||
ret,
|
T::FullRange::from_raw(self.format(), position.assume_init() as i64).into_signed(sign)
|
||||||
T::FullRange::from_raw(self.format(), position.assume_init() as i64),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,23 +242,21 @@ impl<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
pub fn position_from_stream_time_full(
|
pub fn position_from_stream_time_full(
|
||||||
&self,
|
&self,
|
||||||
stream_time: impl CompatibleFormattedValue<T>,
|
stream_time: impl CompatibleFormattedValue<T>,
|
||||||
) -> (i32, T::FullRange) {
|
) -> <T::FullRange as FormattedValue>::Signed {
|
||||||
let stream_time = stream_time
|
let stream_time = stream_time
|
||||||
.try_into_checked_explicit(self.format())
|
.try_into_checked_explicit(self.format())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut position = mem::MaybeUninit::uninit();
|
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.0,
|
||||||
self.format().into_glib(),
|
self.format().into_glib(),
|
||||||
stream_time.into_raw_value() as u64,
|
stream_time.into_raw_value() as u64,
|
||||||
position.as_mut_ptr(),
|
position.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
(
|
|
||||||
ret,
|
T::FullRange::from_raw(self.format(), position.assume_init() as i64).into_signed(sign)
|
||||||
T::FullRange::from_raw(self.format(), position.assume_init() as i64),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,21 +301,20 @@ impl<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
pub fn to_running_time_full(
|
pub fn to_running_time_full(
|
||||||
&self,
|
&self,
|
||||||
position: impl CompatibleFormattedValue<T>,
|
position: impl CompatibleFormattedValue<T>,
|
||||||
) -> (i32, T::FullRange) {
|
) -> <T::FullRange as FormattedValue>::Signed {
|
||||||
let position = position.try_into_checked_explicit(self.format()).unwrap();
|
let position = position.try_into_checked_explicit(self.format()).unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut running_time = mem::MaybeUninit::uninit();
|
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.0,
|
||||||
self.format().into_glib(),
|
self.format().into_glib(),
|
||||||
position.into_raw_value() as u64,
|
position.into_raw_value() as u64,
|
||||||
running_time.as_mut_ptr(),
|
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<T: FormattedValueIntrinsic> FormattedSegment<T> {
|
||||||
pub fn to_stream_time_full(
|
pub fn to_stream_time_full(
|
||||||
&self,
|
&self,
|
||||||
position: impl CompatibleFormattedValue<T>,
|
position: impl CompatibleFormattedValue<T>,
|
||||||
) -> (i32, T::FullRange) {
|
) -> <T::FullRange as FormattedValue>::Signed {
|
||||||
let position = position.try_into_checked_explicit(self.format()).unwrap();
|
let position = position.try_into_checked_explicit(self.format()).unwrap();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut stream_time = mem::MaybeUninit::uninit();
|
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.0,
|
||||||
self.format().into_glib(),
|
self.format().into_glib(),
|
||||||
position.into_raw_value() as u64,
|
position.into_raw_value() as u64,
|
||||||
stream_time.as_mut_ptr(),
|
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)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue