![]() |
Open Broadcaster Software
Free, open source software for live streaming and recording
|
Data Fields | |
| const char * | id |
| enum obs_source_type | type |
| uint32_t | output_flags |
| const char *(* | get_name )(void *type_data) |
| void *(* | create )(obs_data_t *settings, obs_source_t *source) |
| void(* | destroy )(void *data) |
| uint32_t(* | get_width )(void *data) |
| uint32_t(* | get_height )(void *data) |
| void(* | get_defaults )(obs_data_t *settings) |
| obs_properties_t *(* | get_properties )(void *data) |
| void(* | update )(void *data, obs_data_t *settings) |
| void(* | activate )(void *data) |
| void(* | deactivate )(void *data) |
| void(* | show )(void *data) |
| void(* | hide )(void *data) |
| void(* | video_tick )(void *data, float seconds) |
| void(* | video_render )(void *data, gs_effect_t *effect) |
| struct obs_source_frame *(* | filter_video )(void *data, struct obs_source_frame *frame) |
| struct obs_audio_data *(* | filter_audio )(void *data, struct obs_audio_data *audio) |
| void(* | enum_active_sources )(void *data, obs_source_enum_proc_t enum_callback, void *param) |
| void(* | save )(void *data, obs_data_t *settings) |
| void(* | load )(void *data, obs_data_t *settings) |
| void(* | mouse_click )(void *data, const struct obs_mouse_event *event, int32_t type, bool mouse_up, uint32_t click_count) |
| void(* | mouse_move )(void *data, const struct obs_mouse_event *event, bool mouse_leave) |
| void(* | mouse_wheel )(void *data, const struct obs_mouse_event *event, int x_delta, int y_delta) |
| void(* | focus )(void *data, bool focus) |
| void(* | key_click )(void *data, const struct obs_key_event *event, bool key_up) |
| void(* | filter_remove )(void *data, obs_source_t *source) |
| void * | type_data |
| void(* | free_type_data )(void *type_data) |
| bool(* | audio_render )(void *data, uint64_t *ts_out, struct obs_source_audio_mix *audio_output, uint32_t mixers, size_t channels, size_t sample_rate) |
| void(* | enum_all_sources )(void *data, obs_source_enum_proc_t enum_callback, void *param) |
| void(* | transition_start )(void *data) |
| void(* | transition_stop )(void *data) |
| void(* | get_defaults2 )(void *type_data, obs_data_t *settings) |
| obs_properties_t *(* | get_properties2 )(void *data, void *type_data) |
Source definition structure
| void(* obs_source_info::activate) (void *data) |
Called when the source has been activated in the main view
| bool(* obs_source_info::audio_render) (void *data, uint64_t *ts_out, struct obs_source_audio_mix *audio_output, uint32_t mixers, size_t channels, size_t sample_rate) |
| void*(* obs_source_info::create) (obs_data_t *settings, obs_source_t *source) |
Creates the source data for the source
| settings | Settings to initialize the source with |
| source | Source that this data is associated with |
| void(* obs_source_info::deactivate) (void *data) |
Called when the source has been deactivated from the main view (no longer being played/displayed)
| void(* obs_source_info::destroy) (void *data) |
Destroys the private data for the source
Async sources must not call obs_source_output_video after returning from destroy
| void(* obs_source_info::enum_active_sources) (void *data, obs_source_enum_proc_t enum_callback, void *param) |
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.
| data | Filter data |
| enum_callback | Enumeration callback |
| param | User data to pass to callback |
| void(* obs_source_info::enum_all_sources) (void *data, obs_source_enum_proc_t enum_callback, void *param) |
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.
| data | Filter data |
| enum_callback | Enumeration callback |
| param | User data to pass to callback |
| struct obs_audio_data*(* obs_source_info::filter_audio) (void *data, struct obs_audio_data *audio) |
Called to filter raw audio data.
| data | Filter data |
| audio | Audio data to filter. |
| void(* obs_source_info::filter_remove) (void *data, obs_source_t *source) |
Called when the filter is removed from a source
| data | Filter data |
| source | Source that the filter being removed from |
| struct obs_source_frame*(* obs_source_info::filter_video) (void *data, struct obs_source_frame *frame) |
Called to filter raw async video data.
| data | Filter data |
| frame | Video frame to filter |
| void(* obs_source_info::focus) (void *data, bool focus) |
Called when interacting with a source and gain focus/lost focus event occurs.
| data | Source data |
| focus | Focus state (true if focus gained) |
| void(* obs_source_info::free_type_data) (void *type_data) |
If defined, called to free private data on shutdown
| void(* obs_source_info::get_defaults) (obs_data_t *settings) |
Gets the default settings for this source
| [out] | settings | Data to assign default settings to |
| void(* obs_source_info::get_defaults2) (void *type_data, obs_data_t *settings) |
Gets the default settings for this source
| type_data | The type_data variable of this structure | |
| [out] | settings | Data to assign default settings to |
| uint32_t(* obs_source_info::get_height) (void *data) |
Returns the height of the source. Required if this is an input source and has non-async video
| const char*(* obs_source_info::get_name) (void *type_data) |
Get the translated name of the source type
| type_data | The type_data variable of this structure |
| obs_properties_t*(* obs_source_info::get_properties) (void *data) |
Gets the property information of this source
| obs_properties_t*(* obs_source_info::get_properties2) (void *data, void *type_data) |
Gets the property information of this source
| data | Source data |
| type_data | The type_data variable of this structure |
| uint32_t(* obs_source_info::get_width) (void *data) |
Returns the width of the source. Required if this is an input source and has non-async video
| void(* obs_source_info::hide) (void *data) |
Called when the source is no longer visible
| const char* obs_source_info::id |
Unique string identifier for the source
| void(* obs_source_info::key_click) (void *data, const struct obs_key_event *event, bool key_up) |
Called when interacting with a source and a key-up or key-down occurs.
| data | Source data |
| event | Key event properties |
| focus | Key event type (true if mouse-up) |
| void(* obs_source_info::load) (void *data, obs_data_t *settings) |
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.
| data | Source data |
| settings | Settings |
| void(* obs_source_info::mouse_click) (void *data, const struct obs_mouse_event *event, int32_t type, bool mouse_up, uint32_t click_count) |
Called when interacting with a source and a mouse-down or mouse-up occurs.
| data | Source data |
| event | Mouse event properties |
| type | Mouse button pushed |
| mouse_up | Mouse event type (true if mouse-up) |
| click_count | Mouse click count (1 for single click, etc.) |
| void(* obs_source_info::mouse_move) (void *data, const struct obs_mouse_event *event, bool mouse_leave) |
Called when interacting with a source and a mouse-move occurs.
| data | Source data |
| event | Mouse event properties |
| mouse_leave | Mouse leave state (true if mouse left source) |
| void(* obs_source_info::mouse_wheel) (void *data, const struct obs_mouse_event *event, int x_delta, int y_delta) |
Called when interacting with a source and a mouse-wheel occurs.
| data | Source data |
| event | Mouse event properties |
| x_delta | Movement delta in the horizontal direction |
| y_delta | Movement delta in the vertical direction |
| uint32_t obs_source_info::output_flags |
Source output flags
| void(* obs_source_info::save) (void *data, obs_data_t *settings) |
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.
| data | Source data |
| settings | Settings |
| void(* obs_source_info::show) (void *data) |
Called when the source is visible
| void(* obs_source_info::transition_start) (void *data) |
| void(* obs_source_info::transition_stop) (void *data) |
| enum obs_source_type obs_source_info::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.
| void* obs_source_info::type_data |
Private data associated with this entry
| void(* obs_source_info::update) (void *data, obs_data_t *settings) |
Updates the settings for this source
| data | Source data |
| settings | New settings for this source |
| void(* obs_source_info::video_render) (void *data, gs_effect_t *effect) |
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)
| data | Source data |
| 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. |
| void(* obs_source_info::video_tick) (void *data, float seconds) |
Called each video frame with the time elapsed
| data | Source data |
| seconds | Seconds elapsed since the last frame |