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

283 Commits

Author SHA1 Message Date
Chip Bradford
7e39ee291c libobs: Add support for multiple video mixes
Split render_texture and derived fields in obs_core_video into new
obs_core_video_mix struct. Add new APIs to add additional obs_view to the render loop, each with a separate render_texture / obs_core_video_mix.
2022-07-31 15:35:36 -07:00
OldBaldGeek
bb6787968c libobs: Fix issue 4408 (hotkey logic)
If obs_core_hotkeys.strict_modifiers is true (new default),
hotkey is triggered only if current key modifiers exactly match
the hotkey definition. If false, legacy behavior is selected.
2022-05-28 17:13:03 -07:00
Jim
952988d9ec
Merge pull request #6231 from mvji/prores_pix_fmt
Add support for GPU conversion of YUV422P10LE, YUV444P12LE, YUVA444P12LE
2022-05-04 02:01:27 -07:00
jp9000
f482111791 libobs: Add ability to configure audio buffering latency
Allows a frontend the ability to set the maximum audio buffering
latency, and specify whether that audio buffering is either fixed (to
the maximum audio buffering latency), or dynamically increasing from 0.

This will be useful if the user wishes to output audio to devices or
through a virtual audio device at a guaranteed minimal latency.
2022-04-24 08:44:33 -07:00
mvji
d3a8ef7128 libobs: Add support for YUV422P10LE, YUV444P12LE, YUVA444P12LE 2022-04-19 19:37:07 +02:00
jpark37
338608bd67 libobs,UI: Support HLG nominal peak level
HLG output uses MovieLabs-recommended procedure.

- If peak luminance is greater than 1000, use maxRGB EETF to 1000.
- Otherwise, don't tonemap.
- Then use normal HLG conversion procedure with gamma 1.2 (1000 nits).
2022-04-14 09:36:44 -07: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
848e128435 libobs,plugins: Replace video matrix function
video_format_get_parameters_for_format provides a more accurate matrix
than video_format_get_parameters.
2022-04-07 19:28:51 -07:00
jpark37
0ed0f2cdb4 libobs: Add I010/P010 support, TRC enum 2022-04-03 00:01:25 -07:00
jpark37
f0f0cb3038 libobs: Fix stale active_copy_surfaces entries 2022-03-26 10:06:21 -07:00
jpark37
692ca7efce libobs: Add Rec. 2020 video_colorspace enum values
One for PQ, and one for HLG. Including transfer function as part of the
color space simplifies logic by avoid invalid combinations.
2022-03-24 20:56:19 -07:00
jpark37
87ab39c412 libobs: Render main texture for active color space
Preview will draw SDR white luminance from settings (default 300 nits)
when displayed on an HDR monitor rather than CCCS 80 nits.
2022-03-23 22:35:27 -07:00
jpark37
cd22df09c9 libobs, UI: Add SDR white nits option 2022-03-23 22:35:26 -07:00
jpark37
c4fb34897e libobs: NV12 textures only for active GPU encoders
Intel GPUs in particular are slow to copy NV12/P010 textures. We can use
ordinary UNORM textures for CPU encoders.
2022-03-19 15:39:09 -07:00
Clayton Groeneveld
3df2f3e069 libobs: Add function to load private sources
If a private source is loaded with the obs_load_source function,
it is loaded as a normal source, so add a new function
to load private sources.
2022-03-08 01:49:24 -08:00
jp9000
edfd5ad604 libobs: Add obs_object abstraction and functions
With this, you can now cast normal obs objects (services, outputs,
sources, encoders) to an obs_object_t, and then use obs_object_*
functions to get references, release references, and similar for weak
object references as well. This allows the ability for the frontend to
use an object of any of those types interchangeably in certain
situations without having to handle each specific type individually.

