From 34ff7bafbf4084e271cb5aa4659c935ab448eca6 Mon Sep 17 00:00:00 2001 From: lummax Date: Fri, 18 Sep 2015 21:03:15 +0200 Subject: [PATCH] codec/decoder: add `time_base()` method --- src/codec/decoder/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/codec/decoder/mod.rs b/src/codec/decoder/mod.rs index 95bc4b0..4ef54b6 100644 --- a/src/codec/decoder/mod.rs +++ b/src/codec/decoder/mod.rs @@ -24,7 +24,7 @@ use std::ops::{Deref, DerefMut}; use ffi::*; use super::{Id, Context}; -use ::{Codec, Error, Discard, Dictionary}; +use ::{Codec, Error, Discard, Rational, Dictionary}; pub struct Decoder(pub Context); @@ -127,6 +127,12 @@ impl Decoder { (*self.as_mut_ptr()).skip_frame = value.into(); } } + + pub fn time_base(&self) -> Rational { + unsafe { + Rational::from((*self.as_ptr()).time_base) + } + } } impl Deref for Decoder {