pub struct TwoPassSession { /* private fields */ }Expand description
Top-level two-pass VBR encode session.
Manages state transitions and coordinates between first-pass analysis and second-pass encoding.
Implementations§
Source§impl TwoPassSession
impl TwoPassSession
Sourcepub fn new(cfg: TwoPassAllocatorConfig) -> Self
pub fn new(cfg: TwoPassAllocatorConfig) -> Self
Create a new session with the given allocator configuration.
Sourcepub fn state(&self) -> TwoPassState
pub fn state(&self) -> TwoPassState
Current state of the session.
Sourcepub fn record_first_pass_frame(
&mut self,
stats: FirstPassFrameStats,
) -> Result<(), &'static str>
pub fn record_first_pass_frame( &mut self, stats: FirstPassFrameStats, ) -> Result<(), &'static str>
Record one frame’s first-pass statistics.
Returns an error string if the session is not in FirstPass state.
Sourcepub fn finish_first_pass(&mut self)
pub fn finish_first_pass(&mut self)
Finalise the first pass and compute bit allocations.
After calling this method the session moves to AllocationReady state.
Sourcepub fn begin_second_pass(&mut self) -> Result<(), &'static str>
pub fn begin_second_pass(&mut self) -> Result<(), &'static str>
Begin the second pass.
Transitions the session from AllocationReady to SecondPass.
Sourcepub fn next_frame_allocation(&mut self) -> Option<&FrameAllocationResult>
pub fn next_frame_allocation(&mut self) -> Option<&FrameAllocationResult>
Get the allocation for the next second-pass frame.
Returns None when all frames have been consumed (session complete).
Sourcepub fn first_pass_stats(&self) -> &TwoPassFirstPassStats
pub fn first_pass_stats(&self) -> &TwoPassFirstPassStats
Access the first-pass statistics.
Sourcepub fn allocations(&self) -> &[FrameAllocationResult]
pub fn allocations(&self) -> &[FrameAllocationResult]
Access all computed frame allocations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TwoPassSession
impl RefUnwindSafe for TwoPassSession
impl Send for TwoPassSession
impl Sync for TwoPassSession
impl Unpin for TwoPassSession
impl UnsafeUnpin for TwoPassSession
impl UnwindSafe for TwoPassSession
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> 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