gstreamer: Add new Fraction::simplify() bindings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1286>
This commit is contained in:
Sebastian Dröge 2023-07-04 17:19:52 +03:00
parent f806967a2e
commit 354f072ff3
2 changed files with 17 additions and 0 deletions

View file

@ -112,6 +112,10 @@ status = "generate"
pattern = "util_fraction_.*"
ignore = true
[[object.function]]
name = "util_simplify_fraction"
ignore = true
[[object.function]]
pattern = "util_greatest_.*"
ignore = true

View file

@ -34,6 +34,19 @@ impl Fraction {
pub fn denom(&self) -> i32 {
*self.0.denom()
}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_util_simplify_fraction")]
pub fn simplify(&mut self, n_terms: u32, threshold: u32) {
skip_assert_initialized!();
unsafe {
let mut num = self.numer();
let mut den = self.denom();
ffi::gst_util_simplify_fraction(&mut num, &mut den, n_terms, threshold);
*self = Self::new(num, den);
}
}
}
impl fmt::Display for Fraction {