This is useful because the properties view in particular doesn't care
what type of object it uses, it just needs to be able to hold weak
references to abstract OBS objects.
2022-02-02 22:35:56 -08:00
Jim
0523c2e5e9 libobs: Replace addref calls with get_ref 2022-01-24 14:06:50 -08:00
Exeldro
b2360b4332 libobs: Don't destroy mutex before destroying sources is done 2022-01-22 15:32:42 -08:00
tt2468
167f539416 libobs: Rename obs_audio_monitoring_supported to _available
With the reasonable possibility of monitoring support becoming a
runtime check, the phrase `available` is more fitting.
2021-12-22 02:43:14 -08:00
jp9000
49f9a055dc libobs: Fix destruction order for destruction task queue
Destruction of the task queue should probably happen after the audio and
video threads have been destroyed and all audio/video processing has
stopped.
2021-12-21 11:48:29 -08:00
jp9000
8b3416c1e7 libobs: Implement deferred destruction of sources
(This also modifies the UI)

The purpose of deferring destruction of sources is to ensure that:
1.) Hard locks from enumeration cannot occur with source destruction.
  For example, if the browser source is destroyed while in the graphics
  thread, the browser thread would wait for the graphics thread, but the
  graphics thread would still be waiting for the browser thread, causing
  a hard lock.
2.) When destroys occur during source enumeration, that the integrity of
  the context's next pointer in the linked list can no longer be
  compromised
3.) Source releases are fully asynchronous rather than having the risk
  of stalling the calling thread
4.) We can wait for source destruction when switching scene collections
  or when shutting down rather than hoping for threads to be finished
  with sources.

This introduces a new requirement when cleaning up scene/source data:
the obs_wait_for_destroy_queue() function. It is highly recommended that
this function be called after cleaning up sources. It will return true
if at least one or more sources were destroyed. Otherwise it will return
false. Forks are highly advised to call this function manually on source
cleanup -- preferably in a loop, in conjunction with processing
outstanding OBS signals and UI events.
2021-12-19 11:53:19 -08:00
jp9000
ab84214356 libobs: Add obs_in_task_thread() function
Allows determining which thread the caller is currently in, if any
2021-12-19 11:53:19 -08:00
jp9000
cf492ca271 libobs: Add ability to queue audio task
This is mostly framework for allowing the ability to wait for certain
threads
2021-12-19 11:53:14 -08:00
jp9000
408ce92146 Revert "libobs: Do not release while traversing sources for tick"
This reverts commit 080090c40e.
2021-12-19 11:25:57 -08:00
jp9000
080090c40e libobs: Do not release while traversing sources for tick
obs_source_release should not be called while iterating through the
global sources linked list, otherwise the linked list will be
compromised. Annoying.

Basically the same fix as obsproject/obs-studio#5600, but should be
slightly more optimal and a bit more explicit.
2021-12-15 11:57:52 -08:00
jp9000
243880b9ce libobs: Fix add/remove of raw audio callbacks 2021-11-28 02:49:04 -08:00
Clayton Groeneveld
d45e92c10c libobs: Add raw audio callback function
This complements the already existing raw video callback function.
2021-11-24 01:32:31 -08:00
tt2468
ff22897d68 libobs/UI: Stop using preprocessor directives for monitor
**Code Cleanup**
Stop using preprocessor directives to determine if audio monitoring
is supported. Use runtime function instead
2021-11-20 20:00:59 -08:00
gxalpha
c36a5ae92b libobs: Add obs_get_transition_by_name 2021-11-07 07:40:03 -08:00
jpark37
353868e87c libobs: Fix pthread mutex leaks 2021-08-23 22:57:10 -07:00
Richard Stanway
3dbfa4919a libobs: Add stop_audio function, change shutdown order
This fixes a crash that could occur during freeing of sources, as the
audio subsystem was destroyed before sources were released. If a source
had monitoring enabled, it would try to lock a mutex that has been
destroyed, resulting in a crash.

Freeing audio after obs_free_data was also not a solution, as the main
view is freed in obs_free_data, and the audio subsystem is still running
and trying to lock the main view channel mutex which has been freed.

This seems to be the best middle ground, making sure the audio subsystem
is stopped so it no longer tries to access the main view channel, then
freed after obs_free_data.

