pub struct ParallelSegmentEncoder { /* private fields */ }Expand description
Encodes a batch of independent GOPs (segments) in parallel using rayon.
Each SegmentSpec is a self-contained unit: it carries its own raw
frame data and codec hint. The encoder compresses each spec on a rayon
thread and collects the results, maintaining the original ordering.
§Thread safety
All state is local to each rayon task. No shared mutable state is used.
Implementations§
Source§impl ParallelSegmentEncoder
impl ParallelSegmentEncoder
Sourcepub fn new(max_threads: usize) -> Self
pub fn new(max_threads: usize) -> Self
Creates a new parallel segment encoder.
max_threads controls the rayon thread pool size; pass 0 to use
rayon’s default (number of logical CPUs).
Sourcepub fn stats(&self) -> &ParallelSegmentStats
pub fn stats(&self) -> &ParallelSegmentStats
Returns the current accumulated statistics.
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Resets the accumulated statistics.
Sourcepub fn encode_batch(
&mut self,
specs: Vec<SegmentSpec>,
) -> Result<Vec<ParallelSegmentResult>>
pub fn encode_batch( &mut self, specs: Vec<SegmentSpec>, ) -> Result<Vec<ParallelSegmentResult>>
Encodes all specs in parallel and returns a result per spec.
Results are returned in the same order as specs.
§Errors
Returns an error if the rayon thread pool cannot be created.
Auto Trait Implementations§
impl Freeze for ParallelSegmentEncoder
impl RefUnwindSafe for ParallelSegmentEncoder
impl Send for ParallelSegmentEncoder
impl Sync for ParallelSegmentEncoder
impl Unpin for ParallelSegmentEncoder
impl UnsafeUnpin for ParallelSegmentEncoder
impl UnwindSafe for ParallelSegmentEncoder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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