util/rational: some more refactoring
This commit is contained in:
@ -105,14 +105,14 @@ impl Decoder {
|
||||
None
|
||||
}
|
||||
else {
|
||||
Some(Rational(value))
|
||||
Some(Rational::from(value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time_base(&self) -> Rational {
|
||||
unsafe {
|
||||
Rational((*self.as_ptr()).time_base)
|
||||
Rational::from((*self.as_ptr()).time_base)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ impl Video {
|
||||
|
||||
pub fn aspect_ratio(&self) -> Rational {
|
||||
unsafe {
|
||||
Rational((*self.as_ptr()).sample_aspect_ratio)
|
||||
Rational::from((*self.as_ptr()).sample_aspect_ratio)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ impl Encoder {
|
||||
pub fn set_frame_rate(&mut self, value: Option<Rational>) {
|
||||
unsafe {
|
||||
if let Some(value) = value {
|
||||
(*self.as_mut_ptr()).framerate = value.0;
|
||||
(*self.as_mut_ptr()).framerate = value.into();
|
||||
}
|
||||
else {
|
||||
(*self.as_mut_ptr()).framerate.num = 0;
|
||||
@ -102,7 +102,7 @@ impl Encoder {
|
||||
|
||||
pub fn set_time_base(&mut self, value: Rational) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).time_base = value.0;
|
||||
(*self.as_mut_ptr()).time_base = value.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ impl Video {
|
||||
|
||||
pub fn set_aspect_ratio(&mut self, value: Rational) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).sample_aspect_ratio = value.0;
|
||||
(*self.as_mut_ptr()).sample_aspect_ratio = value.into();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user