pub struct X11Pipeline { /* private fields */ }Expand description
Everything the X11 host-ARGB path has to remember between frames.
Unlike the Wayland backend, X11 capture has no compositor to report what changed, so this
context exists to hold the state that stands in for that missing damage signal: the per-stripe
hashes and the persistent encoder session that let process() discover damage by comparing
content frame-to-frame. Hardware full-frame H.264 runs through decide_hw_fullframe; the
software path (JPEG, striped or full-frame software H.264) runs through encode_cpu with
hash_damage=true.
Recording fan-out (socket sink and MP4 recorder) is handled at the delivery layer; a
consumer needing a keyframe goes through X11Pipeline::request_idr like everyone else.
Implementations§
Source§impl X11Pipeline
impl X11Pipeline
Sourcepub fn new(settings: RustCaptureSettings) -> Self
pub fn new(settings: RustCaptureSettings) -> Self
Build the context, choosing the full-frame encoder for the X11 host-ARGB path.
§Arguments
settings- Capture configuration. Theoutput_mode,use_cpu, andencode_node_indexfields drive encoder selection.
§Encoder selection
- NVENC — on an NVIDIA driver (or no detectable GPU, since the attempt is cheap).
- VA-API — on any other GPU driver. A 4:4:4 request is carried into the attempt, so a device that cannot encode 4:4:4 fails here and falls through rather than being ruled out in advance.
- Software —
X11Encoder::None: the striped (or, withvideo_fullframe, full-frame) software path insideencode_cpu, encoding with the build’s software H.264 encoder (SOFTWARE_H264_ENCODER). This is also where a 4:4:4 request lands when no hardware encoder can carry it; libx264 carries it, OpenH264 encodes it 4:2:0.
Sourcepub fn request_idr(&mut self)
pub fn request_idr(&mut self)
Request an on-demand keyframe on the next processed frame.
Sourcepub fn encoder_name(&self) -> &str
pub fn encoder_name(&self) -> &str
Return a human-readable encoder type string for logging.
Sourcepub fn colorspace_desc(&self) -> &'static str
pub fn colorspace_desc(&self) -> &'static str
The Colorspace: field for this pipeline’s stream log, describing what its encoder settled
on: VA-API only reaches 4:4:4 when the driver and FFmpeg build carry it, and the software
encoder only when the build’s one does (SOFTWARE_H264_FULLCOLOR).
Sourcepub fn reshape(
&mut self,
settings: &RustCaptureSettings,
size_changed: bool,
) -> bool
pub fn reshape( &mut self, settings: &RustCaptureSettings, size_changed: bool, ) -> bool
Adapt the live pipeline to recreated capture surfaces without rebuilding it.
§Arguments
settings- New geometry plus current live rates.size_changed- Whether the capture dimensions changed.
§Returns
true if the pipeline was successfully adapted in place; false when the active encoder
cannot follow (VAAPI on resize) and the caller must rebuild.
Sourcepub fn update_rate(&mut self, bitrate_kbps: i32, vbv_multiplier: f64, fps: f64)
pub fn update_rate(&mut self, bitrate_kbps: i32, vbv_multiplier: f64, fps: f64)
Apply a runtime rate-control / framerate change: the CBR target bitrate + VBV (kbps /
kb; ignored unless CBR is active) and the target fps. NVENC reconfigures its live session
immediately; VAAPI re-opens its codec context to apply the new rate; the software path picks
the new values up on the next process() (encode_cpu reads the updated settings and
reconfigures each stripe’s encoder).
Sourcepub fn update_tunables(&mut self, t: &LiveTunables)
pub fn update_tunables(&mut self, t: &LiveTunables)
Apply live per-frame tunables (quality, paint-over, streaming mode, keyframe cadence); every encoder re-reads them from the settings on the next process().
Sourcepub fn process(&mut self, argb: &[u8], stride: usize) -> Vec<EncodedStripe>
pub fn process(&mut self, argb: &[u8], stride: usize) -> Vec<EncodedStripe>
Encode one host-ARGB frame and return the encoded stripes.
§Arguments
argb- Packed BGRA pixel buffer (B,G,R,A byte order,stridebytes per row).stride- Bytes per row (must equalwidth * 4for the software path).
§Returns
Vec of EncodedStripe — empty when nothing changed.
Auto Trait Implementations§
impl !Sync for X11Pipeline
impl Freeze for X11Pipeline
impl RefUnwindSafe for X11Pipeline
impl Send for X11Pipeline
impl Unpin for X11Pipeline
impl UnsafeUnpin for X11Pipeline
impl UnwindSafe for X11Pipeline
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> 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