3 releases (1 stable)

new 1.0.0 Apr 2, 2025
0.1.1 Sep 18, 2024
0.1.0 Aug 5, 2024

#5 in #libobs

Download history 6/week @ 2024-12-04 7/week @ 2024-12-11 3/week @ 2025-02-05

123 downloads per month
Used in libobs-sources

GPL-3.0 license

20KB
363 lines

libOBS source macro

This is a helper macro for the libobs-sources crate.

Usage

This is an example for the window_capture source:

#[obs_source_builder("window_capture")]
pub struct WindowCaptureSourceBuilder {
    #[obs_property(type_t = "enum")]
    capture_method: ObsWindowCaptureMethod,

    // This attribute has to be on each field that should change any obs data setting.
    // notice the `settings_key` attribute, which sets the key that should be used when setting obs data (so data.set_string("window", 'your_window') would be called). Otherwise defaults to the field name.
    // The `type_t` attribute is the type that should be used in the obs data. This is used to generate the correct obs data setter.
    // Can be enum,enum_string,int,bool,string
    #[obs_property(type_t = "string", settings_key = "window")]
    window_raw: String,

    #[obs_property(type_t = "bool")]
    cursor: bool,
}

For more examples look at the libobs-sources crate.

Dependencies

~270–750KB
~17K SLoC