diff --git a/src/codec/context.rs b/src/codec/context.rs index 79407c0..d4432aa 100644 --- a/src/codec/context.rs +++ b/src/codec/context.rs @@ -5,7 +5,7 @@ use libc::c_int; #[cfg(feature = "ffmpeg_3_1")] use super::Parameters; use super::{decoder::Decoder, encoder::Encoder, threading, Compliance, Debug, Flags, Id}; -use crate::{ffi::*, media, Codec, Error}; +use crate::{ffi::*, media, Codec, Error, Rational}; pub struct Context { ptr: *mut AVCodecContext, @@ -121,6 +121,16 @@ impl Context { } } } + + pub fn time_base(&self) -> Rational { + unsafe { Rational::from((*self.as_ptr()).time_base) } + } + + pub fn set_time_base>(&mut self, value: R) { + unsafe { + (*self.as_mut_ptr()).time_base = value.into().into(); + } + } } impl Default for Context { diff --git a/src/codec/encoder/encoder.rs b/src/codec/encoder/encoder.rs index 57b5ac4..80672c6 100644 --- a/src/codec/encoder/encoder.rs +++ b/src/codec/encoder/encoder.rs @@ -134,16 +134,6 @@ impl Encoder { } } - pub fn time_base(&self) -> Rational { - unsafe { Rational::from((*self.as_ptr()).time_base) } - } - - pub fn set_time_base>(&mut self, value: R) { - unsafe { - (*self.as_mut_ptr()).time_base = value.into().into(); - } - } - pub fn set_frame_rate>(&mut self, value: Option) { unsafe { if let Some(value) = value {