Fixes https://github.com/obsproject/obs-studio/issues/4409
2021-07-24 22:34:44 +02:00
tt2468
53a8a326da libobs: Add obs_enum_all_sources()
There is currently no way to enumerate *all* sources in OBS. Only
inputs and scenes have a way to be enumerated. Some applications
like obs-websocket have features that need to take advantage
of enumerating all sources in order to function properly.
2021-07-09 17:33:17 +12:00
jp9000
33c5563c1e libobs: Add obs_obj_is_private()
Returns true if an obs object is considered private. (Author's note: the
concept of "private" objects is not ideal, but we're stuck with it for
now)
2021-04-09 04:30:30 -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
Richard Stanway
6078dfef76 libobs: Don't save temporarily removed sources
The only references to these sources exist in the undo buffer, they are
not attached to a scene and cause issues when loaded on the next
startup.
2021-04-04 00:09:17 +02:00
Richard Stanway
cdbb216bd0 libobs: Remove unnecessary null check 2021-04-03 00:31:07 +02:00
Jim
5f00f8c42a
Merge pull request #3014 from notr1ch/remove-excessive-null-checks
libobs: Remove excessive null checks
2020-06-21 04:56:45 -07:00
jpark37
6aa50b3ef1 libobs: Use autoreleasepool for graphics thread
Apparently necessary to clean up macOS leaks.
2020-06-08 13:16:35 -07:00
Richard Stanway
b62ced9bf2 libobs: Unload modules while OBS core is active
Modules are now unloaded while OBS core is still active, allowing
modules that call into libobs in their unload function to continue to
work. This changes the behavior of such calls - previously they were a
no-op since the OBS core would be gone, but they are now executed with
the OBS core still being active.
2020-06-01 15:54:46 +02:00
Richard Stanway
dd519123c6 libobs: Remove excessive null checks
libobs functions check for a null obs_core inconsistently. If the core
is null, the functions silently return with no indication of an error to
the API user. This commit removes all null checks in libobs functions
that require libobs to be initialized. For OBS Studio, we are
(hopefully!) using the API properly so this should have no impact.
2020-06-01 15:54:23 +02:00
张昆
eb44e05169 libobs: Fix unnecessary duplication
Original code makes duplicated item and bad memory

Closes obsproject/obs-studio#2837
2020-05-03 06:28:21 -07:00
Exeldro
874820ec2f libobs: Don't save removed sources 2020-04-18 08:30:06 +02:00
jp9000
934a18625e libobs: Remove repeated semicolons 2020-03-14 10:54:37 -07:00
jp9000
8de20ab3be libobs: Add task scheduling features
(This commit also modifies the UI)

Adds the ability to schedule tasks for certain threads
2020-03-14 10:54:37 -07:00
jp9000
39d8ea235c libobs: Fix another group id comparison
Fixes a group id comparison where it was comparing the pointer of the
group name rather than the string contents itself, causing it to treat
it as a non-group source.
2020-03-13 08:03:06 -07:00
jp9000
19068c2960 libobs: Handle removed plugins for versioned sources
When someone adds a source and the plugin is removed for whatever
reason, it would cause a crash with the new source versioning system.
This fixes that by ensuring the unversioned id is also backed up along
with the normal id.
2020-03-09 16:53:44 -07:00
jp9000
8d5ab2be3b libobs: Don't return false, return NULL 2020-03-09 16:42:50 -07:00
jp9000
3e01a85d39 libobs: Fix crash when querying versioned id
The wrong array was used, thus it couldn't find "group" or "scene".
2020-03-09 16:37:46 -07:00
jp9000
b2302902a3 libobs: Fix source type versioning system
(This also modifies image-source, obs-text, text-freetype2, and UI)

This improves source definition versioning.  To do this, it now stores
two identifier names.  One "unversioned" which is the original name, and
one "versioned" with the version number appended.

This fixes both backward compatibility with older OBS versions, and
fixes the inability to use "add existing" in OBS itself on sources
created from older version definitions.
2020-03-09 06:12:22 -07:00