Commit graph

246 commits

Author SHA1 Message Date
Exeldro 806c72fc66 libobs: Save crop to bounds when saving transform states
(Lain note: Splitting parent commit. This was probably unintentionally
not taken into account in the origin crop_to_bounds PR.)
2024-02-20 21:18:51 -06:00
Exeldro f275080abb libobs: Fix crop to bounds ABI break 2024-02-20 21:18:51 -06:00
derrod 6fea91067f libobs: Pass parent pointer into signal_item_remove
With aaf8d8b38f changing the order
item->parent would be NULL thus resulting in a crash.
2024-01-07 02:28:53 +01:00
derrod aaf8d8b38f libobs: Send item_remove signal after detaching item 2024-01-06 17:48:37 -06:00
derrod f6c8fe7b64 libobs: Fix crop to bounding box not being duplicated with item 2024-01-03 22:03:16 +01:00
derrod 7e456d9dea libobs: Add automatic cropping to bounds for scene items 2023-12-16 18:00:11 -06:00
sora-blue 8fc0489e4a
libobs: Fix scene_enum_sources skipping some active sources
If an item's show/hide transition was active the underlying source
would not previously not be enumerated, resulting in reference leaks by
the UI or other components waiting for the source to be deactivated to
release it.
2023-12-08 14:10:12 +01:00
tt2468 76f332a379 libobs: Consolidate scene item remove code
Removes the internal helper `remove_without_release()` and branches
`obs_sceneitem_remove()` into public and internal versions.

The `obs_sceneitem_set_transition()` calls were missing from the
`remove_without_release()` function, so this resolves that issue
implicitly. Code cleanup mentioned above is done to hopefully avoid
these mistakes again.
2023-11-18 17:30:11 -06:00
Norihiro Kamae 9391ab305e libobs: Fix memory leak when migrating from legacy scene item data
Before the commit 763dddbbaf, hotkeys to show and hide scene items are
distinguished by source name instead of ID. When migrating from the
legacy data structure, the pointer to the data was not released.
2023-11-16 16:27:23 -05:00
tt2468 3e6797ca5b libobs: Fix crash in obs_sceneitem_remove() when already removed
An already-removed item has a NULL `item->parent`, meaning that calling
`full_lock(scene)` results in undefined behavior. This makes the method
return earlier if the specified item is removed instead of attempting
to lock the scene.

No thread safety is changed, because it wasn't thread-safe to begin
with.
2023-11-13 22:37:42 -08:00
derrod 731da1be6b libobs: Fix hotkeys when reordering sceneitems into/out of groups 2023-10-08 02:00:46 +02:00
derrod 763dddbbaf libobs: Distinguish sceneitem hotkeys by id 2023-10-08 02:00:46 +02:00
derrod 4bb2365a62 libobs: Specify scene item IDs on creation 2023-10-08 02:00:46 +02:00
Penwywern 23ca4cf704 libobs: Fix flip calculations in bounding box
This fixes flipping behaviour when positional alignement inside the
bounding box is other than centered, bringing it in line with the
behaviour when centered, i.e. flip the item in-place in the bounding
box.
2023-07-25 16:01:04 -07:00
Penwywern 8789c43959 libobs: Fix flip not working with stretch to bounds 2023-07-08 16:42:15 -07:00
Norihiro Kamae 8169188f89 libobs: Define DARRAY macro types
To avoid passing `struct darray *` type, which cannot hold the type
information, this commit defines array types and uses that types on the
function parameters.
2023-07-01 00:39:13 -07:00
derrod 0cb812251c libobs: Add scene uuid to transform state data 2023-06-28 11:04:56 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
Jim 38e5411490 libobs: Prevent setting invalid scene item scale values
Fixes obsproject/obs-studio#7962
2023-05-19 17:31:14 -07:00
cg2121 d291830d23 libobs: Copy private scene item data when duplicating scenes
For example, this makes sure scene item colors are copied when
duplicating a scene. This also removed the now redundant private data
variable.
2023-03-25 18:30:31 -07:00
Jim 6eace37e06
Merge pull request #8229 from derrod/hashed-tables
Hashtable Adventures
2023-03-19 00:34:44 -07:00
Norihiro Kamae 434bdc1768 libobs: Fix possible use-after-free of obs_scene_t
When creating a group, a newly allocated group `sub_scene` is released
just after calling `obs_scene_add_internal`.
If another thread released the scene-item, which is the sub_scene,
use-after-free might happen.
2023-03-18 15:34:47 -07:00
derrod c68eeaef1d libobs: Use uthash for source objects
All sources are part of a hash table that allows a lookup by UUID.
Public sources additionally are in a hash table allowing lookup by name.
2023-03-18 10:47:49 +01:00
derrod 29db52ad27 libobs: Save/Load source UUID in scene item data 2023-03-12 01:11:38 +01:00
Frank 20a3ec4a2f libobs: Fix scene_audio_render() incorrectly mixing audio
When the `pos` variable is non-zero, audio does not get mixed correctly.
This is due to the fact that the `pos` variable was erroneously being
applied to the input rather than the output.
2023-02-25 19:25:15 -08:00
PatTheMav fb7a9edadc libobs: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
Norihiro Kamae ee6ddeeaed libobs: Avoid position underflow when mixing audio sources
When a variable `pos` became larger than `AUDIO_OUTPUT_FRAMES`, `count`
will get overflowed number. To avoid the overflow, continue the loop
when `AUDIO_OUTPUT_FRAMES - pos` is not positive.
2023-02-11 15:22:17 -08:00
tt2468 018ce16703 libobs: Fix loading of custom_size for empty scenes
Previously, `custom_size` was checked at the end of the `scene_load`
function. If the scene contained no "items" array, the `custom_scene`
loading code would never be run.

