Commit Graph

132 Commits (8f786db5f2f31867267173ea29f0ef6ecef94819)

Author SHA1 Message Date
jp9000 8f786db5f2 libobs: Refactor creation of scenes
Allows using a different source type (I.E. "group" instead of "scene").
2018-07-15 19:01:28 -07:00
jp9000 35704c4c04 libobs: Remove group_sceneitem from obs_scene struct
(This commit also modifies UI)

Removes obs_scene::group_sceneitem and replaces it with
obs_scene::is_group.  Changes a number of other functions related to
groups so that a group is not inherently tied to a specific scene, and
helps allow a single group to be referenced in multiple scenes if
desired.
2018-07-15 19:01:14 -07:00
Hunter L. Allen f838585b03 libobs: Remove unused variable 2018-07-01 12:03:26 -04:00
Hunter L. Allen b797b97bf6 libobs: Remove unused variable 2018-07-01 12:03:22 -04:00
Hunter L. Allen 31ad26ac3c libobs: Fix equality check
Removes a likely unintentional self-comparison.
2018-07-01 12:03:12 -04:00
Hunter L. Allen 6766565928 libobs: Add missing return type
As declared, transform_val is static inline, but it should be marked as
a static inline void since it does not return.
2018-07-01 12:01:47 -04:00
Hunter L. Allen f78a5426be libobs: Remove unused variable 2018-07-01 12:01:00 -04:00
vokama 4c73e5f6c5 libobs: Update hotkey label on scene item rename 2018-06-05 01:24:42 +03:00
jp9000 26d5560da3 libobs: Add scene item grouping
Allows the ability to group scene items.  Groups internally are
sub-scenes, which allows the ability to add unique filters and
transforms to each group.
2018-06-03 15:04:39 -07:00
jp9000 690f738a76 libobs: Add custom size support to scenes
Allows scenes to have a custom size.  Mainly used for grouping, but can
be extended with public API later.
2018-06-03 15:04:39 -07:00
jp9000 f0164f9d28 libobs: Do not signal reorder while scene mutex locked
Prevents a potential race condition with the scene mutex.
2018-06-03 15:04:39 -07:00
jp9000 ff52d34027 libobs: Defer and refactor scene item transform update
Defers updating the scene item transform to the graphics thread to
reduce the number of transform update calls.
2018-06-03 15:04:39 -07:00
jp9000 7a2337c1f2 libobs: Refactor item signaling (add func to signal parent) 2018-06-03 15:04:39 -07:00
jp9000 a1012c3f2c libobs: Do not draw item texture if source size 0 2018-06-03 15:04:39 -07:00
jp9000 b3dfd7ef80 libobs: Fix bug where cropped items would recalc transform
Fixes a bug where items that had cropping would recalculate transform
every frame.  obs_scene_item::last_width and obs_scene_item::last_height
would be set to the cropped sizes rather than the source's actual size.
2018-06-03 15:04:38 -07:00
jp9000 df88140e6a libobs: Zero scene data instead of setting members manually 2018-06-03 15:04:38 -07:00
jp9000 10fc206f98 libobs: Refactor obs_scene_add to allow adding internally
Allows using obs_scene_add_internal to add without sending signals.
2018-06-03 07:24:59 -07:00
jp9000 a79992eae9 libobs: Fix audio issue with scene items
When a scene is added as a scene item with the same audio sources that
are already in the current scene, it would cause the current scene to no
longer output audio due to audio.

To replicate the issue, you would create two separate audio device
captures in scene 1, use add existing in scene 2 and add one of those
audio sources, then go back to scene 1, add scene 2 as a source, then
make scene 1 invisible.
2018-01-09 18:13:32 -08:00
SuslikV c706742097 libobs: Fix scene filter duplication
Scene filters were not being copied when a scene was duplicated with
obs_scene_duplicate.

Closes jp9000/obs-studio#1104
2018-01-04 20:36:11 -08:00
jp9000 e70b226e7e libobs: Duplicate private scene/source settings
Ensures that private settings data is also duplicated when a scene or a
source is duplicated.
2017-11-30 05:05:06 -08:00
jp9000 2ef00ecec4 libobs: Add private settings to scene items/sources
Allows setting and sharing of user data for sources and scene items.
2017-09-13 21:17:44 -07:00
SuslikV 650495331d libobs: Add default hotkey id to duplicated item
Fixes https://obsproject.com/mantis/view.php?id=508

The toggle_visibility set only by init_hotkeys() call, but used each
time in obs_sceneitem_destroy() call.  Because zero hotkey_pair_id is
valid - we need to set item property other than zero here.

Closes jp9000/obs-studio#1000
2017-08-11 08:41:22 -07:00
Dmitry Odintsov 2a53d03d5f libobs: Fix item copying during scene duplication
When item in the old scene had only Scale Filter, texture renderer
was not created for an item in the new scene. However if the item also
had Crop set, the texture renderer was created.

Now after copying the data, texture renderer is created for the item in
the new scene when needed.

Closes jp9000/obs-studio#969
2017-07-21 08:48:05 -07:00
Michael Fabian Dirks f8b14bdb46 libobs: Ensure scene items don't have pre-multiplied alpha
Scene items would incorrectly have pre-multiplied alpha when they were
scaled with different scale filtering, when they were cropped, or when
the item itself was a scene.  This happens because the scene renders the
items to a texture in those cases, and when they are rendered to a
texture the blend function would be the default srcalpha/invsrcalpha
blend function, which would cause alpha to become pre-multiplied in the
texture's result rather than straight alpha.

This changes the behavior to directly copy the color/alpha to the
texture using the one/zero blend function instead, which makes the
resulting texture straight alpha.  (Note that you do not want to turn
off the blend mode for the same result because certain sources can have
custom drawing that may rely on blending being available)

Related Issue: https://obsproject.com/mantis/view.php?id=954

Closes jp9000/obs-studio#966
2017-07-21 08:30:14 -07:00
cg2121 fce078d997 UI, libobs: Add ability to lock individual scene items
Adds a lock checkbox to allow the user to lock a specific scene item.

Closes jp9000/obs-studio#949
2017-06-27 10:27:57 -07:00
jp9000 2c74fc36e2 libobs: Add scene item IDs
Adds a method of uniquely identifying scene items, as well as finding
those scene items via that unique ID.
2017-05-15 00:18:18 -07:00
jp9000 a5828610bb libobs: Fix bug where scenes would not properly mix audio 2017-02-26 08:20:54 -08:00
Richard Stanway 8b640fae24
Fix various null pointer issues detected by Coverity 2017-02-25 16:45:45 +01:00
jp9000 b1707b18b2 libobs: Add callback for enumerating all scene children
Prevents infinite recursion when adding children to a scene.
2017-01-16 09:55:15 -08:00
jp9000 3f976bec8b libobs: Fix scale filtering bug when duplicating scenes
When duplicating scenes, scene item scale filtering options would not be
preserved.
2017-01-15 09:15:44 -08:00
jp9000 e71137534c libobs: Process all scene audio actions if no audio playing
When there are audio sources in a scene and they've all stopped playing
their audio (audio is pending), all scene item audio actions (volume
changes, toggling visibility) will perpetually buffer and no longer be
processed until audio plays again.

So instead of that, if all audio sources have stopped playing in the
scene, just process all pending scene item audio actions immediately to
prevent them from never being processed while waiting for a scene item
to start playing audio.
2016-12-22 00:31:11 -08:00
jp9000 5fb9dcbaa7 libobs: Fix possible null pointer dereference 2016-07-09 07:41:13 -07:00
jp9000 4d61fa9a4c libobs: Use item texture if scene item is scene
Allows rendering scenes as scene items without off-screen sub-source of
the scene popping out on the sides.
2016-07-01 15:21:12 -07:00
jp9000 364cb9fb03 libobs: Use strings instead of enums when saving scale data
Saves the scene item scale filters as strings instead of enums.  It's
important to save data in a form that won't break if an API enum
changes.
2016-06-29 08:19:23 -07:00
jp9000 d49833830c libobs: Add ability to use scale filters on scene items
Allows the ability to use scale filters such as point, bicubic, lanczos
on specific scene items, disabled by default.  When using one of the
latter two options, if the item's scale is under half of the source's
original size, it uses the bilinear low resolution downscale shader
instead.
2016-06-29 08:00:54 -07:00
jp9000 acd8b612ee libobs: Reset projection transform when cropping
The crop texture would not always render correctly because the
projection matrix had not been set.
2016-03-31 11:01:29 -07:00
jp9000 eb1ee87f38 libobs: Add functions to crop individual scene items
Renders the scene item to a texture if crop is enabled; otherwise
renders directly.
2016-03-30 18:59:36 -07:00
jp9000 0d7a969ebf libobs: Add functions to defer scene item update
Allows the ability to defer updating the item transform until all
functions have been executed.
2016-03-30 18:35:59 -07:00
jp9000 f3df14374f libobs: Fix obs_scene_duplicate excluding rotatation 2016-02-04 10:10:53 -08:00
jp9000 6f98bd9fed libobs: Use calldata with stack for simple signals
Makes signals use stack memory rather than allocate memory each time.
Most likely a completely insignificant and pointless optimization.
2016-01-26 11:49:56 -08:00
jp9000 91ebb5c5e0 libobs: Add comment warning about scene mutex lock ordering
A comment that serves as a reminder to anyone who might need to edit the
scene code.  If the graphics mutex must be locked, it must be locked
first before entering the scene mutexes, or outside of the scene
mutexes.
2016-01-26 11:49:55 -08:00
jp9000 a61933dd8e (API Change) libobs: Add 'type' to obs_scene_duplicate
(Note: This commit also modifies the UI)

Allows the ability to duplicate sources fully copied, and/or have the
scene and its duplicates be private sources
2016-01-26 11:49:52 -08:00
jp9000 6824910f5d libobs: Add obs_scene_create_private function
Creates a scene marked as a private source
2016-01-26 11:49:52 -08:00
jp9000 234cb5802f libobs: Release scene items outside of scene mutexes
Prevents a mutual lock with the scene mutex and graphics mutex.  In
libobs/obs-video.c, the graphics mutex could be locked first, then the
scene mutexes second, while in the UI thread, the scene mutexes could be
locked first, then when a scene item is being destroyed, a source could
be destroyed, and sometimes sources would lock the graphics mutex
second.

A possible additional solution is to defer source destroys to the video
thread.
2016-01-26 11:49:41 -08:00
jp9000 ed10b1ab57 libobs: Allow add_alignment to be used by other source files 2016-01-26 11:49:40 -08:00
jp9000 e68331e988 libobs: Add source type OBS_SOURCE_TYPE_SCENE
Helps identify a scene without having to compare its type name to
"scene".
2016-01-26 11:49:38 -08:00
jp9000 b0104fcee0 (API Change) libobs: Remove source_type param from functions
(Note: test and UI are also modified by this commit)

API Changed (removed "enum obs_source_type type" parameter):
-------------------------
obs_source_get_display_name
obs_source_create
obs_get_source_output_flags
obs_get_source_defaults
obs_get_source_properties

Removes the "type" parameter from these functions.  The "type" parameter
really doesn't serve much of a purpose being a parameter in any of these
cases, the type is just to indicate what it's used for.
2016-01-26 11:49:37 -08:00
jp9000 3c68196c5c libobs: Buffer scene item visibility actions
This buffers scene item visibility actions so that if
obs_sceneitem_set_visible to true or false, that it will ensure that the
action is mapped to the exact sample point time in which
obs_sceneitem_set_visible is called.  Mapping to the exact sample point
isn't necessary, but it's a nice thing to have.
2016-01-26 11:49:36 -08:00
jp9000 247a42c2a1 libobs: Make scenes mix audio of sub-sources
Mark scenes as composite sources and use audio_render to mix and output
the audio of their sub-sources.
2016-01-26 11:49:35 -08:00
jp9000 40d6f986e6 libobs: Split scene mutex to improve performance
Splits the scene mutex in to an audio/video mutex to allow video/audio
thread to use the same data at the same time without locking on each
other.
2016-01-26 11:49:34 -08:00