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

518 Commits

Author SHA1 Message Date
derrod
a73e13eeeb libobs: Keep mixer data for placeholder sources
Placeholder sources are created when a plugin providing a source type is
unavailable. Since they're not marked as having audio any audio track
settings for them get lost. With this change we retain mixer information
if the source owns its id to avoid that.
2023-03-24 12:16:32 -04: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
30519768ad libobs: Add UUIDs to obs_source objects 2023-03-12 01:11:38 +01:00
Richard Stanway
2468268569 libobs: Hold async mutex when calling set_async_texture_size
Calling set_async_texture_size without holding async_mutex is dangerous
as cur_async_frame could be changed / freed by another thread.
2023-03-04 16:10:19 -08:00
PatTheMav
76732846d7 libobs: Fix non-exhaustive switch statements
New video formats introduced for ProRes 4444 encoding have not been
implemented in function calls used for video decoding, which makes the
switch statements non-exhaustive.

This does not functionally change the status quo (decoding ProRes 4444
files could still be broken because libobs does not explicitly handle
the colour format).
2023-02-23 20:32:52 +01:00
jpark37
0efaf88caf libobs: Add PQ/HLG support for I210/I412 formats
Seen when playing back ProRes files.
2023-02-21 18:48:44 +01:00
PatTheMav
fb7a9edadc libobs: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
jpark37
792f8473ee libobs: Fix SDR async video on non-SDR targets
Bug was seen when projecting SDR video capture on WCG displays.
2023-01-24 19:39:42 -08:00
tytan652
7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01:00
jpark37
3d36ba5579 libobs: Fix SRGB to SCRGB async video rendering
SDR source projectors are no longer blown out on HDR displays.
2022-11-17 02:16:48 -08:00
jpark37
6306c8de74 libobs: Move async filtering from render to tick
Fixes frame/texture size mismatch crash that can happen at render time.
2022-11-08 05:37:47 -08:00
gxalpha
5658bf6732 libobs: Add "source_update" signal
Adds a source signal that gets triggered when a source's settings are
updated.
2022-11-05 18:06:53 -07:00
jpark37
080095786f libobs: Force SRGB conversion for tonemapped video
Fixes case where video capture is darkened when both luma wipe and scale
filtering are set.
2022-10-31 14:05:04 -07:00
jpark37
e119a7024d libobs: Sample video at default chroma location
Expect left for 4:2:0 SDR and 4:2:2, and top-left for 4:2:0 HDR.

MJPEG will be a half-pixel off, but we'll live with that for now.
2022-10-09 16:15:16 -07:00
jpark37
bb02620169 libobs: Add support for reading NV12/YUY2 PQ/HLG
8-bit HDR shouldn't exist, but OBS looks broken, so just support it.
2022-09-17 16:36:31 -07:00
jpark37
1a7e5babc2 libobs: Add support for reading I420 HLG
Sony cameras can create 8-bit HLG videos for some reason.
2022-09-16 03:04:23 -07:00
jp9000
6abf89af21 Revert "libobs: Correctly set texture size"
This reverts commit 90a409fe58.

Reverts #7077 for now. This really shouldn't be done so close to
release. This crash technically only happens under very niche scenarios,
and the fix seems to have some other potential issues. Prematurely
merged by Jim.
2022-08-18 11:04:11 -07:00
tududweb
90a409fe58 libobs: Correctly set texture size
Correctly set texture size according to the frame to be rendered this time.
Fixes the mismatch between frame and texture when async-delay-filter on.
2022-08-18 03:43:22 -07:00
jpark37
64ef93a29d libobs: Fix filter color space passthrough
Need to chain against target instead of parent.
2022-08-13 01:32:42 -07:00
Norihiro Kamae
8a4b765c9c libobs: Fix rendering null sprite
When rendering an async-source that does not have a frame yet, massive
error `A sprite cannot be drawn without a width/height` was logged.
2022-05-28 16:05:29 -07:00
jpark37
11da542a0d libobs: Add max_luminance to obs_source_frame
Used in situations where source luminance is greater than HDR nominal
peak setting to avoid clipping by applying BT.2408 maxRGB EETF.
2022-05-27 14:56:47 -07:00
tt2468
a8c481a80e libobs: Only warn when releasing non-NULL source
Only warn when the pointer provided to obs_source_release() is
non-NULL. In some custom usages of libobs, libobs may be freed before
OBS* smart pointers (like OBSSource) are destructed, leading to a
misleading warning if the pointers have already been cleared with
nullptr.

