#[repr(C)]pub struct obs_source_info {Show 52 fields
pub id: *const c_char,
pub type_: obs_source_type,
pub output_flags: u32,
pub get_name: Option<unsafe extern "C" fn(type_data: *mut c_void) -> *const c_char>,
pub create: Option<unsafe extern "C" fn(settings: *mut obs_data_t, source: *mut obs_source_t) -> *mut c_void>,
pub destroy: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub get_width: Option<unsafe extern "C" fn(data: *mut c_void) -> u32>,
pub get_height: Option<unsafe extern "C" fn(data: *mut c_void) -> u32>,
pub get_defaults: Option<unsafe extern "C" fn(settings: *mut obs_data_t)>,
pub get_properties: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_properties_t>,
pub update: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>,
pub activate: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub deactivate: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub show: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub hide: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub video_tick: Option<unsafe extern "C" fn(data: *mut c_void, seconds: f32)>,
pub video_render: Option<unsafe extern "C" fn(data: *mut c_void, effect: *mut gs_effect_t)>,
pub filter_video: Option<unsafe extern "C" fn(data: *mut c_void, frame: *mut obs_source_frame) -> *mut obs_source_frame>,
pub filter_audio: Option<unsafe extern "C" fn(data: *mut c_void, audio: *mut obs_audio_data) -> *mut obs_audio_data>,
pub enum_active_sources: Option<unsafe extern "C" fn(data: *mut c_void, enum_callback: obs_source_enum_proc_t, param: *mut c_void)>,
pub save: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>,
pub load: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>,
pub mouse_click: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, type_: i32, mouse_up: bool, click_count: u32)>,
pub mouse_move: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, mouse_leave: bool)>,
pub mouse_wheel: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, x_delta: c_int, y_delta: c_int)>,
pub focus: Option<unsafe extern "C" fn(data: *mut c_void, focus: bool)>,
pub key_click: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_key_event, key_up: bool)>,
pub filter_remove: Option<unsafe extern "C" fn(data: *mut c_void, source: *mut obs_source_t)>,
pub type_data: *mut c_void,
pub free_type_data: Option<unsafe extern "C" fn(type_data: *mut c_void)>,
pub audio_render: Option<unsafe extern "C" fn(data: *mut c_void, ts_out: *mut u64, audio_output: *mut obs_source_audio_mix, mixers: u32, channels: usize, sample_rate: usize) -> bool>,
pub enum_all_sources: Option<unsafe extern "C" fn(data: *mut c_void, enum_callback: obs_source_enum_proc_t, param: *mut c_void)>,
pub transition_start: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub transition_stop: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub get_defaults2: Option<unsafe extern "C" fn(type_data: *mut c_void, settings: *mut obs_data_t)>,
pub get_properties2: Option<unsafe extern "C" fn(data: *mut c_void, type_data: *mut c_void) -> *mut obs_properties_t>,
pub audio_mix: Option<unsafe extern "C" fn(data: *mut c_void, ts_out: *mut u64, audio_output: *mut audio_output_data, channels: usize, sample_rate: usize) -> bool>,
pub icon_type: obs_icon_type,
pub media_play_pause: Option<unsafe extern "C" fn(data: *mut c_void, pause: bool)>,
pub media_restart: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub media_stop: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub media_next: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub media_previous: Option<unsafe extern "C" fn(data: *mut c_void)>,
pub media_get_duration: Option<unsafe extern "C" fn(data: *mut c_void) -> i64>,
pub media_get_time: Option<unsafe extern "C" fn(data: *mut c_void) -> i64>,
pub media_set_time: Option<unsafe extern "C" fn(data: *mut c_void, miliseconds: i64)>,
pub media_get_state: Option<unsafe extern "C" fn(data: *mut c_void) -> obs_media_state>,
pub version: u32,
pub unversioned_id: *const c_char,
pub missing_files: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_missing_files_t>,
pub video_get_color_space: Option<unsafe extern "C" fn(data: *mut c_void, count: usize, preferred_spaces: *const gs_color_space) -> gs_color_space>,
pub filter_add: Option<unsafe extern "C" fn(data: *mut c_void, source: *mut obs_source_t)>,
}
Expand description
Source definition structure
Fields§
§id: *const c_char
Unique string identifier for the source
type_: obs_source_type
Type of source.
OBS_SOURCE_TYPE_INPUT for input sources, OBS_SOURCE_TYPE_FILTER for filter sources, and OBS_SOURCE_TYPE_TRANSITION for transition sources.
output_flags: u32
Source output flags
get_name: Option<unsafe extern "C" fn(type_data: *mut c_void) -> *const c_char>
Get the translated name of the source type
@param type_data The type_data variable of this structure @return The translated name of the source type
create: Option<unsafe extern "C" fn(settings: *mut obs_data_t, source: *mut obs_source_t) -> *mut c_void>
Creates the source data for the source
@param settings Settings to initialize the source with @param source Source that this data is associated with @return The data associated with this source
destroy: Option<unsafe extern "C" fn(data: *mut c_void)>
Destroys the private data for the source
Async sources must not call obs_source_output_video after returning from destroy
get_width: Option<unsafe extern "C" fn(data: *mut c_void) -> u32>
Returns the width of the source. Required if this is an input source and has non-async video
get_height: Option<unsafe extern "C" fn(data: *mut c_void) -> u32>
Returns the height of the source. Required if this is an input source and has non-async video
get_defaults: Option<unsafe extern "C" fn(settings: *mut obs_data_t)>
Gets the default settings for this source
@param[out] settings Data to assign default settings to @deprecated Use get_defaults2 if type_data is needed
get_properties: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_properties_t>
Gets the property information of this source
@return The properties data @deprecated Use get_properties2 if type_data is needed
update: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>
Updates the settings for this source
@param data Source data @param settings New settings for this source
activate: Option<unsafe extern "C" fn(data: *mut c_void)>
Called when the source has been activated in the main view
deactivate: Option<unsafe extern "C" fn(data: *mut c_void)>
Called when the source has been deactivated from the main view (no longer being played/displayed)
show: Option<unsafe extern "C" fn(data: *mut c_void)>
Called when the source is visible
hide: Option<unsafe extern "C" fn(data: *mut c_void)>
Called when the source is no longer visible
video_tick: Option<unsafe extern "C" fn(data: *mut c_void, seconds: f32)>
Called each video frame with the time elapsed
@param data Source data @param seconds Seconds elapsed since the last frame
video_render: Option<unsafe extern "C" fn(data: *mut c_void, effect: *mut gs_effect_t)>
Called when rendering the source with the graphics subsystem.
If this is an input/transition source, this is called to draw the source texture with the graphics subsystem using the specified effect.
If this is a filter source, it wraps source draw calls (for example applying a custom effect with custom parameters to a source). In this case, it’s highly recommended to use the obs_source_process_filter function to automatically handle effect-based filter processing. However, you can implement custom draw handling as desired as well.
If the source output flags do not include SOURCE_CUSTOM_DRAW, all a source needs to do is set the “image” parameter of the effect to the desired texture, and then draw. If the output flags include SOURCE_COLOR_MATRIX, you may optionally set the “color_matrix” parameter of the effect to a custom 4x4 conversion matrix (by default it will be set to an YUV->RGB conversion matrix)
@param data Source data @param effect Effect to be used with this source. If the source output flags include SOURCE_CUSTOM_DRAW, this will be NULL, and the source is expected to process with an effect manually.
filter_video: Option<unsafe extern "C" fn(data: *mut c_void, frame: *mut obs_source_frame) -> *mut obs_source_frame>
Called to filter raw async video data.
@note This function is only used with filter sources.
@param data Filter data @param frame Video frame to filter @return New video frame data. This can defer video data to be drawn later if time is needed for processing
filter_audio: Option<unsafe extern "C" fn(data: *mut c_void, audio: *mut obs_audio_data) -> *mut obs_audio_data>
Called to filter raw audio data.
@note This function is only used with filter sources.
@param data Filter data @param audio Audio data to filter. @return Modified or new audio data. You can directly modify the data passed and return it, or you can defer audio data for later if time is needed for processing. If you are returning new data, that data must exist until the next call to the filter_audio callback or until the filter is removed/destroyed.
enum_active_sources: Option<unsafe extern "C" fn(data: *mut c_void, enum_callback: obs_source_enum_proc_t, param: *mut c_void)>
Called to enumerate all active sources being used within this source. If the source has children that render audio/video it must implement this callback.
@param data Filter data @param enum_callback Enumeration callback @param param User data to pass to callback
save: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>
Called when saving a source. This is a separate function because sometimes a source needs to know when it is being saved so it doesn’t always have to update the current settings until a certain point.
@param data Source data @param settings Settings
load: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t)>
Called when loading a source from saved data. This should be called after all the loading sources have actually been created because sometimes there are sources that depend on each other.
@param data Source data @param settings Settings
mouse_click: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, type_: i32, mouse_up: bool, click_count: u32)>
Called when interacting with a source and a mouse-down or mouse-up occurs.
@param data Source data @param event Mouse event properties @param type Mouse button pushed @param mouse_up Mouse event type (true if mouse-up) @param click_count Mouse click count (1 for single click, etc.)
mouse_move: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, mouse_leave: bool)>
Called when interacting with a source and a mouse-move occurs.
@param data Source data @param event Mouse event properties @param mouse_leave Mouse leave state (true if mouse left source)
mouse_wheel: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_mouse_event, x_delta: c_int, y_delta: c_int)>
Called when interacting with a source and a mouse-wheel occurs.
@param data Source data @param event Mouse event properties @param x_delta Movement delta in the horizontal direction @param y_delta Movement delta in the vertical direction
focus: Option<unsafe extern "C" fn(data: *mut c_void, focus: bool)>
Called when interacting with a source and gain focus/lost focus event occurs.
@param data Source data @param focus Focus state (true if focus gained)
key_click: Option<unsafe extern "C" fn(data: *mut c_void, event: *const obs_key_event, key_up: bool)>
Called when interacting with a source and a key-up or key-down occurs.
@param data Source data @param event Key event properties @param focus Key event type (true if mouse-up)
filter_remove: Option<unsafe extern "C" fn(data: *mut c_void, source: *mut obs_source_t)>
Called when the filter is removed from a source
@param data Filter data @param source Source that the filter being removed from
type_data: *mut c_void
Private data associated with this entry
free_type_data: Option<unsafe extern "C" fn(type_data: *mut c_void)>
If defined, called to free private data on shutdown
audio_render: Option<unsafe extern "C" fn(data: *mut c_void, ts_out: *mut u64, audio_output: *mut obs_source_audio_mix, mixers: u32, channels: usize, sample_rate: usize) -> bool>
§enum_all_sources: Option<unsafe extern "C" fn(data: *mut c_void, enum_callback: obs_source_enum_proc_t, param: *mut c_void)>
Called to enumerate all active and inactive sources being used within this source. If this callback isn’t implemented, enum_active_sources will be called instead.
This is typically used if a source can have inactive child sources.
@param data Filter data @param enum_callback Enumeration callback @param param User data to pass to callback
transition_start: Option<unsafe extern "C" fn(data: *mut c_void)>
§transition_stop: Option<unsafe extern "C" fn(data: *mut c_void)>
§get_defaults2: Option<unsafe extern "C" fn(type_data: *mut c_void, settings: *mut obs_data_t)>
Gets the default settings for this source
If get_defaults is also defined both will be called, and the first call will be to get_defaults, then to get_defaults2.
@param type_data The type_data variable of this structure @param[out] settings Data to assign default settings to
get_properties2: Option<unsafe extern "C" fn(data: *mut c_void, type_data: *mut c_void) -> *mut obs_properties_t>
Gets the property information of this source
@param data Source data @param type_data The type_data variable of this structure @return The properties data
audio_mix: Option<unsafe extern "C" fn(data: *mut c_void, ts_out: *mut u64, audio_output: *mut audio_output_data, channels: usize, sample_rate: usize) -> bool>
§icon_type: obs_icon_type
Icon type for the source
media_play_pause: Option<unsafe extern "C" fn(data: *mut c_void, pause: bool)>
Media controls
media_restart: Option<unsafe extern "C" fn(data: *mut c_void)>
§media_stop: Option<unsafe extern "C" fn(data: *mut c_void)>
§media_next: Option<unsafe extern "C" fn(data: *mut c_void)>
§media_previous: Option<unsafe extern "C" fn(data: *mut c_void)>
§media_get_duration: Option<unsafe extern "C" fn(data: *mut c_void) -> i64>
§media_get_time: Option<unsafe extern "C" fn(data: *mut c_void) -> i64>
§media_set_time: Option<unsafe extern "C" fn(data: *mut c_void, miliseconds: i64)>
§media_get_state: Option<unsafe extern "C" fn(data: *mut c_void) -> obs_media_state>
§version: u32
§unversioned_id: *const c_char
§missing_files: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_missing_files_t>
Missing files
video_get_color_space: Option<unsafe extern "C" fn(data: *mut c_void, count: usize, preferred_spaces: *const gs_color_space) -> gs_color_space>
Get color space
filter_add: Option<unsafe extern "C" fn(data: *mut c_void, source: *mut obs_source_t)>
Called when the filter is added to a source
@param data Filter data @param source Source that the filter is being added to
Trait Implementations§
Source§impl Clone for obs_source_info
impl Clone for obs_source_info
Source§fn clone(&self) -> obs_source_info
fn clone(&self) -> obs_source_info
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more