mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-04 17:58:11 +00:00
media: ffmpeg: Add setters for AVCodecContext properties.
Add setters for time_base, bit_rate and rc_max_rate for use in encoder. BUG=b:239897269 TEST=cargo test --features "video-decoder,ffmpeg" -p devices -p ffmpeg Change-Id: If006abf5b32cdb740c33075f8d5f480c65c20806 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3920258 Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
parent
cb509c8972
commit
93bac69f36
2 changed files with 20 additions and 0 deletions
|
@ -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`.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue