pub struct LinuxGeneralScreenCapture { /* private fields */ }Available on Linux only.
Expand description
General Linux screen capture source that automatically selects the best capture method.
This wrapper automatically chooses between:
- PipeWire capture (for Wayland or modern Linux setups)
- X11 screen capture (for traditional X11 setups)
The selection is based on the detected display server type.
§Example
use libobs_simple::sources::linux::LinuxGeneralScreenCapture;
use libobs_wrapper::{context::ObsContext, sources::ObsSourceBuilder, utils::StartupInfo};
// Automatically selects PipeWire or X11 based on display server
let capture = LinuxGeneralScreenCapture::auto_detect(
&mut context,
"Screen Capture"
)?;
// Add to scene
scene.add(&capture)?;Implementations§
Source§impl LinuxGeneralScreenCapture
impl LinuxGeneralScreenCapture
Sourcepub fn auto_detect(
runtime: ObsRuntime,
name: &str,
restore_token: Option<String>,
) -> Result<Self, Box<dyn Error>>
pub fn auto_detect( runtime: ObsRuntime, name: &str, restore_token: Option<String>, ) -> Result<Self, Box<dyn Error>>
Create a screen capture source by auto-detecting the display server type.
This is the recommended way to create a screen capture on Linux.
Sourcepub fn new(
runtime: ObsRuntime,
name: &str,
display_type: DisplayServerType,
restore_token: Option<String>,
) -> Result<Self, Box<dyn Error>>
pub fn new( runtime: ObsRuntime, name: &str, display_type: DisplayServerType, restore_token: Option<String>, ) -> Result<Self, Box<dyn Error>>
Create a screen capture source for a specific display server type.
§Arguments
runtime- The OBS runtimename- Name for the sourcedisplay_type- The display server type to create a source forrestore_token- Optional restore token for restoring source settings (this is only for pipewire)
Sourcepub fn new_pipewire(
runtime: ObsRuntime,
name: &str,
restore_token: Option<String>,
) -> Result<Self, Box<dyn Error>>
pub fn new_pipewire( runtime: ObsRuntime, name: &str, restore_token: Option<String>, ) -> Result<Self, Box<dyn Error>>
Create a PipeWire-based screen capture source.
Sourcepub fn new_x11(runtime: ObsRuntime, name: &str) -> Result<Self, Box<dyn Error>>
pub fn new_x11(runtime: ObsRuntime, name: &str) -> Result<Self, Box<dyn Error>>
Create an X11-based screen capture source.
pub fn add_to_scene( self, scene: &mut ObsSceneRef, ) -> Result<ObsSourceRef, ObsError>
Sourcepub fn capture_type_name(&self) -> &str
pub fn capture_type_name(&self) -> &str
Get the type of capture being used.
Trait Implementations§
Source§impl AsRef<ObjectInfo> for LinuxGeneralScreenCapture
impl AsRef<ObjectInfo> for LinuxGeneralScreenCapture
Auto Trait Implementations§
impl Freeze for LinuxGeneralScreenCapture
impl RefUnwindSafe for LinuxGeneralScreenCapture
impl Send for LinuxGeneralScreenCapture
impl Sync for LinuxGeneralScreenCapture
impl Unpin for LinuxGeneralScreenCapture
impl UnwindSafe for LinuxGeneralScreenCapture
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