diff --git a/examples/src/bin/thumbnail.rs b/examples/src/bin/thumbnail.rs index 021a12446..701dee3c8 100644 --- a/examples/src/bin/thumbnail.rs +++ b/examples/src/bin/thumbnail.rs @@ -109,8 +109,8 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result VideoInfoBuilder<'a> { } if let Some(par) = self.par { - info.par_n = *par.numer(); - info.par_d = *par.denom(); + info.par_n = par.numer(); + info.par_d = par.denom(); } if let Some(fps) = self.fps { - info.fps_n = *fps.numer(); - info.fps_d = *fps.denom(); + info.fps_n = fps.numer(); + info.fps_d = fps.denom(); } if let Some(offset) = self.offset { diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index c9e6cb71c..e2918ab12 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -46,8 +46,8 @@ impl VideoTimeCode { let mut v = mem::MaybeUninit::zeroed(); ffi::gst_video_time_code_init( v.as_mut_ptr(), - *fps.numer() as u32, - *fps.denom() as u32, + fps.numer() as u32, + fps.denom() as u32, latest_daily_jam.to_glib_none().0, flags.into_glib(), hours, @@ -71,13 +71,13 @@ impl VideoTimeCode { field_count: u32, ) -> Result { assert_initialized_main_thread!(); - assert!(*fps.denom() > 0); + assert!(fps.denom() > 0); unsafe { let mut v = mem::MaybeUninit::zeroed(); let res = ffi::gst_video_time_code_init_from_date_time_full( v.as_mut_ptr(), - *fps.numer() as u32, - *fps.denom() as u32, + fps.numer() as u32, + fps.denom() as u32, dt.to_glib_none().0, flags.into_glib(), field_count, @@ -97,8 +97,8 @@ impl VideoTimeCode { } pub fn set_fps(&mut self, fps: gst::Fraction) { - self.0.config.fps_n = *fps.numer() as u32; - self.0.config.fps_d = *fps.denom() as u32; + self.0.config.fps_n = fps.numer() as u32; + self.0.config.fps_d = fps.denom() as u32; } pub fn set_flags(&mut self, flags: VideoTimeCodeFlags) { diff --git a/gstreamer/src/param_spec.rs b/gstreamer/src/param_spec.rs index edd7c17b9..cebe4b630 100644 --- a/gstreamer/src/param_spec.rs +++ b/gstreamer/src/param_spec.rs @@ -61,12 +61,12 @@ impl GstParamSpecExt for glib::ParamSpec { name.to_glib_none().0, nick.to_glib_none().0, blurb.to_glib_none().0, - *min.numer(), - *min.denom(), - *max.numer(), - *max.denom(), - *default.numer(), - *default.denom(), + min.numer(), + min.denom(), + max.numer(), + max.denom(), + default.numer(), + default.denom(), flags.into_glib(), )) } diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 6f1e04356..75eb3dded 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -638,8 +638,8 @@ impl StructureRef { from_glib(ffi::gst_structure_fixate_field_nearest_fraction( &mut self.0, name.to_glib_none().0, - *target.numer(), - *target.denom(), + target.numer(), + target.denom(), )) } } diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index 05bb24526..aed2cacd9 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -28,6 +28,14 @@ impl Fraction { assert_initialized_main_thread!(); Rational32::approximate_float(x).map(|r| r.into()) } + + pub fn numer(&self) -> i32 { + *self.0.numer() + } + + pub fn denom(&self) -> i32 { + *self.0.denom() + } } impl fmt::Display for Fraction { @@ -263,7 +271,7 @@ impl glib::value::ToValue for Fraction { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { - ffi::gst_value_set_fraction(value.to_glib_none_mut().0, *self.numer(), *self.denom()); + ffi::gst_value_set_fraction(value.to_glib_none_mut().0, self.numer(), self.denom()); } value } @@ -526,10 +534,10 @@ impl glib::value::ToValue for FractionRange { unsafe { ffi::gst_value_set_fraction_range_full( value.to_glib_none_mut().0, - *self.min().numer(), - *self.min().denom(), - *self.max().numer(), - *self.max().denom(), + self.min().numer(), + self.min().denom(), + self.max().numer(), + self.max().denom(), ); } value