*: use Into<Rational> instead of Rational for setters

This commit is contained in:
meh 2015-08-25 15:53:46 +02:00
parent 2baf1deaab
commit 62acd3ef02
3 changed files with 8 additions and 8 deletions

View File

@ -88,10 +88,10 @@ impl Encoder {
} }
} }
pub fn set_frame_rate(&mut self, value: Option<Rational>) { pub fn set_frame_rate<R: Into<Rational>>(&mut self, value: Option<R>) {
unsafe { unsafe {
if let Some(value) = value { if let Some(value) = value {
(*self.as_mut_ptr()).framerate = value.into(); (*self.as_mut_ptr()).framerate = value.into().into();
} }
else { else {
(*self.as_mut_ptr()).framerate.num = 0; (*self.as_mut_ptr()).framerate.num = 0;
@ -100,9 +100,9 @@ impl Encoder {
} }
} }
pub fn set_time_base(&mut self, value: Rational) { pub fn set_time_base<R: Into<Rational>>(&mut self, value: R) {
unsafe { unsafe {
(*self.as_mut_ptr()).time_base = value.into(); (*self.as_mut_ptr()).time_base = value.into().into();
} }
} }
} }

View File

@ -118,9 +118,9 @@ impl Video {
} }
} }
pub fn set_aspect_ratio(&mut self, value: Rational) { pub fn set_aspect_ratio<R: Into<Rational>>(&mut self, value: R) {
unsafe { unsafe {
(*self.as_mut_ptr()).sample_aspect_ratio = value.into(); (*self.as_mut_ptr()).sample_aspect_ratio = value.into().into();
} }
} }

View File

@ -25,9 +25,9 @@ impl<'a> StreamMut<'a> {
} }
impl<'a> StreamMut<'a> { impl<'a> StreamMut<'a> {
pub fn set_frame_rate(&mut self, value: Rational) { pub fn set_frame_rate<R: Into<Rational>>(&mut self, value: R) {
unsafe { unsafe {
av_stream_set_r_frame_rate(self.as_mut_ptr(), value.into()); av_stream_set_r_frame_rate(self.as_mut_ptr(), value.into().into());
} }
} }
} }