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::{
21    collections::HashMap,
22    fmt::Debug,
23    sync::{Arc, RwLock},
24};
25
26pub use calldata::*;
27pub use error::*;
28pub use info::*;
29pub use initialization::NixDisplay;
30#[cfg(any(target_os = "linux", doc, feature = "__test_environment"))]
31pub use initialization::PlatformType;
32pub use modules::ObsModules;
33pub use obs_string::*;
34pub use path::*;
35
36pub const ENCODER_HIDE_FLAGS: u32 =
37    libobs::OBS_ENCODER_CAP_DEPRECATED | libobs::OBS_ENCODER_CAP_INTERNAL;
38
39/// Internal function to free calldata structs, same implementation as libobs
40///
41/// # Safety
42/// Only call this function with a valid calldata pointer and ensure that
43/// this function runs within the OBS Runtime.
44#[allow(unknown_lints)]
45#[allow(ensure_obs_call_in_runtime)]
46pub(crate) unsafe fn calldata_free(data: *mut libobs::calldata_t) {
47    if !(*data).fixed {
48        libobs::bfree((*data).stack as *mut _);
49    }
50}
51
52/// This should be implemented for any struct that releases OBS resources when dropped
53pub trait ObsDropGuard: Debug {}
54
55pub(crate) type GeneralTraitHashMap<T, K> = Arc<RwLock<HashMap<Arc<Box<T>>, K>>>;