Skip to main content

libobs_wrapper\utils/
mod.rs

1mod error;
2mod info;
3pub(crate) mod initialization;
4mod obs_string;
5mod path;
6
7#[cfg(target_os = "linux")]
8pub(crate) mod linux;
9
10#[cfg(test)]
11mod obs_string_tests;
12
13#[cfg(test)]
14mod path_tests;
15
16mod modules;
17
18mod calldata;
19
20use std::fmt::Debug;
21
22pub(crate) use calldata::*;
23pub use error::*;
24pub use info::*;
25pub use initialization::NixDisplay;
26#[cfg(any(target_os = "linux", doc, feature = "__test_environment"))]
27pub use initialization::PlatformType;
28pub use modules::ObsModules;
29pub use obs_string::*;
30pub use path::*;
31
32pub const ENCODER_HIDE_FLAGS: u32 =
33    libobs::OBS_ENCODER_CAP_DEPRECATED | libobs::OBS_ENCODER_CAP_INTERNAL;
34
35/// Internal function to free calldata structs, same implementation as libobs
36///
37/// # Safety
38/// Only call this function with a valid calldata pointer and ensure that
39/// this function runs within the OBS Runtime.
40#[allow(unknown_lints)]
41#[allow(ensure_obs_call_in_runtime)]
42pub(crate) unsafe fn calldata_free(data: *mut libobs::calldata_t) {
43    if !(*data).fixed {
44        libobs::bfree((*data).stack as *mut _);
45    }
46}
47
48/// This should be implemented for any struct that releases OBS resources when dropped.
49#[cfg(feature = "enable_runtime")]
50pub trait ObsDropGuard: Debug + Send + Sync {}
51
52#[cfg(not(feature = "enable_runtime"))]
53pub trait ObsDropGuard: Debug {}