fix(Rational): remove From<Rational> 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".
This commit is contained in:
tilpner
2022-06-06 16:58:33 +02:00
parent 5928ce801f
commit 2f51d8671b
-7
View File
@@ -97,13 +97,6 @@ impl From<Rational> for f64 {
}
}
impl From<Rational> 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)