pub struct BufferModel { /* private fields */ }Expand description
Buffer model for HRD (Hypothetical Reference Decoder) compliance.
Implements the CPB (Coded Picture Buffer) model as defined in video coding standards for streaming compliance.
Implementations§
Source§impl BufferModel
impl BufferModel
Sourcepub fn new(
cpb_size: u64,
bitrate: u64,
framerate: f64,
initial_delay: f64,
) -> Self
pub fn new( cpb_size: u64, bitrate: u64, framerate: f64, initial_delay: f64, ) -> Self
Create a new buffer model.
Sourcepub fn fill_for_frame(&mut self)
pub fn fill_for_frame(&mut self)
Fill buffer at constant bitrate for one frame duration.
Sourcepub fn remove_frame_bits(&mut self, bits: u64)
pub fn remove_frame_bits(&mut self, bits: u64)
Remove bits for an encoded frame.
Sourcepub fn encode_frame(&mut self, bits: u64)
pub fn encode_frame(&mut self, bits: u64)
Simulate encoding a frame with the given bits.
Fills the buffer, then removes the frame bits.
Sourcepub fn max_frame_bits(&self) -> u64
pub fn max_frame_bits(&self) -> u64
Get maximum bits allowed for next frame (before overflow).
Sourcepub fn min_frame_bits(&self) -> u64
pub fn min_frame_bits(&self) -> u64
Get minimum bits required for next frame (before underflow).
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if the buffer is in a healthy state.
Sourcepub fn overflow_count(&self) -> u64
pub fn overflow_count(&self) -> u64
Get overflow count.
Sourcepub fn underflow_count(&self) -> u64
pub fn underflow_count(&self) -> u64
Get underflow count.
Trait Implementations§
Source§impl Clone for BufferModel
impl Clone for BufferModel
Source§fn clone(&self) -> BufferModel
fn clone(&self) -> BufferModel
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 moreSource§impl Debug for BufferModel
impl Debug for BufferModel
Auto Trait Implementations§
impl Freeze for BufferModel
impl RefUnwindSafe for BufferModel
impl Send for BufferModel
impl Sync for BufferModel
impl Unpin for BufferModel
impl UnsafeUnpin for BufferModel
impl UnwindSafe for BufferModel
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