LinuxGeneralScreenCapture

Struct LinuxGeneralScreenCapture 

Source
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

Source

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.

Source

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 runtime
  • name - Name for the source
  • display_type - The display server type to create a source for
  • restore_token - Optional restore token for restoring source settings (this is only for pipewire)
Source

pub fn new_pipewire( runtime: ObsRuntime, name: &str, restore_token: Option<String>, ) -> Result<Self, Box<dyn Error>>

Create a PipeWire-based screen capture source.

Source

pub fn new_x11(runtime: ObsRuntime, name: &str) -> Result<Self, Box<dyn Error>>

Create an X11-based screen capture source.

Source

pub fn add_to_scene( self, scene: &mut ObsSceneRef, ) -> Result<ObsSourceRef, ObsError>

Source

pub fn capture_type_name(&self) -> &str

Get the type of capture being used.

Trait Implementations§

Source§

impl AsRef<ObjectInfo> for LinuxGeneralScreenCapture

Source§

fn as_ref(&self) -> &SourceInfo

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for LinuxGeneralScreenCapture

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.