util/rational: some more refactoring

This commit is contained in:
meh
2015-06-25 22:23:33 +02:00
parent 23b414b01e
commit bb4263b7be
7 changed files with 38 additions and 26 deletions

View File

@ -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)
}
}
}

View File

@ -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)
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}