pub struct BitrateAllocator { /* private fields */ }Expand description
Bitrate allocator for distributing bits across frames.
Implementations§
Source§impl BitrateAllocator
impl BitrateAllocator
Sourcepub fn new(target_bitrate: u64, framerate: f64, gop_length: u32) -> Self
pub fn new(target_bitrate: u64, framerate: f64, gop_length: u32) -> Self
Create a new bitrate allocator.
Sourcepub fn set_strategy(&mut self, strategy: AllocationStrategy)
pub fn set_strategy(&mut self, strategy: AllocationStrategy)
Set allocation strategy.
Sourcepub fn set_i_p_ratio(&mut self, ratio: f32)
pub fn set_i_p_ratio(&mut self, ratio: f32)
Set I/P frame bit ratio.
Sourcepub fn set_p_b_ratio(&mut self, ratio: f32)
pub fn set_p_b_ratio(&mut self, ratio: f32)
Set P/B frame bit ratio.
Sourcepub fn set_complexity_weight(&mut self, weight: f32)
pub fn set_complexity_weight(&mut self, weight: f32)
Set complexity weight factor.
Sourcepub fn set_vbv_buffer_size(&mut self, size: u64)
pub fn set_vbv_buffer_size(&mut self, size: u64)
Set VBV buffer size for constrained allocation.
Sourcepub fn allocate_frame_bits(
&self,
frame_type: FrameType,
complexity: f32,
frame_in_gop: u32,
) -> AllocationResult
pub fn allocate_frame_bits( &self, frame_type: FrameType, complexity: f32, frame_in_gop: u32, ) -> AllocationResult
Calculate target bits for a frame.
Sourcepub fn update(&mut self, complexity: f32, bits_used: u64)
pub fn update(&mut self, complexity: f32, bits_used: u64)
Update allocator with actual frame results.
Sourcepub fn start_new_gop(&mut self)
pub fn start_new_gop(&mut self)
Start a new GOP.
Sourcepub fn gop_status(&self) -> GopAllocationStatus
pub fn gop_status(&self) -> GopAllocationStatus
Get current GOP allocation status.
Trait Implementations§
Source§impl Clone for BitrateAllocator
impl Clone for BitrateAllocator
Source§fn clone(&self) -> BitrateAllocator
fn clone(&self) -> BitrateAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BitrateAllocator
impl RefUnwindSafe for BitrateAllocator
impl Send for BitrateAllocator
impl Sync for BitrateAllocator
impl Unpin for BitrateAllocator
impl UnsafeUnpin for BitrateAllocator
impl UnwindSafe for BitrateAllocator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more