diff --git a/media/ffmpeg/src/avcodec.rs b/media/ffmpeg/src/avcodec.rs index 2991adb43b..9db884c067 100644 --- a/media/ffmpeg/src/avcodec.rs +++ b/media/ffmpeg/src/avcodec.rs @@ -548,6 +548,24 @@ impl AvCodecContext { // Safe because the context is valid through the life of this object. AvError::result(unsafe { ffi::avcodec_send_frame(self.0, std::ptr::null()) }) } + + /// Set the time base for this context. + pub fn set_time_base(&mut self, time_base: AVRational) { + let context = unsafe { &mut *(self.0) }; + context.time_base = time_base; + } + + /// Set the bit rate for this context. + pub fn set_bit_rate(&mut self, bit_rate: u64) { + let context = unsafe { &mut *(self.0) }; + context.bit_rate = bit_rate as _; + } + + /// Set the max bit rate (rc_max_rate) for this context. + pub fn set_max_bit_rate(&mut self, bit_rate: u64) { + let context = unsafe { &mut *(self.0) }; + context.rc_max_rate = bit_rate as _; + } } /// Trait for types that can be used as data provider for a `AVBuffer`. diff --git a/media/ffmpeg/src/lib.rs b/media/ffmpeg/src/lib.rs index 19548b86fe..871b4e7469 100644 --- a/media/ffmpeg/src/lib.rs +++ b/media/ffmpeg/src/lib.rs @@ -30,3 +30,5 @@ pub use ffi::FF_PROFILE_VP9_0; pub use ffi::FF_PROFILE_VP9_1; pub use ffi::FF_PROFILE_VP9_2; pub use ffi::FF_PROFILE_VP9_3; + +pub use ffi::AVRational;