pub struct Controls {
pub stop: AtomicBool,
pub finished: AtomicBool,
pub force_idr: AtomicBool,
pub rate_dirty: AtomicBool,
pub bitrate_kbps: AtomicI32,
pub vbv_mult_milli: AtomicI32,
pub fps_milli: AtomicU64,
pub tunables_dirty: AtomicBool,
pub tunables: Mutex<Option<LiveTunables>>,
pub capture_cursor: AtomicBool,
pub region_dirty: AtomicBool,
pub region: Mutex<(i32, i32, i32, i32)>,
}Expand description
Cross-thread controls for a running capture: a bag of atomics (plus two mutex-guarded
payloads) the owning ScreenCapture pyclass flips from the Python thread and the capture thread
reads at the top of each iteration.
It exists so Python never has to reach into the pipeline. The X11Pipeline and its encoder are
only safe to touch from the capture and encode threads, so request_idr / rate / fps / region
changes are posted here as atomic flags and applied later on the thread that owns the pipeline,
rather than mutating encoder state across the thread boundary from Python.
- Lifecycle:
stopends the capture loop;force_idrrequests an on-demand keyframe on the next processed frame. - Rate control (gated by
rate_dirty):bitrate_kbps,vbv_mult_milli(the VBV frame-time multiplier * 1000, held as an integer for atomics;<= 0selects the policy default), andfps_milli(target fps * 1000, re-read every frame for dynamic pacing and rate control). These atomics always hold the CURRENT values, so a pipeline rebuild can carry live rates forward. - Tunables (gated by
tunables_dirty): oneLiveTunablesstruct behindtunables, set rarely, carrying the per-frame quality knobs for the encode thread. - Capture geometry:
capture_cursortoggles the cursor overlay (read on every grab);region_dirtyguardsregion=(x, y, w, h)(w/h<= 0extends to the root edge), applied by the capture thread with the same drain/recreate machinery as auto-adjust.
Fields§
§stop: AtomicBool§finished: AtomicBoolSet by the capture thread as it returns — after it has joined its encode thread and so dropped the NVENC/CUDA session. The atexit sweep waits on this (bounded) before letting the interpreter finalize, because that hardware-session drop racing process exit segfaults, exactly as the Wayland branch fences with a Barrier.
force_idr: AtomicBool§rate_dirty: AtomicBool§bitrate_kbps: AtomicI32§vbv_mult_milli: AtomicI32§fps_milli: AtomicU64§tunables_dirty: AtomicBool§tunables: Mutex<Option<LiveTunables>>§capture_cursor: AtomicBool§region_dirty: AtomicBool§region: Mutex<(i32, i32, i32, i32)>Implementations§
Auto Trait Implementations§
impl !Freeze for Controls
impl RefUnwindSafe for Controls
impl Send for Controls
impl Sync for Controls
impl Unpin for Controls
impl UnsafeUnpin for Controls
impl UnwindSafe for Controls
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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