util/frame: add Frame::aspect_ratio

This commit is contained in:
meh 2015-05-12 20:03:16 +02:00
parent 47f010a3cb
commit 7c213c2516

View File

@ -7,7 +7,7 @@ use std::mem;
use std::ops::Deref; use std::ops::Deref;
use ffi::*; use ffi::*;
use ::{Dictionary, ColorSpace, ColorRange}; use ::{Dictionary, ColorSpace, ColorRange, Rational};
use ::util::pixel_format::PixelFormat; use ::util::pixel_format::PixelFormat;
use ::util::sample_format::SampleFormat; use ::util::sample_format::SampleFormat;
use ::picture; use ::picture;
@ -299,6 +299,12 @@ impl Video {
av_frame_set_color_range(self.0.ptr, value.into()); av_frame_set_color_range(self.0.ptr, value.into());
} }
} }
pub fn aspect_ratio(&self) -> Rational {
unsafe {
Rational((*self.0.ptr).sample_aspect_ratio)
}
}
} }
impl Into<Video> for Frame { impl Into<Video> for Frame {