From 7c213c25164ad7f8a8ebd046745bc0f4d83fc8bc Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 12 May 2015 20:03:16 +0200 Subject: [PATCH] util/frame: add Frame::aspect_ratio --- src/util/frame/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/frame/mod.rs b/src/util/frame/mod.rs index 5dcf75f..03e2f31 100644 --- a/src/util/frame/mod.rs +++ b/src/util/frame/mod.rs @@ -7,7 +7,7 @@ use std::mem; use std::ops::Deref; use ffi::*; -use ::{Dictionary, ColorSpace, ColorRange}; +use ::{Dictionary, ColorSpace, ColorRange, Rational}; use ::util::pixel_format::PixelFormat; use ::util::sample_format::SampleFormat; use ::picture; @@ -299,6 +299,12 @@ impl Video { 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