From 2f51d8671be5391d8985cd1c7ed6b677cbf7fd5a Mon Sep 17 00:00:00 2001 From: tilpner Date: Mon, 6 Jun 2022 16:29:52 +0200 Subject: [PATCH] fix(Rational): remove From for u32 impl This From impl used av_q2intfloat, which does not simply convert a Rational into the closest u32 with some rounding, as one might expect from skimming the documentation. Use ffmpeg::sys::av_q2intfloat if you really want "a IEEE 32-bit float expressed in fixed-point format". --- src/util/rational.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/util/rational.rs b/src/util/rational.rs index b0f2d38..3980d8b 100644 --- a/src/util/rational.rs +++ b/src/util/rational.rs @@ -97,13 +97,6 @@ impl From for f64 { } } -impl From for u32 { - #[inline] - fn from(value: Rational) -> u32 { - unsafe { av_q2intfloat(value.into()) } - } -} - impl From<(i32, i32)> for Rational { fn from((num, den): (i32, i32)) -> Rational { Rational::new(num, den)