Sources are used to render video and/or audio on stream. Things such as capturing displays/games/audio, playing a video, showing an image, or playing audio. Sources can also be used to implement audio and video filters as well as transitions. The libobs/obs-source.h file is the dedicated header for implementing sources.
A reference-counted video/audio input source.
A weak reference to an video/audio input source.
#include <obs.h>
Source definition structure.
Unique string identifier for the source (required).
Source version (optional).
This is used when a source’s implementation is significantly modified and the previous version is deprecated, but is kept to prevent old sources from breaking.
Type of source.
OBS_SOURCE_TYPE_INPUT - Video/Audio Input
OBS_SOURCE_TYPE_FILTER - Filter
OBS_SOURCE_TYPE_TRANSITION - Transition
Source output capability flags (required).
(Author’s note: This should be renamed to “capability_flags”)
A bitwise OR combination of one or more of the following values:
OBS_SOURCE_VIDEO - Source has video
Unless SOURCE_ASYNC_VIDEO is specified, the source must include the
obs_source_info.video_render callback in the source
definition structure.
OBS_SOURCE_AUDIO - Source has audio
Use the obs_source_output_audio() function to pass raw
audio data, which will be automatically converted and uploaded. If
used with OBS_SOURCE_ASYNC_VIDEO, audio will automatically be
synced up to the video output based upon their mutual timestamps.
OBS_SOURCE_ASYNC - Video is asynchronous (use OBS_SOURCE_ASYNC_VIDEO instead to automatically combine this flag with the OBS_SOURCE_VIDEO flag).
OBS_SOURCE_ASYNC_VIDEO - Source passes raw video data via RAM
Use the obs_source_output_video() function to pass raw
video data, which will be automatically drawn at a timing relative
to the provided timestamp.
If audio is also present on the source, the audio will automatically be synced to the video based upon their mutual timestamps.
OBS_SOURCE_CUSTOM_DRAW - Source uses custom graphics calls, rather than just rendering a single texture.
This capability flag must be used if the source does not use
obs_source_draw() to render a single texture.
This capability flag is an important hint to turn off a specific optimization that allows the first effect filter in the filter chain to render the source directly with that effect filter. The optimization does not work if there are custom graphics calls, and the source must be rendered to a texture first before being sent to the first filter in the filter chain.
(Author’s note: Ironically, not many sources render with that optimization. I should have made it so that the optimization isn’t used by default, and a flag should have been used to turn on the optimization – not turn it off).
OBS_SOURCE_INTERACTION - Source can be interacted with by the user.
When this is used, the source will receive interaction events if
these callbacks are provided:
obs_source_info.mouse_click,
obs_source_info.mouse_move,
obs_source_info.mouse_wheel,
obs_source_info.focus, and
obs_source_info.key_click.
OBS_SOURCE_COMPOSITE - Source composites child sources
When used, specifies that the source composites one or more child sources. Scenes and transitions are examples of sources that contain and render child sources.
Sources that render sub-sources must implement the audio_render callback in order to perform custom audio mixing of child sources.
This capability flag is always set for transitions.
OBS_SOURCE_DO_NOT_DUPLICATE - Source should not be fully duplicated.
When this is used, specifies that the source should not be fully duplicated, and should prefer to duplicate via holding references rather than full duplication.
When functions such as obs_source_duplicate() or
obs_scene_duplicate() are called, sources or child
sources with this flag will never be fully duplicated, and will
instead only be referenced.
An example of the type of sources that should not be fully duplicated are video devices, browsers, and video/audio captures, as they will either not function correctly or will cause performance or resource issues when duplicated.
OBS_SOURCE_DEPRECATED - Source is deprecated and should not be used.
OBS_SOURCE_DO_NOT_SELF_MONITOR - Audio of this source should not allow monitoring if the current monitoring device is the same device being captured by the source.
This flag is used as a hint to the back-end to prevent the source from creating an audio feedback loop. This is primarily only used with desktop audio capture sources.
OBS_SOURCE_CAP_DISABLED - This source type has been disabled and should not be shown as a type of source the user can add.
OBS_SOURCE_CAP_OBSOLETE - This source type is obsolete and should not be shown as a type of source the user can add. Identical to OBS_SOURCE_CAP_DISABLED. Meant to be used when a source has changed in some way (mostly defaults/properties), but you want to avoid breaking older configurations. Basically solves the problem of “I want to change the defaults of a source but I don’t want to break people’s configurations”
OBS_SOURCE_CONTROLLABLE_MEDIA - This source has media that can be controlled
OBS_SOURCE_MONITOR_BY_DEFAULT - Source should enable monitoring by default. Monitoring should be set by the frontend if this flag is set.
OBS_SOURCE_CEA_708 - Source type provides cea708 data
OBS_SOURCE_SRGB - Source understands SRGB rendering
OBS_SOURCE_CAP_DONT_SHOW_PROPERTIES - Source type prefers not to have its properties shown on creation (prefers to rely on defaults first)
OBS_SOURCE_REQUIRES_CANVAS - Source type requires a canvas.
Get the translated name of the source type.
The type_data variable of this structure
The translated name of the source type
Creates the implementation data for the source.
Settings to initialize the source with
Source that this data is associated with
The implementation data associated with this source
Destroys the implementation data for the source.
Async sources must not call obs_source_output_video after returning from destroy.
Returns the width/height of the source. These callbacks are required if this is a video source and is synchronous.
(Author’s note: These should really be consolidated in to one function, not two)
The width/height of the video
Sets the default settings for this source.
Default settings. Call obs_data_set_default* functions on this object to set default setting values
Gets the property information of this source.
The implementation data associated with this source.
This value can be null (e.g., when
obs_get_source_properties() is called on the
source type), make sure to handle this gracefully.
(Optional)
The properties of the source
Updates the settings for this source.
(Optional)
New settings for this source
Called when the source has been activated in the main view (visible on stream/recording).
(Optional)
Called when the source has been deactivated from the main view (no longer visible on stream/recording).
(Optional)
Called when the source is visible on any display and/or on the main view.
(Optional)
Called when the source is no longer visible on any display and/or on the main view.
(Optional)
Called each video frame with the time elapsed.
(Optional)
Seconds elapsed since the last frame
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.
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_begin() and
obs_source_process_filter_end() functions to automatically
handle effect-based filter processing. However, you can implement
custom draw handling as desired as well.
If the source output capability flags do not include
OBS_SOURCE_CUSTOM_DRAW, the source must use
obs_source_draw() to render the source’s texture.
This parameter is no longer used. Instead, call
obs_source_draw()
Called to filter raw async video data. This function is only used with asynchronous video filters.
Video frame to filter
New video frame data. This can defer video data to be drawn later if time is needed for processing
Called to filter raw audio data. This function is only used with audio filters.
Audio data to filter
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
obs_source_info.filter_audio callback or
until the filter is removed/destroyed
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. Only used with sources that have the OBS_SOURCE_COMPOSITE output capability flag.
Enumeration callback
User data to pass to callback
Called when saving custom data for 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.
(Optional)
Settings object to save data to
Called when loading custom data from saved source data. This is called after all the loading sources have actually been created, allowing the ability to reference other sources if desired.
(Optional)
Settings object to load data from
Called when interacting with a source and a mouse-down or mouse-up occurs. Only used with sources that have the OBS_SOURCE_INTERACTION output capability flag.
(Optional)
Mouse event properties
Mouse button pushed
Mouse event type (true if mouse-up)
Mouse click count (1 for single click, etc.)
Called when interacting with a source and a mouse-move occurs. Only used with sources that have the OBS_SOURCE_INTERACTION output capability flag.
(Optional)
Mouse event properties
Mouse leave state (true if mouse left source)
Called when interacting with a source and a mouse-wheel occurs. Only used with sources that have the OBS_SOURCE_INTERACTION output capability flag.
(Optional)
Mouse event properties
Movement delta in the horizontal direction
Movement delta in the vertical direction
Called when interacting with a source and gain focus/lost focus event occurs. Only used with sources that have the OBS_SOURCE_INTERACTION output capability flag.
(Optional)
Focus state (true if focus gained)
Called when interacting with a source and a key-up or key-down occurs. Only used with sources that have the OBS_SOURCE_INTERACTION output capability flag.
(Optional)
Key event properties
Key event type (true if mouse-up)
Called when the filter is added to a source.
(Optional)
Filter data
Source that the filter is being added to
Called when the filter is removed from a source.
(Optional)
Filter data
Source that the filter being removed from
Private data associated with this entry. Note that this is not the same as the implementation data; this is used to differentiate between two different types if the same callbacks are used for more than one different type.
Called to render audio of composite sources. Only used with sources that have the OBS_SOURCE_COMPOSITE output capability flag.
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. Only used with sources that have the OBS_SOURCE_COMPOSITE output capability flag.
This is typically used if a source can have inactive child sources.
Enumeration callback
User data to pass to callback
Called on transition sources when the transition starts/stops.
(Optional)
Icon used for the source.
OBS_ICON_TYPE_UNKNOWN - Unknown
OBS_ICON_TYPE_IMAGE - Image
OBS_ICON_TYPE_COLOR - Color
OBS_ICON_TYPE_SLIDESHOW - Slideshow
OBS_ICON_TYPE_AUDIO_INPUT - Audio Input
OBS_ICON_TYPE_AUDIO_OUTPUT - Audio Output
OBS_ICON_TYPE_DESKTOP_CAPTURE - Desktop Capture
OBS_ICON_TYPE_WINDOW_CAPTURE - Window Capture
OBS_ICON_TYPE_GAME_CAPTURE - Game Capture
OBS_ICON_TYPE_CAMERA - Camera
OBS_ICON_TYPE_TEXT - Text
OBS_ICON_TYPE_MEDIA - Media
OBS_ICON_TYPE_BROWSER - Browser
OBS_ICON_TYPE_CUSTOM - Custom
Gets the icon file path used for dark themes. Make sure icon_type is set to OBS_ICON_TYPE_CUSTOM.
Gets the icon file path used for light themes. Make sure icon_type is set to OBS_ICON_TYPE_CUSTOM.
Called to pause or play media.
Called to restart the media.
Called to stop the media.
Called to go to the next media.
Called to go to the previous media.
Called to get the media duration.
Called to get the current time of the media.
Called to set the media time.
Called to get the state of the media.
OBS_MEDIA_STATE_NONE - None
OBS_MEDIA_STATE_PLAYING - Playing
OBS_MEDIA_STATE_OPENING - Opening
OBS_MEDIA_STATE_BUFFERING - Buffering
OBS_MEDIA_STATE_PAUSED - Paused
OBS_MEDIA_STATE_STOPPED - Stopped
OBS_MEDIA_STATE_ENDED - Ended
OBS_MEDIA_STATE_ERROR - Error
Called to get the missing files of the source.
Returns the color space of the source. Assume GS_CS_SRGB if not implemented.
There’s an optimization an SDR source can do when rendering to HDR. Check if the active space is GS_CS_709_EXTENDED, and return GS_CS_709_EXTENDED instead of GS_CS_SRGB to avoid an redundant conversion. This optimization can only be done if the pixel shader outputs linear 709, which is why it’s not performed by default.
The color space of the video
The following signals are defined for every source type:
destroy (ptr source)
This signal is called when the source is about to be destroyed. Do not increment any references when using this signal.
remove (ptr source)
Called when the
obs_source_remove()function is called on the source.
update (ptr source)
Called when the source’s settings have been updated.
Added in version 29.0.0.
save (ptr source)
Called when the source is being saved.
load (ptr source)
Called when the source is being loaded.
activate (ptr source)
Called when the source has been activated in the main view (visible on stream/recording).
deactivate (ptr source)
Called when the source has been deactivated from the main view (no longer visible on stream/recording).
show (ptr source)
Called when the source is visible on any display and/or on the main view.
hide (ptr source)
Called when the source is no longer visible on any display and/or on the main view.
mute (ptr source, bool muted)
Called when the source is muted/unmuted.
push_to_mute_changed (ptr source, bool enabled)
Called when push-to-mute has been enabled/disabled.
push_to_mute_delay (ptr source, int delay)
Called when the push-to-mute delay value has changed.
push_to_talk_changed (ptr source, bool enabled)
Called when push-to-talk has been enabled/disabled.
push_to_talk_delay (ptr source, int delay)
Called when the push-to-talk delay value has changed.
enable (ptr source, bool enabled)
Called when the source has been disabled/enabled.
rename (ptr source, string new_name, string prev_name)
Called when the source has been renamed.
volume (ptr source, in out float volume)
Called when the volume of the source has changed.
update_properties (ptr source)
Called to signal to any properties view (or other users of the source’s obs_properties_t) that the presentable properties of the source have changed and should be re-queried via obs_source_properties. Does not mean that the source’s settings (as configured by the user) have changed. For that, use the update signal instead.
update_flags (ptr source, int flags)
Called when the flags of the source have been changed.
audio_sync (ptr source, int out int offset)
Called when the audio sync offset has changed.
audio_balance (ptr source, in out float balance)
Called when the audio balance has changed.
audio_mixers (ptr source, in out int mixers)
Called when the audio mixers have changed.
audio_activate (ptr source)
Called when the source’s audio becomes active.
audio_deactivate (ptr source)
Called when the source’s audio becomes inactive.
filter_add (ptr source, ptr filter)
Called when a filter has been added to the source.
Added in version 30.0.
filter_remove (ptr source, ptr filter)
Called when a filter has been removed from the source.
reorder_filters (ptr source)
Called when filters have been reordered.
transition_start (ptr source)
Called when a transition is starting.
transition_video_stop (ptr source)
Called when a transition’s video transitioning has stopped.
transition_stop (ptr source)
Called when a transition has stopped.
media_started (ptr source)
Called when media has started.
media_ended (ptr source)
Called when media has ended.
media_pause (ptr source)
Called when media has been paused.
media_play (ptr source)
Called when media starts playing.
media_restart (ptr source)
Called when the playing of media has been restarted.
media_stopped (ptr source)
Called when the playing of media has been stopped.
media_next (ptr source)
Called when the media source switches to the next media.
media_previous (ptr source)
Called when the media source switches to the previous media.
slide_changed (int index, string path)
Called when the source’s currently displayed image changes.
- Defined by:
Image Slide Show
hooked (ptr source, string title, string class, string executable)
Called when the source successfully captures an existing window.
- Defined by:
Window Capture (Windows)
Game Capture (Windows)
Application Audio Output Capture (Windows)
hooked (ptr source, string name, string class)
Called when the source successfully captures an existing window.
- Defined by:
Window Capture (Xcomposite)
unhooked (ptr source)
Called when the source stops capturing.
- Defined by:
Window Capture (Windows)
Game Capture (Windows)
Application Audio Output Capture (Windows)
Window Capture (Xcomposite)
The following procedures are defined for specific sources only:
current_index (out int current_index)
Returns the index of the currently displayed image in the slideshow.
- Defined by:
Image Slide Show
total_files (out int total_files)
Returns the total number of image files in the slideshow.
- Defined by:
Image Slide Show
get_hooked (out bool hooked, out string title, out string class, out string executable)
Returns whether the source is currently capturing a window and if yes, which.
- Defined by:
Window Capture (Windows)
Game Capture (Windows)
Application audio output capture (Windows)
get_hooked (out bool hooked, out string name, out string class)
Returns whether the source is currently capturing a window and if yes, which.
- Defined by:
Window Capture (Xcomposite)
get_metadata (in string tag_id, out string tag_data)
For a given metadata tag, returns the data associated with it.
- Defined by:
VLC Video Source
restart ()
Restarts the media.
- Defined by:
Media Source
get_duration (out int duration)
Returns the total duration of the media file, in nanoseconds.
- Defined by:
Media Source
get_nb_frames (out int num_frames)
Returns the total number of frames in the media file.
- Defined by:
Media Source
activate (in bool active)
Activates or deactivates the device.
- Defined by:
Video Capture Device Source (Windows)
Registers a source type. Typically used in
obs_module_load() or in the program’s initialization phase.
Calls the obs_source_info.get_name callback to get the
translated display name of a source type.
id – The source type string identifier
The translated display name of a source type
Creates a source of the specified type with the specified settings.
The “source” context is used for anything related to presenting
or modifying video/audio. Use obs_source_release() to release it.
id – The source type string identifier
name – The desired name of the source. If this is not unique, it will be made to be unique
settings – The settings for the source, or NULL if none
hotkey_data – Saved hotkey data for the source, or NULL if none
A reference to the newly created source, or NULL if failed
Creates a ‘private’ source which is not enumerated by
obs_enum_sources(), and is not saved by
obs_save_sources().
Author’s Note: The existence of this function is a result of design
flaw: the front-end should control saving/loading of sources, and
functions like obs_enum_sources() and
obs_save_sources() should not exist in the back-end.
id – The source type string identifier
name – The desired name of the source. For private sources, this does not have to be unique, and can additionally be NULL if desired
settings – The settings for the source, or NULL if none
A reference to the newly created source, or NULL if failed
Duplicates a source. If the source has the
OBS_SOURCE_DO_NOT_DUPLICATE output flag set, this only returns a
new reference to the same source. Either way,
release with obs_source_release().
source – The source to duplicate
desired_name – The desired name of the new source. If this is not a private source and the name is not unique, it will be made to be unique
create_private – If true, the new source will be a private source if fully duplicated
A new source reference
Returns an incremented reference if still valid, otherwise returns
NULL. Use obs_source_release() to release it.
Releases a reference to a source. When the last reference is released, the source is destroyed.
These functions are used to get an incremented weak reference from a strong source
reference, or an incremented strong source reference from a weak reference. If
the source is destroyed, obs_weak_source_get_source will return
NULL. Release with obs_weak_source_release() or
obs_source_release(), respectively.
Adds/releases a weak reference to a source.
Notifies all reference holders of the source (via
obs_source_removed()) that the source should be released.
true if the source should be released
Gets/sets the hidden property that determines whether it should be hidden from the user. Used when the source is still alive but should not be referenced.
Capability flags of a source
Author’s Note: “Output flags” is poor wording in retrospect; this should have been named “Capability flags”, and the OBS_SOURCE_* macros should really be OBS_SOURCE_CAP_* macros instead.
See obs_source_info.output_flags for more information.
Calls obs_source_info.get_defaults to get the defaults
settings of the source type.
The default settings for a source type
Use these functions to get the properties of a source or source type. Properties are optionally used (if desired) to automatically generate user interface widgets to allow users to update settings.
The properties list for a specific existing source. Free with
obs_properties_destroy()
true if the the source has custom properties, false otherwise
Updates the settings for a source and calls the
obs_source_info.update callback of the source. If the
source is a video source, the obs_source_info.update will
be not be called immediately; instead, it will be deferred to the
video thread to prevent threading issues.
Same as obs_source_update(), but clears existing settings
first.
Renders a video source. This will call the
obs_source_info.video_render callback of the source.
Calls the obs_source_info.get_width or
obs_source_info.get_height of the source to get its width
and/or height.
Author’s Note: These functions should be consolidated in to a single function/callback rather than having a function for both width and height.
The width or height of the source
Calls the obs_source_info.video_get_color_space of the
source to get its color space. Assumes GS_CS_SRGB if not implemented.
Disabled filters are skipped, and async video sources can figure out the color space for themselves.
The color space of the source
Hints whether or not the source will blend texels.
Whether or not the source will blend texels
The settings string for a source. The reference counter of the
returned settings data is incremented, so
obs_data_release() must be called when the
settings are no longer used
The name of the source
The UUID of the source
Added in version 29.1.
Sets the name of a source. If the source is not private and the name is not unique, it will automatically be given a unique name.
true if the source is a scene
true if the source is a group
- return:
The source’s type identifier string. If the source is versioned, “_vN” is appended at the end, where “N” is the source’s version.
The source’s unversioned type identifier string.
The source’s signal handler. Should not be manually freed, as its lifecycle is managed by libobs.
See the Common Source Signals for more information on signals that are available for sources.
The procedure handler for a source. Should not be manually freed, as its lifecycle is managed by libobs.
Sets/gets the user volume for a source that has audio output.
Sets/gets whether the source’s audio is muted.
Gets the current speaker layout.
Sets/gets the audio balance value.
Sets/gets the audio sync offset (in nanoseconds) for a source.
Sets/gets the audio mixer channels (i.e. audio tracks) that a source outputs to, depending on what bits are set. Audio mixers allow filtering specific using multiple audio encoders to mix different sources together depending on what mixer channel they’re set to.
For example, to output to mixer 1 and 3, you would perform a bitwise OR on bits 0 and 2: (1<<0) | (1<<2), or 0x5.
Sets/gets the desktop audio monitoring type.
order –
Sets/gets the audio active status (controls whether the source is shown in the mixer).
Enumerates active child sources or source tree used by this source.
Relevant data types used with this function:
typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
obs_source_t *child, void *param);
Sets/gets whether push-to-mute is enabled.
Sets/gets the push-to-mute delay.
Sets/gets whether push-to-talk is enabled.
Sets/gets the push-to-talk delay.
true if active, false if not. A source is only considered active if it’s being shown on the final mix
true if showing, false if not. A source is considered showing if it’s being displayed anywhere at all, whether on a display context or on the final output
Increments/decrements a source’s “showing” state. Typically used when drawing a source on a display manually.
flags – OBS_SOURCE_FLAG_FORCE_MONO Forces audio to mono
Enumerates active filters on a source.
Relevant data types used with this function:
typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
obs_source_t *child, void *param);
The desired filter, or NULL if not found. The reference of the filter is incremented
Copies filters from the source to the destination. If filters by the same name already exist in the destination source, the newer filters will be given unique names.
Copies the filter from the source to the destination. If a filter by the same name already exists in the destination source, the newer filter will be given a unique name.
Returns the number of filters the source has.
Backs up and restores the current filter list and order.
Enables/disables a source, or returns the enabled state.
Adds/removes an audio capture callback for a source. This allows the ability to get the raw audio data of a source as it comes in.
Relevant data types used with this function:
typedef void (*obs_source_audio_capture_t)(void *param, obs_source_t *source,
const struct audio_data *audio_data, bool muted);
Sets/gets the deinterlace mode.
mode –
Sets/gets the deinterlace field order.
order –
Gets private front-end settings data. This data is saved/loaded
automatically. Returns an incremented reference. Use obs_data_release()
to release it.
Used for interacting with sources: sends a mouse down/up event to a source.
Used for interacting with sources: sends a mouse move event to a source.
Used for interacting with sources: sends a mouse wheel event to a source.
Used for interacting with sources: sends a got-focus or lost-focus event to a source.
Used for interacting with sources: sends a key up/down event to a source.
Calls the obs_source_info.icon_type to get the icon type.
Calls the obs_source_info.get_dark_icon to get the dark icon.
Calls the obs_source_info.get_light_icon to get the light icon.
Calls the obs_source_info.media_play_pause to pause or play media.
Calls the obs_source_info.media_restart to restart the media.
Calls the obs_source_info.media_stop to stop the media.
Calls the obs_source_info.media_next to go to the next media.
Calls the obs_source_info.media_previous to go to the previous media.
Calls the obs_source_info.media_get_duration to
get the media duration in milliseconds.
Calls the obs_source_info.media_get_time or
obs_source_info.media_set_time to get/set the
current time (in milliseconds) of the media. Will return 0
for non-media sources.
Calls the obs_source_info.media_get_state to get the state of the media.
Emits a media_started signal.
Emits a media_ended signal.
Get canvas this source belongs to (reference incremented)
Helper function to set the color matrix information when drawing the source.
color_matrix – The color matrix. Assigns to the ‘color_matrix’ effect variable.
color_range_min – The minimum color range. Assigns to the ‘color_range_min’ effect variable. If NULL, {0.0f, 0.0f, 0.0f} is used.
color_range_max – The maximum color range. Assigns to the ‘color_range_max’ effect variable. If NULL, {1.0f, 1.0f, 1.0f} is used.
Helper function to draw sprites for a source (synchronous video).
image – The sprite texture to draw. Assigns to the ‘image’ variable of the current effect.
x – X position of the sprite.
y – Y position of the sprite.
cx – Width of the sprite. If 0, uses the texture width.
cy – Height of the sprite. If 0, uses the texture height.
flip – Specifies whether to flip the image vertically.
Outputs asynchronous video data. Set to NULL to deactivate the texture.
Relevant data types used with this function:
enum video_format {
VIDEO_FORMAT_NONE,
/* planar 4:2:0 formats */
VIDEO_FORMAT_I420, /* three-plane */
VIDEO_FORMAT_NV12, /* two-plane, luma and packed chroma */
/* packed 4:2:2 formats */
VIDEO_FORMAT_YVYU,
VIDEO_FORMAT_YUY2, /* YUYV */
VIDEO_FORMAT_UYVY,
/* packed uncompressed formats */
VIDEO_FORMAT_RGBA,
VIDEO_FORMAT_BGRA,
VIDEO_FORMAT_BGRX,
VIDEO_FORMAT_Y800, /* grayscale */
/* planar 4:4:4 */
VIDEO_FORMAT_I444,
/* more packed uncompressed formats */
VIDEO_FORMAT_BGR3,
/* planar 4:2:2 */
VIDEO_FORMAT_I422,
/* planar 4:2:0 with alpha */
VIDEO_FORMAT_I40A,
/* planar 4:2:2 with alpha */
VIDEO_FORMAT_I42A,
/* planar 4:4:4 with alpha */
VIDEO_FORMAT_YUVA,
/* packed 4:4:4 with alpha */
VIDEO_FORMAT_AYUV,
/* planar 4:2:0 format, 10 bpp */
VIDEO_FORMAT_I010, /* three-plane */
VIDEO_FORMAT_P010, /* two-plane, luma and packed chroma */
/* planar 4:2:2 format, 10 bpp */
VIDEO_FORMAT_I210,
/* planar 4:4:4 format, 12 bpp */
VIDEO_FORMAT_I412,
/* planar 4:4:4:4 format, 12 bpp */
VIDEO_FORMAT_YA2L,
/* planar 4:2:2 format, 16 bpp */
VIDEO_FORMAT_P216, /* two-plane, luma and packed chroma */
/* planar 4:4:4 format, 16 bpp */
VIDEO_FORMAT_P416, /* two-plane, luma and packed chroma */
/* packed 4:2:2 format, 10 bpp */
VIDEO_FORMAT_V210,
/* packed uncompressed 10-bit format */
VIDEO_FORMAT_R10L,
};
struct obs_source_frame {
uint8_t *data[MAX_AV_PLANES];
uint32_t linesize[MAX_AV_PLANES];
uint32_t width;
uint32_t height;
uint64_t timestamp;
enum video_format format;
float color_matrix[16];
bool full_range;
uint16_t max_luminance;
float color_range_min[3];
float color_range_max[3];
bool flip;
uint8_t flags;
uint8_t trc; /* enum video_trc */
};
Allows the ability to set rotation (0, 90, 180, -90, 270) for an async video source. The rotation will be automatically applied to the source.
Preloads a video frame to ensure a frame is ready for playback as soon as video playback starts.
Shows any preloaded video frame.
Outputs audio data.
Signals to any currently opened properties views (or other users of the source’s obs_properties_t) that the source’s presentable properties have changed and that the view should be updated.
Adds an active child source. Must be called by parent sources on child sources when the child is added and active. This ensures that the source is properly activated if the parent is active.
true if source can be added, false if it causes recursion
Removes an active child source. Must be called by parent sources on child sources when the child is removed or inactive. This ensures that the source is properly deactivated if the parent is no longer active.
If the source is a filter, returns the parent source of the filter. The parent source is the source being filtered. Does not increment the reference.
Only guaranteed to be valid inside of the video_render, filter_audio, filter_video, filter_add, and filter_remove callbacks.
If the source is a filter, returns the target source of the filter. The target source is the next source in the filter chain. Does not increment the reference.
Only guaranteed to be valid inside of the video_render, filter_audio, filter_video, and filter_remove callbacks.
Can be used by filters to directly render a non-async parent source without any filter processing.
Adds/removes a filter to/from a source.
Modifies the order of a specific filter.
movement –
Moves a filter to the specified index in the filters array.
index –
Added in version 30.0.
Gets the index of the specified filter.
Index of the filter or -1 if it is invalid/not found.
Added in version 30.0.
Default RGB filter handler for generic effect filters. Processes the filter chain and renders them to texture if needed, then the filter is drawn with.
After calling this, set your parameters for the effect, then call obs_source_process_filter_end to draw the filter.
true if filtering should continue, false if the filter is bypassed for whatever reason
Similar to obs_source_process_filter_begin, but also set the active color space.
true if filtering should continue, false if the filter is bypassed for whatever reason
Draws the filter using the effect’s “Draw” technique.
Before calling this function, first call obs_source_process_filter_begin and then set the effect parameters, and then call this function to finalize the filter.
Draws the filter with a specific technique in the effect.
Before calling this function, first call obs_source_process_filter_begin and then set the effect parameters, and then call this function to finalize the filter.
Skips the filter if the filter is invalid and cannot be rendered.
target –
An incremented reference to the source or destination
sources of the transition. Use obs_source_release()
to release it.
Clears the transition.
An incremented reference to the currently active source of
the transition. Use obs_source_release() to release it.
Starts the transition with the desired destination source.
mode – Currently only OBS_TRANSITION_MODE_AUTO
duration_ms – Duration in milliseconds. If the transition has
a fixed duration set by
obs_transition_enable_fixed(), this
parameter will have no effect
dest – The destination source to transition to
true if the transition is currently transitioning, false otherwise.
Sets/gets the dimensions of the transition.
Sets/gets the scale type for sources within the transition.
type –
Sets/gets the alignment used to draw the two sources within transition the transition.
alignment –
Sets/gets whether the transition uses a fixed duration. Useful for
certain types of transitions such as stingers. If this is set, the
duration_ms parameter of obs_transition_start() has no
effect.
The current transition time value (0.0f..1.0f)
Helper function used for rendering transitions. This function will render two distinct textures for source A and source B of the transition, allowing the ability to blend them together with a pixel shader in a desired manner.
The a and b parameters of callback are automatically rendered textures of source A and source B, t is the time value (0.0f..1.0f), cx and cy are the current dimensions of the transition, and data is the implementation’s private data.
The placeholder_texture parameter allows a callback to receive a replacement that isn’t the default transparent texture, including NULL if the caller desires.
Relevant data types used with this function:
typedef void (*obs_transition_video_render_callback_t)(void *data,
gs_texture_t *a, gs_texture_t *b, float t,
uint32_t cx, uint32_t cy);
Figure out the color space that encompasses both child sources.
The wider space wins.
The color space of the transition
Helper function used for transitioning audio. Typically you’d call this in the obs_source_info.audio_render callback with its parameters, and use the mix_a_callback and mix_b_callback to determine the the audio fading of source A and source B.
Relevant data types used with this function:
typedef float (*obs_transition_audio_mix_callback_t)(void *data, float t);
Swaps two transitions. Call obs_transition_swap_begin, swap the source, then call obs_transition_swap_end when complete. This allows the ability to seamlessly swap two different transitions without it affecting the output.
For example, if a transition is assigned to output channel 0, you’d
call obs_transition_swap_begin, then you’d call obs_set_output_source
with the new transition, then call
obs_transition_swap_begin().