StartupInfo

Struct StartupInfo 

Source
pub struct StartupInfo { /* private fields */ }
Expand description

Contains information to start a libobs context. This is passed to the creation of ObsContext.

§Platform Notes

On Linux platforms, if your application uses a GUI framework (like GTK, Qt, etc.), it is crucial to set the appropriate NixDisplay in the StartupInfo if you want to create a preview window. This ensures that libobs can correctly interface with the display server (X11 or Wayland) used by your application. If this is not set, libobs will not be able to create a preview window and the application will crash.

Implementations§

Source§

impl StartupInfo

Source

pub fn new() -> StartupInfo

Source

pub fn set_startup_paths(self, paths: StartupPaths) -> Self

Source

pub fn set_video_info(self, ovi: ObsVideoInfo) -> Self

Source

pub fn get_video_info(&self) -> &ObsVideoInfo

Source

pub fn set_logger(self, logger: Box<dyn ObsLogger + Sync + Send>) -> Self

Source

pub fn set_start_glib_loop(self, start: bool) -> Self

Source

pub unsafe fn set_nix_display(self, display: NixDisplay) -> Self

This sets the Nix display (X11 or Wayland) to use when starting libobs.

This is important if your application creates any preview windows using libobs on Linux. Otherwise if you don’t plan to use preview windows AND are not using a GUI framework, you can skip this.

Wayland requires this display to be the same as the one used by the GUI application (if you have one). Failing to set this may result in libobs being unable to create preview windows,

X11 however works without setting this display, in fact your window may become unresponsive if a display is set.

§Safety

Make sure that the display is closed AFTER the whole OBS context has been dropped!

Source

pub fn start(self) -> Result<ObsContext, ObsError>

Trait Implementations§

Source§

impl Debug for StartupInfo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for StartupInfo

Source§

fn default() -> StartupInfo

Returns the “default value” for a type. 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.