Skip to main content

libobs_wrapper\utils/
mod.rs

1pub(crate) mod c_format;
2mod error;
3mod info;
4pub(crate) mod initialization;
5mod obs_string;
6pub(crate) mod path;
7
8#[cfg(target_os = "linux")]
9pub(crate) mod linux;
10
11#[cfg(test)]
12mod obs_string_tests;
13
14#[cfg(test)]
15mod path_tests;
16
17mod modules;
18
19mod calldata;
20
21use std::fmt::Debug;
22
23pub(crate) use calldata::*;
24pub use error::*;
25pub use info::*;
26pub use initialization::NixDisplay;
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 {}