mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-22 16:16:37 +00:00
gstreamer: Add new Fraction::simplify()
bindings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1286>
This commit is contained in:
parent
f806967a2e
commit
354f072ff3
2 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue