0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

465 Commits

Author SHA1 Message Date
Clayton Groeneveld
4b00c8566f libobs, docs: Add function to get source version 2021-10-28 09:14:23 -07:00
jp9000
9819cb2924 libobs: Add obs_weak_source_expired() 2021-10-15 22:10:33 -07:00
jp9000
9ef76e1f9b libobs: Clear unused pointers for obs_source_output_audio()
Apparently, some audio filters do not check the audio channel/plane
count, and instead check to see if a pointer is valid. Instead of
requiring the caller to initialize these values to 0 manually (they
shouldn't have to), set them to zero upon input in
obs_source_output_audio() itself.

Closes obsproject/obs-studio#3744
2021-10-06 16:33:31 -07:00
jp9000
49dad0a935 Revert "libobs: Don't return/set 0 mixers for non-audio sources"
This reverts commit 1df2789978.

This causes new sources to have their default mixer value overriden,
reverting until a more ideal fix is approved
2021-10-04 10:37:51 -07:00
jp9000
1df2789978 libobs: Don't return/set 0 mixers for non-audio sources
Fixes a bug where if an audio source's implementation disappears (i.e.
a plugin vanishes or is removed), it would turn all mixing channels off,
effectively muting the source
2021-10-02 10:16:24 -07:00
jpark37
353868e87c libobs: Fix pthread mutex leaks 2021-08-23 22:57:10 -07:00
jpark37
96c1a76523 libobs: Avoid recycling async frames
Fixes major cause of lock contention when using lots of media sources.
2021-08-15 00:12:14 -07:00
jpark37
8440a53da3 libobs: Round up chroma sizes for odd resolutions
When playing video, OBS can overflow and crash, or render video edges
incorrectly if the video resolution does not divide into 2 for trivial
chroma subsampling. This is fixed by rounding chroma plane sizes up
instead of down, and maintaining that through the video pipeline.
2021-07-23 12:02:06 -07:00
jpark37
7c72fd1d4c libobs: Plumb texcoord hint to reduce GPU cost
In order to do linear-correct filtering cheaply when scale filtering is
disabled, we need to know whether or not texture coordinates will always
sample from texel centers. This can be computed at the scene item level
relatively easily, and passed along to sources when rendering. Scene
items will use obs_source_set_texcoords_centered to set hint status, and
sources will use obs_source_get_texcoords_centered to retrieve it.
2021-07-11 08:26:29 -07:00
jpark37
c021338ceb libobs,deps/media-playback: Avoid bitfields
Use unused padding of obs_source_frame/obs_source_frame2 instead.
2021-06-11 07:02:37 -07:00
jpark37
1fa152092c libobs: Plumb linear alpha flag
Use union for backwards compatibility.
2021-06-04 19:04:08 -07:00
jpark37
35c07bb7e6 libobs: Restrict direct filtering to SRGB match
Fixes issue where color-correction filter v1 changes from v26 to v27.
2021-05-31 12:33:55 -07:00
jpark37
8cf28ceafd libobs: Straight alpha blend for filtered inputs
This is necessary if the source contains overlapping draws.
2021-05-22 05:48:26 -07:00
jpark37
c1948c16b0 libobs: Fix direct rendering test
Pass test if the filter wants SRGB, and the source supports SRGB.
2021-05-11 03:08:49 -07:00
jpark37
ef72eb70ec libobs: Fix uninitialized variable warning 2021-05-08 14:12:54 -07:00
jpark37
ae7718a765 libobs, obs-filters: SRGB backwards compatibility
Add OBS_SOURCE_SRGB to indicate sources that support SRGB rendering. We
can use this flag to know which sources do not know how to handle SRGB,
and disable accordingly inside obs_source_main_render().

We can also use this flag to clean up the filter interface and remove
the SRGB-specific functions. We also need to disable direct rendering if
the filter source wants to render SRGB, but the parent source does not
support it.

Scenes and groups are marked as having SRGB support, and those are
internal sources that we control.
2021-05-03 01:19:56 -07:00
jp9000
60447872c0 libobs: Add obs_source_reset_settings()
Allows the ability to reset (erase) a source's existing settings and
replace them with new settings. This is useful for things such as
reverting to older settings.
2021-04-30 18:37:38 -07:00
jp9000
0fd1238d45 libobs: Add functions to backup/restore filters
Adds functions to backup and restore filters (along with their order) on
a specified source. Useful for undo/redo operations.
2021-04-30 00:11:52 -07:00
jpark37
a44e09f2e4 libobs: Don't force premultiplied alpha on filters
Many filters need to remultiply alpha on output.
2021-04-28 18:09:52 -07:00
Jim
81e9ad818f
Merge pull request #4587 from jpark37/alpha-hack
Apply alpha in nonlinear space for images and async video
2021-04-25 11:26:21 -07:00
tt2468
cb6a381823 libobs: Fix crash in missingfiles when source is invalid 2021-04-25 09:36:50 -07:00
jpark37
aed52412d4 libobs: Render async video with DrawNonlinearAlpha
Match previous OBS alpha behavior.

DrawNonlinearAlpha requires premultiplied alpha blend state.
2021-04-25 02:13:01 -07:00
jpark37
50dfa566e6 libobs: Filter using premultiplied alpha
Convert incoming straight alpha color to premultiplied at filter begin,
and process premultiplied value at filter end.

If direct rendering is allowed, we assume the input source outputs
premultiiplied alpha. If not, that source will need to be updated.
2021-04-25 01:27:19 -07:00
jp9000
ca08df9fb2 libobs: Add obs_source_load2()
Allows loading a source and all of its filters automatically.
Previously, the original obs_source_load would not load filters.
2021-04-09 04:30:29 -07:00
jp9000
0ecf24d0ed libobs: Add obs_source_enum_full_tree()
Allows the ability to enumerate all sources and subsources in a source's
hierarchy, regardless of whether they're active or not.
2021-04-09 04:30:29 -07:00
jpark37
9220316700 libobs: Add filter functions for SRGB support
This way, legacy filters can use the original functions without
triggering SRGB support.
2021-04-04 00:58:38 -07:00
Jim
5d87f3c00b
Merge pull request #3426 from Programatic/undo_redo
UI: Implement Undo/Redo System
2021-03-30 03:16:24 -07:00
Ford Smith
60d95cb5bd UI/libobs: Undo/Redo Sources and Scenes
Implements the Undo/Redo for scenes and sources, ranging from renaming,
deletion, addition. It also adds several elements to libobs that were
designed to facilitate undo/redo, and should not affect the rest of
libobs.
2021-03-29 03:06:26 -04:00
Anton Bershanskiy
54cbd98d91 libobs: add helper for source filter count
Add function size_t obs_source_get_filter_count(obs_source_t *source)
which returns the number of filters a source has. Update docs for it.
2021-03-16 21:38:06 -07:00
Richard Stanway
6c0d234385 libobs: Minor fixes / code cleanups
Fixes some warnings generated by code analysis tools, removing redundant
checks etc.
2021-03-04 19:29:33 +01:00
Jim
2eca4d80b6
Merge pull request #2233 from VodBox/missing-files-dialog
libobs + UI: Add Missing Files API & Dialog
2021-01-31 08:02:16 -08:00
jpark37
66259560e0 libobs: Add dormant SRGB format support
GS_RGBA, GS_BGRX, and GS_BGRA now use TYPELESS DXGI formats, so we can
alias them between UNORM and UNORM_SRGB as necessary. GS_RGBA_UNORM,
GS_BGRX_UNORM, and GS_BGRA_UNORM have been added to support straight
UNORM types, which Windows requires for sharing textures from D3D9 and
OpenGL. The D3D path aliases via views, and GL aliases via
GL_EXT_texture_sRGB_decode/GL_FRAMEBUFFER_SRGB.

A significant amount of code has changed in the D3D/GL backends, but the
concepts are simple. On the D3D side, we need separate SRVs and RTVs to
support nonlinear/linear reads and writes. On the GL side, we need to
set the proper GL parameters to emulate the same.

Add gs_enable_framebuffer_srgb/gs_framebuffer_srgb_enabled to set/get
the framebuffer as SRGB or not.

Add gs_linear_srgb_active/gs_set_linear_srgb to instruct sources that
they should render as SRGB. Legacy sources can ignore this setting
without regression.

Update obs_source_draw to use linear SRGB as needed.

Update render_filter_tex to use linear SRGB as needed.

Add gs_effect_set_texture_srgb next to gs_effect_set_texture to set
texture with SRGB view instead.

Add SRGB helpers for vec4 struct.