Previous behavior is basically:
- Clear OBS* pointers with nullptr
- Unload libobs
- Those smart pointers that were cleared will still call
obs_source_release() on destruct
- Warning appears
2022-05-21 15:33:39 -07:00
jpark37
d233065d60 libobs: Default 10-bit video to sRGB instead of PQ
Matches how VLC operates. HDR is only in effect with proper metadata.
2022-05-17 02:46:52 -07:00
jpark37
8909e44870 libobs: Cap HLG video at 1000 nits 2022-05-14 16:41:03 -07:00
jpark37
2a0d8d1c9c libobs: Add support for reading I420 PQ
Not normally a valid combination, but Xbox writes 8-bit HDR videos.
2022-05-08 14:12:41 -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
Norihiro Kamae
34e570c5bc Fix indent on multiline comments 2022-04-30 16:06:23 -07:00
mvji
d3a8ef7128 libobs: Add support for YUV422P10LE, YUV444P12LE, YUVA444P12LE 2022-04-19 19:37:07 +02:00
Norihiro Kamae
7b8793f6c3 libobs: Log audio timestamp exceeding TS_SMOOTHING_THRESHOLD
Timestamp of some of audio sources desync over the time and audio glitch
is suspected to be caused when the difference between `timestamp` and
`next_audio_ts_min` exceeds TS_SMOOTHING_THRESHOLD.
When such condition happens, leave a log message to investigate the
glitch of the audio.
2022-04-18 07:51:07 -07:00
jpark37
74daf5cbaf libobs: Fix color space auto-convert blending
Need premultiplied alpha for this, not straight alpha.
2022-04-18 05:23:34 -07: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
72224f0fae libobs: Remove redundant async_color_format member 2022-04-13 06:23:35 -07:00
jpark37
06111d5b10 libobs: Add high-precision sRGB support 2022-04-08 17:19:23 -07:00
jpark37
d72d2552ee libobs: Clear image on color convert
Avoid redrawing potentially stale image from previous frame.
2022-04-07 01:50:27 -07:00
jpark37
0ed0f2cdb4 libobs: Add I010/P010 support, TRC enum 2022-04-03 00:01:25 -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
jpark37
1982ee2597 libobs: Handle filter_texrender format mismatch
This is a possibility in the future where a target might switch between
SDR and HDR.
2022-03-08 12:56:35 -08: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
jp9000
2416dfbd5e libobs: Prevent and log double destroy on sources
This prevents double destroys from happening on sources and causing
crashes. If someone's doing a double destroy it'll probably crash anyway
but at least we'll know what happened if it does. (Jim note: I suspect
third party plugins are calling addref on sources when they shouldn't
be. Either that or we're missing something ourselves, but I suppose
we'll see.)
2022-01-23 11:56:28 -08:00
Cody Jung
e7837e30ce UI: Fix push-to-talk/mute delay not saving
Fixes a couple copy/paste errors preventing push-to-talk and push-to-mute delays
not saving when choosing Apply or OK.
2022-01-08 17:38:04 +11:00
jp9000
a5a8a7c32f libobs: Stop all source processing on destroy
Stops all video/audio IO when a source enters the destroy process.
Prevents any internal callbacks from being triggered and improves
performance.
2022-01-04 13:35:37 -08:00
jp9000
7fa07afd21 libobs: Call destroy signal after waiting
No real reason to have it above. Any other sources will still wait
anyway, so just makes things a bit more consistent.
2022-01-04 13:35:37 -08:00
jp9000
47d8f2e497 libobs: Remove all callbacks on source destroy
Removes all callbacks in use on sources right when a source is about to
be destroyed.

Fixes a crash where callbacks would still be executed while in a
destroyed state (particularly sidechain filters). Could also just mark
the source as being in a destroyed state and not accept anymore
obs_source_output_[audio/video] calls.
2022-01-04 01:45:49 -08:00
jp9000
8212cedf03 Revert "libobs, docs: Add function to get source version"
This reverts commit 1a7a10048c.
2021-12-25 17:10:45 -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
tt2468
d07bd7dff2 libobs: Hold source ref during source_remove signal
Holds an active reference to a source during signaling of the
`source_remove` signal, to prevent receivers from being given an
already-destroyed source.

- Call obs_source_remove(source)
- Receiver 1 gets signal, calls `obs_source_release(source)`
- Receiver 2 gets signal, calls `obs_source_release(source)`,
refs == -1, source destroyed
- Receiver 3 gets signal, source already destroyed, is forced to ignore
signal due to invalid source

This is a theoretical situation which is currently possible in
obs-websocket.
2021-12-19 11:25:43 -08:00
tt2468
079e6cebee libobs: Free async cache when sources output NULL frames
When sources output NULL frames, it is generally used to disable the
source and prevent the last frame from being left on screen. However,
when the source begins outputting video again, the last frame is
still in the async cache.

Depending on the stability of the source's frame output, this still
frame can end up being shown for 5+ output frames.

By freeing the async cache when a NULL frame is submitted, we avoid
the issue of old frames being re-displayed.
2021-11-23 23:04:46 -08:00