This moves the `custom_size` code above the return statement.
2023-01-22 10:26:47 +11:00
tytan652 9cde3c302c libobs: Fix all-except-one switches 2023-01-16 11:52:17 +01:00
tytan652 7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01:00
Antti Tapaninen c7f4c78a69 libobs: Allow overriding video resolution per view 2022-11-19 15:34:54 -08:00
jpark37 3d985f7c60 libobs: Fix blend method in studio mode
Property was not being copied over.
2022-10-29 16:15:58 -07:00
tytan652 12657e4fcc libobs: Replace OBS_UNUSED with UNUSED_PARAMETER
OBS_UNUSED is not portable to MSVC.
2022-07-20 08:22:08 +02:00
tytan652 348cf1b872 libobs: Remove unused parameters 2022-07-20 08:21:20 +02:00
Norihiro Kamae af3890a4a9 libobs: Cleanup unused-parameters
- Add OBS_UNUSED to unused function parameters
- Remove unnecessary UNUSED_PARAMETER
Also update libobs-opengl/
2022-07-19 11:01:00 -04:00
PatTheMav ff7f756886 libobs: Explicitly mark variables as unused 2022-07-10 09:59:55 +10:00
jpark37 d7fb4361a5 libobs: Lock scene to video color space
Fixes studio mode preview on SDR monitor for HDR canvas rendering SDR
source into SDR swap chain. Needs to render SDR source into HDR render
target, and then tonemap into SDR swap chain for preview.
2022-05-14 16:40:28 -07:00
Andrew Story 961b75b58c libobs,UI: Issue appropriate signals on group / ungroup
Due to the way the frontend works, the logic for inserting the row for
the group in the UI was dropped since the new item_add message will
insert one automatically since it forces a refresh of the scene items.
The reliance on that implicit row insertion when grouping items is a
bit of a code smell, although the alternative would be to add logic to
disable handling the signal for that instant, which is probably a
worse choice.
2022-04-24 12:09:38 -07:00
Richard Stanway 42ce624b13
libobs: Remove unnecessary blend_type assignment
The code pattern for all other assignments skips the default value.
Detected by PVS Studio.
2022-04-19 03:16:48 +02:00
Richard Stanway 0bc955bdf2
libobs: Fix wrong enum in obs_sceneitem_get_blending_method
Detected by PVS Studio.
2022-04-19 03:16:48 +02:00
jpark37 59dbc3eb81 libobs: Rename Rec. 2020 to Rec. 2100
Rec. 2020 is really an SDR spec, but I think HDR10 made it okay to slap
PQ on it, call it an HDR spec. Rec. 2100 came along after and formally
allowed the use of PQ/HLG, so we should use 2100 instead.
2022-04-10 00:13:52 -07:00
jpark37 06111d5b10 libobs: Add high-precision sRGB support 2022-04-08 17:19:23 -07:00
jpark37 e638cc9f82 libobs: Add support for nonlinear SRGB blending 2022-04-02 16:02:41 -07:00
jpark37 525f964b3d libobs: Add color space management
This provides the framework for automatically compositing SDR and HDR
sources together. Source will need to leverage the new
video_get_color_space to opt into HDR support.
2022-03-26 13:00:34 -07:00
Exeldro 1e242d3630 libobs: Unload show/hide transition on load if none
Fixes an issue where a scene item's show/hide transition would stick
around if there was no show/hide transition in the loaded data
2022-03-24 23:51:10 -07:00
jp9000 4685276d06 libobs: Refactor small bit of code 2022-03-24 23:03:52 -07:00
jp9000 e236a16715 libobs: Refactor hide/show transition functions
Having two separate functions for each hide/show transition action is
silly and makes code awful.
2022-03-24 22:32:41 -07:00
Jim 0523c2e5e9 libobs: Replace addref calls with get_ref 2022-01-24 14:06:50 -08:00
Jim f29e5ffbc7 libobs: Add obs_scene_get_ref() 2022-01-24 14:06:47 -08:00
jw0z96 447b17e75e libobs: Implement additional source blending modes 2021-12-20 09:06:38 -08:00