Create GDI-compatible textures without SRGB support. Doesn't seem to
work with SRGB formats.
2021-01-21 07:42:13 -08:00
VodBox
fb95e1d1e9 libobs: Add missing file API to sources 2021-01-17 10:31:58 +13:00
Richard Stanway
d0cbc83da2 libobs: Avoid unnecessary mallocs in audio processing 2021-01-02 14:53:19 +01:00
Colin Edwards
923f06bfa6 decklink: Add ability to ingest/embed cea 708 captions
(This commit also modifies libobs, UI)
2020-11-01 22:28:49 -08:00
Clayton Groeneveld
2b50263d5c UI, libobs: Add ability to copy/paste single filter 2020-10-15 10:14:22 -07:00
Richard Stanway
c8f7a4563d libobs: Check data validity for media sources 2020-08-29 02:42:03 +02:00
Jim
e36b9c309d
Merge pull request #3216 from Xaymar/pr-fix-obs_source_enum_full_tree
libobs: Call enum_all_sources in check for enum_all_sources
2020-08-22 15:09:42 -07:00
Valentin
4508cb03b5 libobs: Fix deferred update sometimes using stale data
Currently we use a bool flag to signal the video thread that it should
call obs_source_deferred_update. This does not work correctly when the
update callback is slow and the update is triggered faster than the
callback can complete.

For example:
* the settings are set to state A
* defer_update is set
* obs_source_deferred_update is called and enters into the callback
* the callback starts making use of the settings in state A
* the settings are set to state B
* defer_update stays set
* the callback finishes
* defer_update is set to false

Now defer_update is false but the callback has only observed settings in
state A but not B.

This commit fixes this bug by keeping an update counter. If the counter
has changed while we were in the callback we know that we need to update
again.

The counter is atomic. The current version uses a plain bool which is a
data race as the value is written and read in parallel.
2020-08-04 09:28:55 +02:00
jp9000
d117908440 libobs: Add func to set async video frame immediately
Allows the ability to directly override the current async frame
immediately.
2020-07-29 13:59:49 -07:00
Michael Fabian 'Xaymar' Dirks
127dce6bf6 libobs: Call enum_all_sources in check for enum_all_sources
Fixes a crash caused by checking for enum_all_sources and then calling
enum_active_sources instead of enum_all_sources. enum_active_sources is
not required for sources that specify enum_all_sources.
2020-07-27 01:53:58 +02:00
Richard Stanway
4f7767111a libobs: Update async texture when showing preloaded video
The previous preloaded video behavior updated the texture on preload
rather than when the video was shown, during which time the texture may
have been modified by other processes, resulting in the wrong frame
being displayed.
2020-07-23 23:54:10 +02:00
Jim
8b00f7d341
Merge pull request #3085 from eric/fix-audio-on-timestamp-jump
libobs: Reset audio data on timestamp jump
2020-07-10 17:35:44 -07:00
Jim
76c42215d6
Merge pull request #2755 from exeldro/keep_filters
libobs: Don't check filter compatibility on not loaded sources
2020-06-24 14:13:48 -07:00
Eric Lindvall
f79f816b72 libobs: Reset audio data on timestamp jump
To prevent issues in audio mixing make sure the audio data is also cleared
when audio timing is reset.
2020-06-20 14:55:31 -07:00
Jim
665180350d
Merge pull request #2657 from hselasky/improvement
libobs: Implement and use better scaling function for 64-bit integers
2020-05-21 18:07:53 -07:00
Exeldro
6a567eded6 libobs: Don't check filter compatibility on not loaded sources 2020-04-19 09:11:32 +02:00
Exeldro
74b9ae07f3 libobs: Don't allow duplicating scene sources 2020-04-17 12:40:25 +02:00
Hans Petter Selasky
0e4ea14ba1 libobs: Implement and use better scaling function for 64-bit integers
As os_gettime_ns() gets large the current scaling methods, mostly by casting
to uint64_t, may lead to numerical overflows. Sweep the code and use
util_mul_div64() where applicable.

Signed-off-by: Hans Petter Selasky <hps@selasky.org>
2020-04-05 20:27:28 +02:00
jpark37
b12ab46e62 libobs: Fix size mismatch warning
memcpy unlikely to exceed 4 GB, but just make VS happy.
2020-03-19 11:22:15 -07:00