mirror of
https://github.com/encounter/rust-ffmpeg-zmwangx.git
synced 2026-07-10 21:18:40 -07:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user